Running a language model on your own computer or server comes down to one question first: will it fit in the graphics card’s memory? If the model and its working memory do not fit in VRAM, it either will not load or runs far more slowly, spilling into system memory. The good news is that the size can be worked out before you download anything. It has two main parts, the model’s weights and the memory for the conversation it is holding, and the second is the one people forget.
Part one: the weights
The weights are the model’s parameters, and their size is simple arithmetic:
weights = parameters × bits per weight ÷ 8
- At 16-bit (FP16 or BF16), each parameter takes 2 bytes.
- At 8-bit, 1 byte.
- At 4-bit, half a byte.
So an 8-billion-parameter model needs about 16 GB at 16-bit, 8 GB at 8-bit and 4 GB at 4-bit, before anything else. In the units GPUs are sold in, gibibytes of 1,024³ bytes, that is about 15 GiB, 7.5 GiB and 3.7 GiB.
Part two: the KV cache
As a model reads and writes text, it keeps intermediate values for every token so far, the key-value (KV) cache, so it does not have to recompute them. Its size grows with the length of the context. Sebastian Raschka sets out the formula:
KV cache = 2 × layers × KV heads × head dimension × bytes per element × tokens × sequences
The 2 is for keys and values. The architecture numbers are in each model’s configuration file.
His example is Qwen3 8B: 36 layers, 8 KV heads, a head dimension of 128, stored at 16-bit (2 bytes). That is about 144 KiB per token. At a context of 32,768 tokens, the cache is about 4.5 GiB for one sequence, on top of the weights.
Putting it together
For the same 8B model with a 32,768-token context and one sequence at a time, adding 10% for the runtime and other overhead, an assumption since it varies by engine:
| Weights | Weights size | KV cache | Total, with 10% |
|---|---|---|---|
| 16-bit | 15 GiB | 4.5 GiB | about 21 GiB |
| 8-bit | 7.5 GiB | 4.5 GiB | about 13 GiB |
| 4-bit | 3.7 GiB | 4.5 GiB | about 9 GiB |
At 16-bit it needs a 24 GB card. At 4-bit it fits on a 12 GB card, and with the context cut to 8,192 tokens, the cache drops to about 1.1 GiB and the total to about 5.3 GiB, within an 8 GB card.
The LLM VRAM calculator works out the weights, the KV cache and the total for any model from its parameters, precision, context length and architecture, and suggests the card size it needs.
Why context length matters so much
The KV cache grows in a straight line with the number of tokens kept. Double the context and you double the cache. At long contexts, the cache can be as large as the weights themselves, and for a small quantised model, larger. If a model fits at short contexts but not long ones, the context setting is usually the first thing to reduce. The context window calculator shows how much text a given number of tokens holds, and our guide on what a context window is explains the trade-offs.
Several users at once
Each conversation being processed at the same time keeps its own KV cache. Raschka’s example puts eight sequences of 32,768 tokens at about 36 GiB of cache for Qwen3 8B alone, while the weights are loaded once and shared. Serving many users is mostly a question of cache memory.
Bigger models
The same arithmetic scales up. A 70-billion-parameter model needs about 130 GiB for its weights at 16-bit, 65 GiB at 8-bit and 33 GiB at 4-bit. With a common 70B architecture of 80 layers, 8 KV heads and a head dimension of 128, an 8,192-token context adds about 2.5 GiB, so at 4-bit the total is about 39 GiB: a 48 GB card, or two smaller ones.
What quantisation costs
Quantisation stores weights with fewer bits. It cuts memory sharply, and modern 8-bit and 4-bit formats keep much of the model’s quality, but very low bit widths can lose some accuracy, and quality depends on the method and the model. Quantised formats also store a little extra information for their scales, which the overhead allowance covers. The KV cache can often be stored at 8-bit too, halving its size.
Speed is a separate question
Fitting in memory is the first hurdle; how fast the model answers is the next. Generation speed depends on the GPU’s memory bandwidth and the model’s size, and it is measured in tokens per second. The tokens per second calculator turns a speed into the time to answer, and our guide on tokens per second explains what speeds feel like.
Checking before you download
- Find the parameter count and the precision or quantisation of the file you plan to use.
- Find the architecture numbers (layers, KV heads, head dimension) in the model’s configuration.
- Decide the context length you actually need.
- Add up weights, cache and overhead, and compare with your card’s VRAM, leaving some room for the display and other programs.
Common questions
How much VRAM do I need for a 7B or 8B model? About 15 GiB for the weights at 16-bit, plus the KV cache; at 4-bit, around 4 GiB plus the cache. A 12 GB card is comfortable for 4-bit with a moderate context.
Can I run a model larger than my VRAM? Some runtimes split a model between GPU and system memory, but it runs much more slowly.
Does context length use VRAM? Yes, through the KV cache, which grows with every token kept.
Is 8-bit or 4-bit better? 8-bit usually keeps more quality; 4-bit fits on smaller cards. Test both on your own tasks.
Limits of this guide
The overhead figure is an assumption; real usage depends on the runtime, settings and other processes on the GPU. Use the estimate to choose hardware and settings, then check actual memory use when the model is running.
Sources, read November 15, 2026:
- Sebastian Raschka, The KV cache as a long-context bottleneck: the KV cache formula and the Qwen3 8B example of 144 KiB per token, 4.5 GiB at 32,768 tokens and about 36 GiB for eight sequences.