Why a model that fits can still run out of memory
A model’s file is only the first of three things it needs in GPU memory. This guide takes one open-weight model on one GPU and changes one condition at a time (the context, the requests served at once, the weights’ precision, the KV cache’s format) to show which part grows and which doesn’t.
What takes the memory
A model running on a GPU holds three things in the GPU’s memory:
- Weights: the build’s files. Qwen3 14B’s Q4_K_M build from Qwen/Qwen3-14B-GGUF is 9.0 GB (8.4 GiB); its Q8_0 build 15.7 GB (14.6 GiB).
- KV cache: for every token of context, the model keeps a key and a value in every layer for every KV head. Its size is 2 × layers × KV heads × head width × bytes per value. Qwen3 14B’s config gives 40 layers, 8 KV heads and a head width of 128; at FP16 (2 bytes a value) that is 2 × 40 × 8 × 128 × 2 = 163,840 bytes, 160 KiB per token, for every request served at once.
- Overhead: the runtime and its working memory. The estimate takes the larger of 0.5 GiB and 5% of the weights: an assumption, stated on the methodology page.
Against them stands the GPU’s usable memory: the GeForce RTX 4090’s 24 GB, of which the estimate counts 90% as usable: 21.6 GiB.
Units: a GiB is 2³⁰ bytes. A GPU’s “24 GB” is 24 GiB; a file’s “9.0 GB” is 9.0 × 10⁹ bytes, 8.4 GiB. Mixing the two is a 7% error.
Context × requests at once
At Q4_K_M with an FP16 KV cache, changing only the context and the number of requests served at once:
| Context | 1 request | 4 requests at once |
|---|---|---|
| 8K | 10.1 GiB 8.4 GiB weights + 1.3 GiB KV + 0.5 GiB overhead | 13.9 GiB 8.4 GiB weights + 5.0 GiB KV + 0.5 GiB overhead |
| 32K | 13.9 GiB 8.4 GiB weights + 5.0 GiB KV + 0.5 GiB overhead | 28.9 GiB 8.4 GiB weights + 20.0 GiB KV + 0.5 GiB overhead |
Weights KV cache Overhead Usable memory (21.6 GiB)
The weights are the same 8.4 GiB in all four cells; only the KV cache changes. It grows with the context, and again with every request served at once: four requests at 8K hold as many tokens as one at 32K (13.9 GiB both). 4 requests at 32K need 20.0 GiB of KV cache alone, more than the weights: 28.9 GiB in all, 134% of the card’s usable memory: it doesn’t fit.
A model that “fits a 24 GB card” fits at a given context and number of requests; its file size answers neither.
Smaller weights don’t shrink the KV cache
The same four cells with the Q8_0 build:
| Context | 1 request | 4 requests at once |
|---|---|---|
| 8K | 16.6 GiB 14.6 GiB weights + 1.3 GiB KV + 0.7 GiB overhead | 20.4 GiB 14.6 GiB weights + 5.0 GiB KV + 0.7 GiB overhead |
| 32K | 20.4 GiB 14.6 GiB weights + 5.0 GiB KV + 0.7 GiB overhead | 35.4 GiB 14.6 GiB weights + 20.0 GiB KV + 0.7 GiB overhead |
Weights KV cache Overhead Usable memory (21.6 GiB)
Every cell grows by the same 6.5 GiB: the larger file and its share of the overhead. The KV cache is what it was at Q4_K_M; quantising the weights doesn’t touch it. One request at 32K still fits (94%); 4 requests at 32K need 35.4 GiB. The native BF16 weights alone are 29.5 GB (27.5 GiB), past the card at any context.
Quantising the KV cache
The KV cache has a format of its own. llama.cpp’s q8_0 stores 32 values in 34 bytes instead of FP16’s 64, 53.1% of the size. The weights back at Q4_K_M:
| Context | 1 request | 4 requests at once |
|---|---|---|
| 8K | 9.5 GiB 8.4 GiB weights + 0.7 GiB KV + 0.5 GiB overhead Fits · 44% of usable memory | 11.5 GiB 8.4 GiB weights + 2.7 GiB KV + 0.5 GiB overhead Fits · 53% of usable memory |
| 32K | 11.5 GiB 8.4 GiB weights + 2.7 GiB KV + 0.5 GiB overhead Fits · 53% of usable memory | 19.5 GiB 8.4 GiB weights + 10.6 GiB KV + 0.5 GiB overhead Fits · 90% of usable memory |
Weights KV cache Overhead Usable memory (21.6 GiB)
4 requests at 32K now need 10.6 GiB of KV cache, 19.5 GiB in all (90%): they fit. Whether a runtime offers that format for this model, and what it does to the answers, the estimate doesn’t say.
Past the native context
Qwen3 14B’s card gives 32,768 tokens natively and 131,072 with YaRN; its config has 40,960 positions. One request at 128K needs 20.0 GiB of FP16 KV cache, 28.9 GiB in all (134%: it doesn’t fit); with a q8_0 KV cache 19.5 GiB (90%: it fits). Past the native context the runtime needs the extension’s settings, which the model page gives for each runtime the card names.
Fitting is one of four questions
- Does it fit? The estimate on this page: weights, KV cache and overhead against usable memory, nothing run.
- Does the runtime run it that way? Its support for the build’s format, for a KV cache format and for a context extension, and how it lays out the cache for parallel requests, are in its own documentation.
- Are the answers good enough? Quantising weights or the KV cache changes a model’s output; this page measures nothing about quality.
- Is it fast enough? The model page estimates speed from the GPU’s memory bandwidth: an estimate, not a measurement.
None of the figures here comes from running the model.
Check it yourself
- Each cell’s verdict opens the model page’s local-run estimate on the same GPU, context, requests and precision.
- The formula and its constants are on the methodology page; each fact links to the maker’s page it comes from (the dot beside it).
- Reviewed on Nov 23, 2026 against data release rel_20261123_005634_dc492f63d151.