# How much VRAM do you need to run a local LLM? 7B, 14B, 27B, 70B and quantization explained

Canonical: https://kextcache.com/how-much-vram-for-local-llm/
Published: 2026-11-27T09:00:00+05:30
Updated: 2026-11-27T09:00:00+05:30
Author: Ayush Sahay Chaudhary

You want to run a model on your own graphics card and the first question is always the same: will it fit? Short answer, at the usual Q4_K_M quant with 8,192 tokens of context: an 8B model needs about 6 GiB, a 14B needs about 10 GiB, a 24B to 27B needs 15 to 17 GiB, and a 70B needs about 43 GiB. So 8 GB of VRAM runs the 8B class, 12 GB runs 14B, 24 GB runs 27B, and 70B wants two cards or a big Mac.

Those numbers come from a formula I wrote for our [Will it run? checker](/tools/will-it-run/) and checked against every run on our [benchmark page](/local-llm-benchmarks/). The rest of this guide is the maths behind them, so you can work out any model, any quant and any context length yourself, and know where the formula is generous and where it isn't.

## The three things that eat VRAM

When llama.cpp loads a model with every layer on the GPU (`-ngl 99`), the card holds three things:

1. **The weights.** The GGUF file, more or less byte for byte. This is the big one and the only one the quant changes.
2. **The KV cache.** Keys and values for every token in the context window, so the model doesn't recompute them for each new token. It grows with context length and depends on the model's attention layout.
3. **Working buffers.** Scratch space for the computation. The largest piece is the output scores for a batch: vocabulary size × 512 × 4 bytes. A 262,144-word vocabulary (Gemma) costs 0.5 GiB for that alone. I add 256 MiB for the rest.

Add them up and compare with the card. Here is Llama 3.1 8B Instruct at Q4_K_M, the model people most often ask about:

| Context | Weights | KV cache | Buffers | Total |
| --- | --- | --- | --- | --- |
| 4,096 tokens | 4.58 GiB | 0.50 GiB | 0.49 GiB | 5.58 GiB |
| 8,192 tokens | 4.58 GiB | 1.00 GiB | 0.49 GiB | 6.08 GiB |
| 32,768 tokens | 4.58 GiB | 4.00 GiB | 0.49 GiB | 9.08 GiB |

On my RX 5700 XT (8 GB) the driver reported 4,755 MiB in use at zero context and 5,287 MiB with 4,096 tokens in, so the formula lands about 0.5 GiB above what the card used. That is on purpose, more on it below. The practical reading: Llama 3.1 8B at Q4_K_M is an 8 GB model up to about 16k of context, and at 32k it needs a 12 GB card.

## Weights: what each quant costs per parameter

A model's parameter count tells you the file size once you know the bits per weight. I pulled the GGUF sizes of 22 models from Hugging Face (the list in the checker) and divided by their parameter counts. The spread is small, so you can use these as rules of thumb:

| Quant | Bits per weight (measured across 22 models) | Bytes per billion parameters | Llama 3.1 8B file |
| --- | --- | --- | --- |
| Q2_K | 3.0 to 3.6 | ~0.4 GiB | 2.96 GiB |
| Q3_K_M | 3.8 to 4.4 | ~0.5 GiB | 3.74 GiB |
| Q4_K_M | 4.8 to 5.2 | ~0.6 GiB | 4.58 GiB |
| Q5_K_M | 5.7 to 6.0 | ~0.7 GiB | 5.34 GiB |
| Q6_K | 6.4 to 6.8 | ~0.8 GiB | 6.14 GiB |
| Q8_0 | 8.5 | ~1.0 GiB | 7.95 GiB |
| F16 (unquantised) | 16 | 1.86 GiB | ~15 GiB |

The llama.cpp project publishes the same measurement for Llama 3.1 8B in its [quantize README](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md): Q4_K_M at 4.8944 bits per weight and 4.58 GiB, Q8_0 at 8.5008 bits and 7.95 GiB, F16 at 14.96 GiB. My numbers match theirs, which is reassuring since I got them from file sizes alone.

So why is "Q4" nearly 5 bits and "Q8" more than 8? Two reasons. Every block of weights carries a scale factor on top of the quantised values, which is the fraction over the headline number. And the K-quant "M" mixes stay higher precision for the tensors that hurt most when squeezed: Q4_K_M "uses Q6_K for half of the attention.wv and feed_forward.w2 tensors, else Q4_K", in the words of the [k-quants pull request](https://github.com/ggml-org/llama.cpp/pull/1684) that introduced them, so a Q4_K_M file is never a pure 4-bit file. The small models sit at the top of each range because their token embeddings are a bigger share of the total and those are kept at higher precision too.

Three things the table hides:

- **gpt-oss 20B barely changes with quant.** Its Q2_K file is 10.68 GiB and its Q8_0 is 11.28 GiB. OpenAI's [model card](https://huggingface.co/openai/gpt-oss-20b) says the models "were post-trained with MXFP4 quantization of the MoE weights" (a 4-bit format) so that the 20B runs "within 16GB of memory", and the GGUF conversions keep the experts that way, so the "quant" only touches the small non-expert part. If you see a 20B model that needs 11 GiB whatever you pick, that is why.
- **Mixture-of-experts models are priced by total parameters, not active ones.** Qwen3 30B-A3B has "30.5B in total and 3.3B activated" per its [model card](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507), so it generates like a small model, but all 30B have to sit in memory: 17.3 GiB at Q4_K_M. Speed like a 3B, VRAM like a 30B.
- **Ternary models are the exception to everything.** Ternary Bonsai 2 9B stores 2.3 bits per weight (2.38 GiB for a 9B model) and ran at 58 tok/s on our card, close to Qwen3.5 9B at Q4_K_M. Different model family and training, so it is not a free lunch, but worth knowing about if you are stuck on 4 GB.

## KV cache: why context length is the second number you need

Every token you keep in the context stores a key and a value in each attention layer. The size per token:

```
2 (K and V) × layers with a cache × KV heads × head size × bytes per value
```

With the default f16 cache that is 2 bytes per value. Two models with the same parameter count can differ by 4× here, because of how they lay out attention:

| Model | Attention layout (from config.json) | Per token | At 8,192 tokens | At 32,768 tokens |
| --- | --- | --- | --- | --- |
| Llama 3.1 8B | 32 layers × 8 KV heads × 128 | 128 KiB | 1.00 GiB | 4.00 GiB |
| Qwen3 14B | 40 × 8 × 128 | 160 KiB | 1.25 GiB | 5.00 GiB |
| Qwen3.5 9B | 8 full-attention layers × 4 × 256 (the rest keep a fixed state) | 32 KiB | 0.25 GiB | 1.00 GiB |
| Gemma 4 12B | 8 global layers + 40 sliding-window layers (1,024 tokens) | 16 KiB global + a capped 320 MiB window | 0.44 GiB | 0.81 GiB |
| Llama 3.3 70B | 80 × 8 × 128 | 320 KiB | 2.50 GiB | 10.00 GiB |

This is why Qwen3.5 9B is such a good fit for small cards: on our 8 GB card the driver showed only 148 MiB more in use with 4,096 tokens of context than with none, where Llama 3.1 8B showed 532 MiB more. Both measurements line up with the formula (128 MiB and 512 MiB plus a little). Gemma's sliding-window layers only cache their last 1,024 tokens, so the cost nearly stops growing after that. If you want long documents on a small card, pick a model whose attention is cheap, which the [checker](/tools/will-it-run/) shows you line by line.

### Cut the cache in half

llama.cpp can store the cache at 8 bits instead of 16 with `-ctk q8_0 -ctv q8_0` (the [server README](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md) lists f16 as the default and q8_0, q4_0 and others as options), which halves the KV line in the tables (Llama 3.1 8B at 32k goes from 4.0 GiB to 2.1 GiB). Quantising V needs flash attention, and `-fa` defaults to `auto`, so it is on when the card supports it. I have not measured the quality cost of a q8_0 cache on our setup, so treat it as the lever to pull when you are 1 to 2 GiB short, and test your own prompts. q4_0 cache exists too and I would not use it for anything that matters.

## What quantization costs in speed, measured

Generation speed on a GPU is mostly a memory-bandwidth problem: for every token, the card reads the whole model once. So a smaller file is a faster file, roughly in proportion. From our 8 GB runs, file size × tokens per second gives the effective bandwidth, and the card lands at 230 to 320 GB/s for the 4B to 8B models against the RX 5700 XT's 448 GB/s (8 GB of GDDR6 on a 256-bit bus at 14 Gbps, per the [RX 5000 series spec table](https://en.wikipedia.org/wiki/Radeon_RX_5000_series)):

| Model, quant | File | tok/s (0 ctx) | Effective GB/s |
| --- | --- | --- | --- |
| Qwen3.5 4B, Q4_K_M | 2.74 GB | 85.2 | 233 |
| Mistral 7B, Q4_K_M | 4.37 GB | 67.8 | 296 |
| Llama 3.1 8B, Q4_K_M | 4.92 GB | 63.5 | 312 |
| Qwen3.5 9B, Q4_K_M | 5.68 GB | 53.4 | 303 |
| Qwen3 14B, Q3_K_S | 6.66 GB | 31.0 | 206 |

Two readings. First, the bigger the model, the closer it runs to the bandwidth limit, until the 14B, which drops off because Q3_K_S is a slower format to decode on this card (the quant ladder below shows the same thing for Q3_K_M). Second, you can predict the speed of a quant you haven't run: Llama 3.1 8B at Q8_0 would be a 7.95 GiB file, so expect 35 to 40 tok/s if it fit, which on 8 GB it doesn't.

### The same model at four quants, measured

To see what a quant step actually costs on one card, I ran Qwen3.5 9B at every quant that fits 8 GB, same build, same settings as the [benchmark page](/local-llm-benchmarks/) (llama.cpp b12445, Vulkan, `-ngl 99`, flash attention on, 512-token prompt, 128 generated, three runs). Generation speed is with 0 and 4,096 tokens already in the context; the VRAM peak is the driver's highest reading at 4,096.

| Quant | File | Bits per weight | Generation tok/s (0 / 4,096 ctx) | Prompt tok/s (0 ctx) | VRAM peak |
| --- | --- | --- | --- | --- | --- |
| Q3_K_M | 4.35 GiB | 4.18 | 50.6 / 50.3 | 513 | 4,778 MiB |
| Q4_K_M | 5.29 GiB | 5.08 | 53.4 / 51.9 | 555 | 5,610 MiB |
| Q5_K_M | 6.13 GiB | 5.88 | 47.4 / 47.1 | 476 | 6,344 MiB |
| Q6_K | 6.95 GiB | 6.67 | 43.7 / 42.8 | 505 | 7,056 MiB |
| Q8_0 | 8.87 GiB | 8.52 | does not fit 8 GB | | |

Three things I took from it:

- **Q4_K_M to Q6_K costs about 18% of generation speed** (51.9 to 42.8 tok/s at 4k) for 31% more bytes. That is the bandwidth rule holding, roughly.
- **Q3_K_M is smaller and slower than Q4_K_M** on this card (50.3 vs 51.9 tok/s). The 3-bit format costs more to unpack than it saves in reads, so on 8 GB the only reason to drop to Q3 is that Q4 doesn't fit.
- **Q6_K ran on 8 GB.** The checker calls it a tight fit (the formula says 7.8 GiB) and it peaked at 7,056 MiB of 8,176 on our headless VM with nothing else on the card. On a desktop with a monitor attached I would not count on it.

Every row is in the CSV on the benchmark page.

## Worked examples by model size

All at Q4_K_M with 8,192 tokens of context, f16 cache, from the same formula. "Card" is the smallest common VRAM size where the total is under 90% of the card, which is where the checker says "fits" rather than "tight".

| Model | Weights | KV cache | Buffers | Total | Card |
| --- | --- | --- | --- | --- | --- |
| Qwen3.5 4B | 2.55 GiB | 0.25 GiB | 0.72 GiB | 3.5 GiB | 6 GB |
| Llama 3.1 8B | 4.58 | 1.00 | 0.49 | 6.1 GiB | 8 GB |
| Qwen3.5 9B | 5.29 | 0.25 | 0.72 | 6.3 GiB | 8 GB |
| Gemma 4 12B | 6.63 | 0.44 | 0.75 | 7.8 GiB | 12 GB (tight on 8) |
| Qwen3 14B | 8.38 | 1.25 | 0.54 | 10.2 GiB | 12 GB |
| Phi-4 14B | 8.28 | 1.56 | 0.44 | 10.3 GiB | 12 GB |
| gpt-oss 20B (MoE, MXFP4) | 10.83 | 0.19 | 0.63 | 11.7 GiB | 16 GB (tight on 12) |
| Mistral Small 3.2 24B | 13.35 | 1.25 | 0.50 | 15.1 GiB | 24 GB (tight on 16) |
| Qwen3.8 27B | 15.43 | 0.50 | 0.72 | 16.7 GiB | 24 GB |
| Qwen3 30B-A3B (MoE) | 17.28 | 0.75 | 0.54 | 18.6 GiB | 24 GB |
| Qwen3.6 35B-A3B (MoE) | 20.61 | 0.16 | 0.72 | 21.5 GiB | 24 GB |
| Llama 3.3 70B | 39.60 | 2.50 | 0.49 | 42.6 GiB | 48 GB (2 × 24) |

The 70B row is the one that surprises people. At Q4_K_M it does not fit a single consumer card. Your options, from the same formula: Q3_K_M needs 34.9 GiB (still no), Q2_K needs 27.6 GiB, which fits a 32 GB RTX 5090 with 8k of context and not much more. Two 24 GB cards (3090s, 4090s, 7900 XTXs) give 48 GB and run Q4_K_M at 8k of context; 16k pushes it to 45.1 GiB, over the 90% line, so quantise the cache for anything longer. A Mac with 64 GB of unified memory gets about 48 GiB for the GPU and does the same, slower. (`sudo sysctl iogpu.wired_limit_mb=<MB>` raises the Mac's GPU share until the next restart; a [llama.cpp discussion](https://github.com/ggml-org/llama.cpp/discussions/15372) has a 24 GB M3 Air owner going from the default 16,384 to 20,480 to load a model, with the warning that pushing it hung the laptop once.) I have not run a 70B on anything, so there are no speed numbers here. To measure.

## How the formula compares with the card

I built the formula to err high. Across the 18 November runs on our [benchmark page](/local-llm-benchmarks/) it came out between 160 and 730 MiB above what the driver reported as the peak in use. The gap is biggest for Qwen3.5 (about 700 MiB) and smallest for Gemma 3 4B and LFM3 (160 to 250 MiB). The reason is the token embedding table: on a graphics card llama.cpp keeps it in system RAM, and models with a 248,000-word vocabulary and separate input and output embeddings have a big one. I count it anyway because the extra margin is what keeps "fits" honest when your desktop and browser are also sitting on the card.

Two more things that change the answer:

- **Your display.** A monitor on the card, a browser with hardware acceleration, a game in the background, all of it takes VRAM before llama.cpp gets any. Our VM has no display attached, so its idle reading is 11 MiB. A desktop with two monitors can idle at 500 MiB to 1 GiB. If the checker says "tight", that is the difference.
- **Batch size.** llama.cpp's default physical batch (`-ub`) is 512. Raising it for faster prompt processing raises the output buffer in proportion. The formula assumes the default.

## When it doesn't fit

llama.cpp will still run the model: it keeps as many layers on the GPU as fit (`-ngl N`) and runs the rest on the CPU from system RAM. It works, and it is slow in proportion to what spilled, because system RAM bandwidth is a fraction of VRAM bandwidth. The better fix is usually one step down in quant (Q4_K_M to Q3_K_M saves about 0.1 GiB per billion parameters) or a shorter context, and the checker suggests both for any miss. Partial offload speeds on our card: to measure.

## Next guides

- [Which local LLMs fit 8, 12, 16 and 24 GB of VRAM](/local-llms-that-fit-8-12-16-24-gb-vram/): the same maths applied to every card size, with the measured speeds.
- [Will it run?](/tools/will-it-run/): pick your card, model, quant and context and see the sum line by line.
- [Local LLM benchmarks](/local-llm-benchmarks/): every run on our 8 GB card, with the CSV.
- [Self-hosting LLMs in 2026: privacy, hardware and cost](/self-hosting-llms-privacy-cost-efficiency-guide/)
- [How to build a private AI server at home](/build-privacy-first-local-ai-server-2026/)
- [Uncensored AI models: which fits your VRAM](/uncensored-ai-models/)

## Changes

- 27 Nov 2026: first version. File sizes and attention layouts from the Hugging Face Hub (fetched 18 Nov 2026); measured VRAM and speeds from our RX 5700 XT runs on 18 Nov and 27 Nov 2026 (llama.cpp b12445, Vulkan). A Qwen3.5 4B Q8_0 run failed its sha256 check twice and is not included.
