Sizing GPUs and Loading Large Models Efficiently
This lesson explains how the size, memory behaviour and generation of large language models change how containers are sized, how GPUs are used and how quickly capacity can be added.
Learning outcomes
After completing this lesson, you will be able to:
- Estimate memory requirements from parameters and precision.
- Fit models with tensor parallelism and quantisation.
- Speed up scale-out with model loading strategies.
Estimating memory requirements
Model weights need roughly 2 bytes per parameter at 16-bit precision (FP16 or BF16), 1 byte at 8-bit and half a byte at 4-bit. A 70-billion-parameter model therefore needs about 140 GB for weights at 16-bit precision, more than one GPU holds. On top of weights, the key-value (KV) cache stores attention state for every token of every active sequence; it grows with context length and with the number of concurrent requests, and often limits how many requests one instance can serve.
Memory planning therefore asks two questions: do the weights fit (with headroom), and how many concurrent sequences of the expected length fit in the remaining memory? The answers determine the instance type, the number of GPUs and the parallelism configuration.
The following diagram compares the memory a 70-billion-parameter model needs with the memory of one GPU.

2bytes
Per parameter for weights at 16-bit precision
1byte
Per parameter at 8-bit precision
140GB
Weights of a 70-billion-parameter model at 16-bit precision
Sizing model weights
Fitting and using GPUs efficiently
Tensor parallelism splits each layer's computations across the GPUs of an instance, so a model too large for one GPU runs on four or eight. Quantization stores weights at 8-bit or 4-bit precision, roughly halving or quartering weight memory and often speeding inference, with a small quality loss that must be evaluated. Continuous batching keeps GPUs busy by adding requests to the running batch at each generation step instead of waiting for a whole batch to finish, and paged attention allocates KV cache memory in blocks to avoid waste.
Token processing capacity is described in tokens per second for prompt processing and for generation. Long prompts are processed in parallel and quickly; output tokens are produced one at a time, so output length dominates latency. Speculative decoding, where a small draft model proposes tokens that the large model verifies, can speed generation on self-hosted servers.
Model loading strategies
Loading tens or hundreds of gigabytes of weights makes scale-out slow: downloading the container, downloading weights from S3 and loading them into GPU memory can take many minutes. Strategies include streaming weights from S3 directly to GPU memory in parallel (the SageMaker AI Fast Model Loader), container caching so new instances do not download the image again, storing weights pre-sharded for the target parallelism, and keeping a minimum number of warm instances so traffic spikes do not wait for cold starts.
The following table summarises the challenges and responses.
| Challenge | Strategy |
|---|---|
| Weights larger than one GPU | Tensor parallelism on a multi-GPU instance; quantisation |
| KV cache limits concurrency | Paged attention; shorter max context; more GPU memory |
| Low GPU utilisation | Continuous batching; inference components sharing instances |
| Slow scale-out | Fast model loading, container caching, warm minimum capacity |
| Slow generation | Shorter outputs, quantisation, speculative decoding, smaller model |
LLM serving challenges
Sizing a deployment
A team deploys a 70-billion-parameter model on a single GPU instance type with 24 GB GPUs and the endpoint fails with out-of-memory errors during loading.
At 16-bit precision the weights need about 140 GB, so they cannot fit on one 24 GB GPU. The fix is an instance with enough total GPU memory (for example eight GPUs with sufficient memory each) and a tensor parallel degree equal to the GPU count, possibly combined with 8-bit quantisation to leave room for the KV cache, validated by an evaluation to confirm quality.
Which part of GPU memory grows with context length and with the number of concurrent requests?
Show answer
The key-value (KV) cache, which holds attention state for every token of every active sequence.
Exam Tips
Remember for the exam
- Weights need about 2 bytes per parameter at 16-bit precision.
- The KV cache grows with context length and concurrency.
- Too large for one GPU: tensor parallelism or quantisation.
- Slow scale-out: fast model loading, cached containers, warm instances.