How much VRAM for 128K context? KV cache for 7 models
How much VRAM for 128K context: KV cache size at 8K, 32K and 128K for seven local LLMs, FP16 vs 8-bit cache, and the smallest VRAM tier that holds each.
Updated · By RigPerDollar
As an Amazon Associate I earn from qualifying purchases. Some links on this page are affiliate links.
Short answer
How much VRAM you need for 128K context depends on the model: a 16 GB Radeon RX 9070 holds gpt-oss-20b, and a 24 GB RTX 3090 holds Qwen3.8-27B with an 8-bit cache. A 32 GB RTX 5090 holds Gemma 4 31B, Qwen3.6-35B-A3B and Qwen3-Coder-30B-A3B (8-bit cache). Llama 3.3 70B and gpt-oss-120b need more than 48 GB, such as a 128 GB DGX Spark.
A few terms
- VRAM is the memory on your graphics card. A Mac or a DGX Spark has one pool of unified memory instead. A Mac lets its GPU use only part of it by default. By our estimate, a 96 GB Mac Studio gives the GPU about 72 GB.
- Context is how much text the model can hold at once, counted in tokens (pieces of words). Runtimes count it in binary thousands, so 128K is 131,072 tokens and 32K is 32,768.
- The KV cache is the model’s working memory. As it reads, the model keeps notes on every token, called keys and values (K and V), so it can look back at them. The cache grows with every token of context, and it has to sit in VRAM next to the model file.
- FP16 is the default cache format in llama.cpp (a popular open-source program for running models locally). It stores each number in 2 bytes. An 8-bit cache (q8_0) packs 32 numbers into 34 bytes, so it takes about 53% of the FP16 size. An FP8 cache (f8_e4m3, in llama.cpp’s tagged release v1.0.0 since Nov 13, 2026) stores each number in exactly 1 byte, so it takes 50%.
- Q4 is a compressed model file format that shrinks a model so it fits in less memory. All files here are Q4_K_M GGUF files.
- MoE (mixture of experts) models have many parts and run only a few of them for each token. That makes them fast. It doesn’t change the size of the KV cache.
- Tok/s means tokens per second, or how fast a model writes.
This is why a model can “fit” and then run out of memory later. The file loads fine, and the cache fills the rest of the card as the chat or document gets longer.
KV cache and VRAM tier for seven models
Every number below is a RigPerDollar estimate for llama.cpp, worked out with the same code that runs My Rig. The cache size comes from each model’s config.json, as listed in our model data. A model fits a tier when its file plus 1.5 GB of headroom fits, and the cache for the stated context fits beside the file and a 1 GB runtime reserve. Our methodology shows the formula. These are estimates, and we have not measured them.
Each KV cell shows the default FP16 cache first, then the 8-bit cache. The tier is the smallest of 8, 12, 16, 24, 32 and 48 GB that holds the context. Past 48 GB we use about 72 GB (what a 96 GB Mac Studio M5 Ultra gives its GPU), then 96 GB and 128 GB.
| Model | Q4 file | KV cache at 8K | KV cache at 32K | KV cache at 128K | Smallest tier, 32K | Smallest tier, 128K |
|---|---|---|---|---|---|---|
| gpt-oss-20b | 11.67 GB | 0.22 / 0.12 GB | 0.82 / 0.44 GB | 3.24 / 1.72 GB | 16 GB | 16 GB |
| Qwen3.8-27B | 17.44 GB | 0.54 / 0.29 GB | 2.15 / 1.14 GB | 8.59 / 4.56 GB | 24 GB | 32 GB (24 GB with 8-bit) |
| Gemma 4 31B | 18.32 GB | 1.93 / 1.02 GB | 3.94 / 2.09 GB | 12.00 / 6.37 GB | 24 GB | 32 GB |
| Qwen3-Coder-30B-A3B | 18.56 GB | 0.81 / 0.43 GB | 3.22 / 1.71 GB | 12.88 / 6.85 GB | 24 GB | 48 GB (32 GB with 8-bit) |
| Qwen3.6-35B-A3B | 22.29 GB | 0.17 / 0.09 GB | 0.67 / 0.36 GB | 2.68 / 1.43 GB | 24 GB | 32 GB |
| gpt-oss-120b | 62.84 GB | 0.33 / 0.17 GB | 1.23 / 0.65 GB | 4.86 / 2.58 GB | about 72 GB | about 72 GB |
| Llama 3.3 70B | 42.52 GB | 2.68 / 1.43 GB | 10.74 / 5.70 GB | 42.95 / 22.82 GB | about 72 GB | 96 GB (about 72 GB with 8-bit) |
At 8K, every model lands on the same tier as at 32K, except Llama 3.3 70B, which fits 48 GB at 8K. gpt-oss-20b, gpt-oss-120b and Llama 3.3 70B top out at 128K. The other four models go up to 256K.
Some things stand out:
- For most of these models, the step from 32K to 128K is what pushes them up a tier. Qwen3.6-35B-A3B needs only 2.68 GB of cache at 128K, but its file is 22.29 GB, so a 24 GB card has no room left for it.
- Llama 3.3 70B needs 42.95 GB of FP16 cache at 128K. That is more than its 42.52 GB file.
- gpt-oss-120b has the largest file here, at 62.84 GB, yet 128K of context adds only 4.86 GB.
- Qwen3-Coder-30B-A3B is an older model. Our data marks it as superseded by Qwen3-Coder-Next. We kept it because it shows a large cache on a mid-size file.
- Llama 3.3 70B is also marked older in our data, superseded by Meta Muse Glimmer 30B. We kept it as the 70B dense example.
Why similar models need very different KV memory
Qwen3.8-27B, Gemma 4 31B and Qwen3-Coder-30B-A3B have files within about 1.1 GB of each other. At 128K their FP16 caches are 8.59, 12.00 and 12.88 GB. The difference is how many bytes each token costs, which depends on the model’s design. These figures come from each model’s config.json, as stored in our data:
| Model | Layers whose cache grows with context | KV heads x head size | KV cache per token (FP16) |
|---|---|---|---|
| Llama 3.3 70B | 80 | 8 x 128 | 327,680 bytes |
| Qwen3-Coder-30B-A3B | 48 | 4 x 128 | 98,304 bytes |
| Gemma 4 31B | 10 global layers | 4 x 512 | 81,920 bytes |
| Qwen3.8-27B | 16 attention layers | 4 x 256 | 65,536 bytes |
| gpt-oss-120b | 18 global layers | 8 x 64 | 36,864 bytes |
| gpt-oss-20b | 12 global layers | 8 x 64 | 24,576 bytes |
| Qwen3.6-35B-A3B | 10 attention layers | 2 x 256 | 20,480 bytes |
Three design choices explain most of the gap:
- Grouped-query attention (GQA). Several query heads share one key and value head, so the cache stores only the KV heads. Llama 3.3 70B and Qwen3-Coder-30B-A3B both use it, but every one of their layers still keeps a cache for the whole context. With 80 layers, Llama’s cache grows fast.
- Sliding-window attention. Gemma 4 and gpt-oss use it on part of their layers. Those layers look back only over a fixed window: 1,024 tokens on Gemma 4 31B’s 50 sliding-window layers and 128 tokens on gpt-oss. llama.cpp sizes that cache to the window plus 512 tokens, so it stays the same size at any context. For Gemma 4 31B it is a fixed 1.26 GB at FP16, which is why its cache is already 1.93 GB at 8K. Only the global layers in the table grow with context.
- Hybrid layers. Qwen3.8-27B and Qwen3.6-35B-A3B are hybrid models. Only some of their layers are attention layers with a KV cache. The others keep a small state that doesn’t grow, and our 1 GB runtime reserve covers it.
These are the site’s estimate method, applied to the counts in each config. Gemma 4’s config sets an option called attention_k_eq_v on its global layers. We still count K and V separately, so its numbers may be on the high side. The real memory use in your runtime can differ.
What an 8-bit KV cache saves
The 8-bit cache stores 32 numbers in 34 bytes instead of 64, so every cache figure drops to about 53%. The model file stays the same size. On a card that is short on room, the extra context can be large:
| Model and memory | Max context, FP16 cache | Max context, 8-bit cache |
|---|---|---|
| Qwen3.8-27B on 24 GB | 82K | 155K |
| Gemma 4 31B on 24 GB | 40K | 90K |
| Qwen3-Coder-30B-A3B on 24 GB | 44K | 83K |
| Qwen3-Coder-30B-A3B on 32 GB | 123K | 232K |
| Llama 3.3 70B on about 72 GB | 84K | full 128K |
| Llama 3.3 70B on 48 GB | 13K | 25K |
For Llama 3.3 70B at 128K, the switch cuts the cache from 42.95 GB to 22.82 GB.
We have not tested whether an 8-bit cache changes answer quality, and we don’t have a source we trust on that, so we make no claim either way. Our speed method doesn’t model the cache format, so we don’t estimate how it changes speed. Longer context is also slower in general, because every new token reads the whole cache. Our speed estimates are for short context.
FP8 KV cache in llama.cpp (v1.0.0)
On Nov 10, 2026, llama.cpp merged FP8 KV cache support (pull request #28392). It shipped in tagged release v1.0.0 on Nov 13, 2026, llama.cpp’s first stable release. FP8 is an 8-bit floating-point number format, a smaller cousin of FP16. You turn it on with --cache-type-k f8_e4m3 --cache-type-v f8_e4m3 (short form -ctk and -ctv).
- Size. Each number takes exactly 1 byte, with no extra scale stored per block of numbers. So in our byte math an FP8 cache is exactly half the FP16 size, a little smaller than q8_0’s 53%. For Llama 3.3 70B at 128K, that is 21.47 GB of FP8 cache, against 42.95 GB at FP16 and 22.82 GB with q8_0. This is arithmetic on the same estimate, not a measurement.
- Scales. The pull request says static per-tensor scales are supported but optional. A scale is a stored multiplier that helps the small format cover the range of values. Some model checkpoints ship FP8 cache scales of their own.
- Where it works. It is in llama.cpp’s tagged release v1.0.0 and later, with the same flags. The release notes list “FP8 KV caches (
-ctk/-ctv f8_e4m3) with optional static per-tensor scales (#28392)”. Ollama and LM Studio offer it once they ship a llama.cpp build that includes it. We have not checked whether they have. - Where it doesn’t. Per the pull request, llama.cpp refuses an FP8 cache for MLA models (a design that caches a compressed summary instead of full keys and values) and for a list of architectures that includes DeepSeek V4 and V4.1, Mistral Large 4 and MiniMax M3. None of the seven models in this guide uses MLA or one of the listed architectures. Their configs name gpt-oss, Qwen3.5-style hybrid, Gemma 4, Qwen3 MoE and Llama designs.
In our estimates, FP8 holds a little more context than q8_0 on the same card, for example Qwen3.8-27B on 24 GB at about 165K instead of 155K, and Llama 3.3 70B on 48 GB at 26K instead of 25K. It moves none of the seven to a smaller tier than the 8-bit cache does in the tables above. These are estimates from the same code as the tables. As with q8_0, we make no claim about quality or speed, because we have not tested it and know of no source that has measured either.
Which VRAM tier for 32K and 128K
These are the seven models above at each tier, with one card or system we have a price for. New card prices are the lowest in-stock Newegg listing, read by ComponentPrices on Nov 16, 2026. Used prices are the bottom of the typical range of completed US eBay sales over 14 days, read from gpusold.com on Nov 23, 2026 for the RTX 3090 and Nov 17, 2026 for the RTX 3060 12GB.
| Tier | Example we price | Price | Holds 32K | Holds 128K |
|---|---|---|---|---|
| 8 GB | RTX 5060 | $459.99 new | none of the seven | none of the seven |
| 12 GB | RTX 3060 12GB | $317 used (median $348) | none of the seven | none of the seven |
| 16 GB | Radeon RX 9070 | $934.99 new | gpt-oss-20b | gpt-oss-20b |
| 24 GB | RTX 3090 | $1,568 used (median $1,670) | the five mid-size models | gpt-oss-20b; Qwen3.8-27B with 8-bit cache |
| 32 GB | RTX 5090 | $6,249.99 new | the five mid-size models | the five mid-size models (Qwen3-Coder-30B-A3B with 8-bit cache) |
| 48 GB | two RTX 3090s | 2 x $1,568 used | the five mid-size models | the five mid-size models |
| about 72 GB | Mac Studio M5 Ultra, 96 GB | $5,499 new (Oct 23, 2026) | all seven | all seven (Llama 3.3 70B with 8-bit cache) |
| 128 GB | DGX Spark | $6,949.99 new (Oct 23, 2026) | all seven | all seven |
The five mid-size models are gpt-oss-20b, Qwen3.8-27B, Gemma 4 31B, Qwen3-Coder-30B-A3B and Qwen3.6-35B-A3B. Some notes on the tiers:
- 8 and 12 GB. None of the seven fit. gpt-oss-20b is 1.2 GB short on 12 GB. Smaller models do run with long context there, and our 8 GB and 12 GB guides list them.
- 24 GB. Every mid-size model holds 32K. At 128K only gpt-oss-20b fits with the default cache. The RTX 3090 price is the low end of the range across 287 sales.
- 32 GB. This is where 128K works for all five mid-size models. Our 16 vs 24 vs 32 GB guide compares these tiers in more depth.
- 48 GB. Our only stored 48 GB card price, for the RTX A6000, is under review, so we leave it out. Two 24 GB cards give 48 GB with the model split by layers across them. That gives the model more room. The speed estimate stays the same as for one card. Llama 3.3 70B fits 48 GB but holds only 13K of context (25K with the 8-bit cache), so it misses 32K.
- About 72 GB. The Mac Studio M5 Ultra price is Apple’s starting price for that configuration. The RTX PRO 5000 Blackwell 72GB card is also on our list, but we have no price for it.
- 96 GB. The RTX PRO 6000 Blackwell holds Llama 3.3 70B at 128K with the default cache. We have no price for it.
- 128 GB. The DGX Spark price is a Micro Center shelf price. It holds all seven at 128K with the default cache. With 273 GB/s of memory bandwidth, its speed estimates on dense models are low: 6 tok/s on Llama 3.3 70B and 13 tok/s on Qwen3.8-27B. Our Spark estimates may also run high, as the methodology explains.
To check any card at a context you need, open My Rig set to an RTX 3090 with 128K context and change the card or the “Context needed” box. It also shows which models could run with part of the model in system RAM. That runs much slower than on the card.
A measured long-context run from a third party
This is a self-reported run, kept apart from our estimates. It used a different model file and runtime from everything above, so don’t compare it with our numbers.
- Source: Niklas Lenz, author’s page. We checked the numbers against the author’s published raw output file. It has not been independently reproduced.
- Model: kaitchup/Qwen3.8-27B-SLQ-EAR98, a quantized Qwen3.8-27B with 23.73 GB of weight files.
- Runtime: vLLM 0.31.0 with a bf16 KV cache.
- Hardware: one RTX 5090 (32 GB). Measured Oct 25, 2026.
- Context: 74,752 tokens, which the author says was the largest that loaded.
- Results: 67.2 tok/s writing speed with one request on a code prompt, and 9.51 s to the first token at a 32K prompt.
vLLM sets aside memory in its own way, so its context limits differ from llama.cpp’s.
What we haven’t verified
- Every fit, context and cache size here is an estimate from config files and our formula. We have not measured memory use on any of these cards.
- Answer quality. We don’t test it, at any context length or cache format.
- How much the 8-bit cache changes speed or quality.
- The FP8 cache in llama.cpp. We have not built or run it, so its memory use, speed and effect on answers are unmeasured here, and the FP8 figures above are byte math only.
- Gemma 4’s real cache size. We count K and V separately, which may overstate it.
- Runtimes other than llama.cpp. vLLM, Ollama and LM Studio settings can give different limits.
- Prices for the RTX PRO 5000 Blackwell 72GB and the RTX PRO 6000 Blackwell. We have none, and we left out the stored RTX A6000 price.
- Speed at long context. Our estimates are for short context, and long context is slower.