A 7B Q4 model on one 24 GB GPU
A developer serves a 7B four-bit model with 32 layers and full multi-head attention. The initial workstation test uses one 4,096-token sequence and FP16 KV.
Jump to resultsInputs
Results
Runs in your browser- Required memory
- 6.982GB
- Minimum GPU count
- 1GPUs Aggregate memory lower bound
- Decode bandwidth ceiling
- 147.46tok/s Ideal aggregate across the batch
Compare measured decode speed with this bandwidth ceiling. Verify the model fits each rank individually.
| Model weights | 4.2 GB |
|---|---|
| Active KV cache | 2.147 GB |
| Activation and scratch reserve | 0.635 GB |
| Usable memory per GPU | 20.4 GB |
| Usable memory across GPUs | 20.4 GB |
| KV per cached token | 524.288 kB |
| Ceiling per sequence | 147.46 tok/s |
What to try
Weights and cache leave ample modeled device room at batch one. Increase simultaneous sequences to see when the full multi-head cache becomes the binding allocation.
How the estimate works
KV bytes = 2 × layers × hidden width × KV-head ratio × bytes × tokens × sequences
The model assumes dense decoder-only attention. FP16 uses two bytes per parameter, FP8 and INT8 use one, and Q4_K_M uses a rough 0.60 bytes to include mixed precision and quantization metadata. Use the actual model file size to check this assumption.
Keys and values grow with the live context and batch. GQA reduces the cached width by the ratio of KV heads to query heads. Workspace is an adjustable percentage of weights plus KV, with a separate allowance for unavailable GPU memory.
The GPU count is a memory lower bound. The decode ceiling assumes perfect sharding and one sweep of weights and active KV per batch step at full bandwidth. Kernel overhead, compute, prefill, cache sharing, allocator fragmentation, and interconnect can lower measured output.
Frequently asked questions
How much cache does one 4K sequence use on this 7B model?
The given layers and hidden width use 512 KiB per token with FP16 keys and values, or 2 GiB for a 4,096-token sequence.
Why does Q4_K_M use more than half a byte per parameter?
Mixed quantization, scaling data, and some higher-precision tensors add overhead. The calculator uses 0.60 bytes as a planning estimate.