CNSLT ACADEMY / MODEL DEPLOYMENT AND SYSTEM DESIGN

GPUs and Inference Economics

FOUNDATIONSBEGINNERFREE TEXT LESSONVIDEO 🔒 PRO

Explain why GPUs are used for AI workloads, understand VRAM and model-size estimates, distinguish latency from throughput, and identify major cost drivers.

GPUs and Inference Economics

##

  1. CPU and GPU

A CPU is designed for flexible, low-latency execution across varied tasks. A GPU is designed to perform many operations in parallel. Neural networks contain large numbers of matrix and vector operations, so GPUs can accelerate training and inference. This does not mean every AI workload requires a GPU or that every GPU is suitable for every model.

##

  1. Parameters and memory

Model parameters are learned numerical values. A rough lower-bound estimate for parameter storage is:

parameter count × bytes per parameter

For a 7-billion-parameter model:

  • FP32 (4 bytes): about 28 GB
  • FP16/BF16 (2 bytes): about 14 GB
  • INT8 (1 byte): about 7 GB
  • INT4 (0.5 byte): about 3.5 GB

These are decimal storage estimates for weights only. Actual memory requirements are higher because of runtime overhead, activations, temporary buffers, metadata and the key-value (KV) cache used by many autoregressive serving systems. Quantisation can reduce memory, but may affect quality and hardware compatibility.

##

  1. VRAM and KV cache

VRAM is the GPU's high-bandwidth memory. The weights must fit in available memory, but so must other runtime data. The KV cache stores attention keys and values for prior tokens so the system does not need to recompute all prior context at every generation step. Longer contexts, larger batches and more concurrent sequences can increase KV-cache requirements.

##

  1. Performance vocabulary
  • Latency: time taken for an operation or request.
  • Time to first token (TTFT): time from request submission to the first generated token.
  • Inter-token latency: time between generated tokens.
  • Throughput: amount of work completed per unit time, often tokens per second.
  • Concurrency: number of requests or sequences being served at once.
  • Availability: proportion of time the service is usable.

A system can have low latency for one user but poor throughput under high concurrency. Measure under realistic workloads.

##

  1. Batching and quantisation

Batching combines work from multiple requests to improve hardware utilisation. Continuous batching allows requests to enter and leave a serving batch as generation progresses. This can improve throughput, but may affect latency and fairness if poorly configured.

Quantisation represents weights or activations with lower numerical precision. It can reduce memory use and improve performance on supported hardware. Validate quality on the actual task; lower precision is a trade-off, not a free optimisation.

##

  1. Cloud vs on-premises

Cloud GPUs can reduce procurement and maintenance burden and offer elastic capacity, but create provider dependency, data-transfer, residency and variable-cost considerations. On-premises infrastructure can offer greater control and predictable access, but requires capital, skilled operations, power, cooling, capacity planning and hardware lifecycle management.

##

  1. Simple cost example

Assume a GPU instance costs $2 per hour and runs 10 hours per day for 30 days:

$2 × 10 × 30 = $600

If the service completes 30,000 requests during that period, the GPU rental component is $600 / 30,000 = $0.02 per request. This is not total cost of ownership. It excludes storage, networking, engineering, idle capacity, redundancy, support, monitoring and other infrastructure.

A useful business metric is cost per successful task, not simply cost per request. A cheap model that requires repeated retries or human correction may be more expensive overall.

##

  1. AI GRC considerations

Assess capacity and availability, provider concentration, cost controls, data location, access to infrastructure, vulnerability management, patching, physical security, energy constraints, incident response and exit planning. Ensure load tests and budget alerts exist before production scale.

##

  1. Practical exercise

Estimate memory for a 13B-parameter model at FP16 and INT8. Explain why the estimate is not sufficient to select a GPU. Then define a test measuring TTFT, throughput and cost per successful task at expected concurrency.

Worked answer: FP16 weights are roughly 26 GB decimal; INT8 weights roughly 13 GB. Additional memory is needed for runtime and KV cache, so a GPU with exactly the weight-storage capacity is not a safe sizing choice.

##

  1. Knowledge check
  2. Why are GPUs useful for neural networks?
  3. How much FP16 weight storage does a 7B model require approximately?
  4. Why is weight memory not the full VRAM requirement?
  5. What does TTFT measure?
  6. Why is cost per successful task useful?

Answer key:

  1. They accelerate parallel numerical operations.
  2. About 14 GB decimal.
  3. Runtime, activations, buffers and KV cache also use memory.
  4. Time until the first output token.
  5. It accounts for quality, retries and correction rather than only request volume.

##

  1. Checklist
  • [ ] Estimate weights and runtime memory separately.
  • [ ] Include KV-cache and concurrency assumptions.
  • [ ] Benchmark representative prompt and output lengths.
  • [ ] Measure TTFT, inter-token latency and throughput.
  • [ ] Test quality after quantisation.
  • [ ] Model total cost, idle capacity and redundancy.
  • [ ] Set budgets, alerts and capacity-failure procedures.

##

  1. Further reading
LEARNER FEEDBACK

Help improve this learning path.

Suggest a concept we should teach, or tell us what is unclear. No account is required. Email is optional and only for a reply. Do not include confidential or sensitive information.

COURSE PROGRESS0/29 complete
Not yet completed
CHECK YOUR UNDERSTANDING