Skip to content
AI Dev Toolkit.
Esc
  • Loading…

Guide · Local AI

How much VRAM do you need to run an LLM locally?

Add up three things: the weights (about 0.57 GB per billion parameters at the popular Q4_K_M quantisation), the KV cache that holds your context, and runtime overhead (we allow 10%, at least 1 GB). With an 8K context that comes to about 6.6 GB for an 8B model, 11 GB for 14B, 23 GB for 32B and 47 GB for 70B.

By Tahir NazirUpdated 15 min read

On this page
  1. How do you calculate the VRAM an LLM needs?
  2. How much VRAM does an 8B, 14B, 32B or 70B model need?
  3. Which quantisation should you use?
  4. How much VRAM does context length add?
  5. What fits on an 8, 12, 16, 24, 48 or 80 GB GPU?
  6. How much system RAM do you need to run an LLM locally?
  7. What if the model doesn’t fit on one GPU?
  8. Does a Mac’s unified memory count as VRAM?
  9. Worked examples: RTX 4060, RTX 4090 and two RTX 3090s
  10. Questions people ask

How do you calculate the VRAM an LLM needs?

Add three numbers: the model’s weights, the KV cache for your context, and working space for the runtime. Our VRAM calculator uses this formula, and so does every figure here. It applies to any open-weights model you download, whatever runs it.

  • Weights = parameters × bits per weight ÷ 8. Quantised files also store scales, so llama.cpp measures 4.89 bits per weight for Q4_K_M and 8.5 for Q8_0.
  • KV cache = the keys and values every attention layer stores for each token in the context. It grows with context length and with parallel requests.
  • Overhead = the GPU runtime, compute buffers and fragmentation. We assume 10% of the weights and cache combined, at least 1 GB. That’s an assumption; the real figure varies by runtime.

For example, Llama 3.1 8B at Q4_K_M with a 32K context needs 4.6 GB of weights, 4.0 GB of KV cache and 1.0 GB of overhead: 9.6 GB in total.

The weights are easy to check, because they’re the file you download. Our estimates land within 1.4% of Qwen’s official GGUF files:

Estimated weights vs the real file size
FileEstimateActual file
Qwen3-8B-Q4_K_M.gguf4.66 GB4.68 GB
Qwen3-14B-Q4_K_M.gguf8.41 GB8.38 GB
Qwen3-32B-Q4_K_M.gguf18.65 GB18.40 GB
Qwen3-32B-Q8_0.gguf32.42 GB32.43 GB

File sizes from the Hugging Face API for the Qwen/Qwen3-8B, 14B and 32B GGUF repositories, checked 2026-10-08. GB here means 1,024³ bytes, the way GPU memory is quoted.

Running a model is not the same as fine-tuning it

Everything here is for inference: loading a model and generating text. Training needs far more memory, because it also keeps gradients and optimiser state for the weights it changes. Methods like LoRA train small adapter matrices instead of the whole model, and QLoRA goes further by keeping the frozen base model in 4 bits: its authors fine-tuned a 65B model on a single 48 GB GPU. Treat fine-tuning memory as a separate question from the tables below.

How much VRAM does an 8B, 14B, 32B or 70B model need?

Popular models at the three precisions people download, with a short and a long context. Each name links to that model’s full table, and the model directory lists the rest.

Total memory needed: weights + FP16 KV cache + overhead, one request at a time
ModelQ4_K_M, 8KQ4_K_M, 32KQ8_0, 8KQ8_0, 32KFP16, 8KFP16, 32K
Llama 3.1 8B6.6 GB9.6 GB9.9 GB13 GB18 GB21 GB
Qwen3 14B11 GB15 GB17 GB22 GB32 GB36 GB
Gemma 3 27B18 GB20 GB31 GB33 GB57 GB59 GB
Qwen3 30B-A3B20 GB22 GB34 GB37 GB63 GB66 GB
Qwen3 32B23 GB29 GB38 GB44 GB69 GB76 GB
Llama 3.3 70B47 GB55 GB80 GB88 GB147 GB156 GB

Computed with our VRAM calculator’s formula from each model’s official config.json (fetched 2026-10-08).

Three patterns stand out. Precision matters most: Qwen3 32B needs about 3.1 times as much memory at FP16 as at Q4_K_M. Context is not free: going from 8K to 32K adds 6.6 GB to Qwen3 32B but only 2.1 GB to Gemma 3 27B, because 52 of Gemma’s 62 layers only look at the last 1,024 tokens. And mixture-of-experts models save compute, not memory: Qwen3 30B-A3B runs 8 of its 128 experts per token, but loads them all.

Which quantisation should you use?

Use Q4_K_M unless you have memory to spare; then step up to Q5_K_M, Q6_K or Q8_0. These are quantization levels of the GGUF file format, and storing each weight in fewer bits is the biggest lever you have: Qwen3 14B with a 32K context needs 36 GB at FP16 and 15 GB at Q4_K_M.

Smaller formats shrink only the weights. The KV cache for 32K tokens is the same size at every quantisation, so at Q4_K_M it is over a third of the total.

llama.cpp’s maintainers measure the cost by comparing a quantised model’s predictions with the full-precision model’s on the same text. For Llama 3 8B:

Quality loss on Llama 3 8B, measured by llama.cpp
FormatBits per weightPerplexity increaseSame top token as FP16
Q8_08.5+0.04%97.7%
Q6_K6.56+0.35%96.0%
Q4_K_M4.89+2.8%91.9%
Q2_K3.16+56.5%71.1%

From the llama.cpp perplexity README (Wikitext-2, CUDA backend, no importance matrix). Perplexity measures how well a model predicts the next token, lower is better. “Same top token” is how often both models rank the same next token first.

Two caveats from the same source. The loss depends on the model: at Q4_K_M, Llama 3 8B’s perplexity rose 2.8% but Llama 2 7B’s only 1.4%. And perplexity is a proxy, not a task score, so test your own prompts. Files made with an importance matrix (imatrix) lose a little less.

  • Q8_0: effectively the original model, at about half the FP16 size.
  • Q6_K, Q5_K_M: a small step down, worth it when a few GB are spare.
  • Q4_K_M: the usual default and best balance of size and quality.
  • Q3_K_M, Q2_K: a last resort. At Q2_K, Llama 3 8B changed its top token almost three times in ten.

How much VRAM does context length add?

Every token of context adds a fixed amount to the KV cache, so a long context can need more memory than the model itself. For standard attention, each token costs 2 (a key and a value) × layers × KV heads × head size × 2 bytes at FP16.

KV cache size at FP16, one conversation
ModelPer 1,000 tokens8K32K128K
Llama 3.1 8B125 MB1.0 GB4.0 GB16 GB
Qwen3 32B250 MB2.0 GB8.0 GBOver its native limit
Llama 3.3 70B313 MB2.5 GB10 GB40 GB
Gemma 3 27B78 MB1.0 GB2.9 GB10 GB
gpt-oss 20B23 MB0.2 GB0.8 GB3.0 GB

Per 1,000 tokens counts only the layers that keep the whole context. Gemma 3 and gpt-oss use sliding-window layers, which stop growing once their window is full. Qwen3 handles 32K natively and reaches 128K only with YaRN scaling.

At its full 128K context, Llama 3.1 8B’s cache is 16 GB, 3.5 times its Q4_K_M weights. So set the context you need, not the maximum: measure a typical prompt with the token counter (see what a token is) and add room for the reply. Context windows explained covers what happens when a conversation outgrows the window. Parallel requests multiply the cache: four 8K chats use as much as one 32K chat.

Quantise the KV cache

llama.cpp and Ollama can store the cache in 8 or 4 bits. An 8-bit (q8_0) cache takes 53% of the FP16 size and a 4-bit (q4_0) cache 28%. Ollama’s documentation says q8_0 “usually has no noticeable impact on the model’s quality”, while q4_0 has a loss “that may be more noticeable at higher context sizes”. Both need flash attention, which current versions turn on automatically where it’s supported.

8-bit KV cache with a 32K context
# llama.cpp
llama-server -hf Qwen/Qwen3-14B-GGUF:Q4_K_M -c 32768 -ctk q8_0 -ctv q8_0

# Ollama (set when starting the server; applies to every model)
OLLAMA_KV_CACHE_TYPE=q8_0 OLLAMA_CONTEXT_LENGTH=32768 ollama serve

What fits on an 8, 12, 16, 24, 48 or 80 GB GPU?

“Fits” means the estimate is no bigger than the card’s memory, so leave some room for your desktop and other apps.

Largest model that fits on one GPU
VRAMExample GPUsQ4_K_M, 8K contextQ4_K_M, 32K contextQ8_0, 8K context
8 GBRTX 4060Qwen3 8B (6.8 GB)Qwen2.5 7B (7.1 GB)Gemma 3 4B (5.5 GB)
12 GBRTX 3060, RTX 4070, RTX 5070Phi-4 14B (11 GB)Gemma 3 12B (10 GB)Qwen3 8B (10 GB)
16 GBRTX 4060 Ti 16GB, RTX 4080 Super, RTX 5060 Ti 16GBPhi-4 14B (11 GB)Qwen3 14B (15 GB)Mistral Nemo 12B (15 GB)
24 GBRTX 3090, RTX 4090, Radeon RX 7900 XTXQwen3 32B (23 GB)Gemma 4 31B (23 GB)Phi-4 14B (18 GB)
48 GBL40SLlama 3.3 70B (47 GB)Qwen3 32B (29 GB)Qwen3 32B (38 GB)
80 GBA100 80GB, H100 80GBLlama 4 Scout (70 GB)Llama 4 Scout (71 GB)Llama 3.3 70B (80 GB)

Same estimates as the VRAM calculator, FP16 KV cache, one request. Models whose maximum context is under 32K are left out of that column, and gpt-oss is covered below. GPU memory sizes from NVIDIA and AMD product pages.

The big steps are 8 to 12 GB, which takes you from 8B to 14B models, and 16 to 24 GB, which opens up the 27B to 32B class. A 70B model at Q4_K_M (47 GB) needs a 48 GB card or two 24 GB cards. At FP16 it needs 147 GB, more than an 80 GB card.

OpenAI’s gpt-oss is the exception to these quantisation levels. It is released in MXFP4, a 4-bit format, and its GGUF files are about the same size whichever label they carry, so go by the official files: 11.3 GB for gpt-oss 20B, about 13 GB in total with a 32K context, which fits a 16 GB card; and 59 GB for gpt-oss 120B, about 66 GB, which fits an 80 GB card.

Is 24 GB of VRAM enough?

For most local use, yes. A 24 GB card such as the RTX 3090 or 4090 runs 27B to 32B models at Q4_K_M: Qwen3 32B needs 22.7 GB with an 8K context, and Gemma 3 27B 20 GB even at 32K. Smaller models fit at Q8_0 or with much longer contexts. What 24 GB can’t hold is a 70B model at Q4_K_M (47 GB), which then runs partly from system RAM and much more slowly.

Fitting is not the same as running fast. Generating each token reads the active weights from memory, so speed depends mostly on the card’s memory bandwidth, and a model that only just fits leaves little room for context. Check speed reviews for your card as well as the memory figure.

How much system RAM do you need to run an LLM locally?

If the whole model fits in VRAM, not much beyond what your operating system and apps already use. llama.cpp memory-maps the model file by default, so the system reads the weights from disk as they are copied to the GPU instead of first loading the whole file into RAM. A typical 16 to 32 GB desktop is enough for any model that fits your card.

Offloading changes that. Layers you keep on the CPU live in system RAM, so you need at least their size free on top of everything else. For example, Llama 3.3 70B at Q4_K_M needs 47 GB, so on a 24 GB card about 23 GB of it ends up in system RAM. A 32 GB PC would be tight once Windows or Linux and your browser take their share; 64 GB is comfortable.

Parallel requests add up as well. Ollama’s FAQ says the memory it needs scales with the number of parallel requests times the context length, so four parallel chats at 8K reserve as much cache as one at 32K.

What if the model doesn’t fit on one GPU?

You can split it across several GPUs or keep part of it in system RAM. Splitting across GPUs keeps everything in fast VRAM, so it’s the better option when you can.

Several GPUs

llama.cpp uses every visible GPU by default. Its default split mode, layer, puts whole layers and their share of the KV cache on each card and runs them in turn, so for a single request two GPUs add memory rather than speed. --tensor-split 3,1 sets the proportions when the cards differ. Its row and experimental tensor modes, like vLLM’s tensor parallelism (--tensor-parallel-size 2), instead split each layer across GPUs so they work at the same time. Memory adds up: Llama 3.3 70B at Q4_K_M needs 2 × 24 GB cards, and each card keeps its own buffers, so leave a little extra headroom.

CPU offload

llama.cpp and Ollama can keep some layers in system RAM and run them on the CPU. In llama.cpp, -ngl (--n-gpu-layers) sets how many layers go to the GPU; its default, auto, picks what fits your VRAM. Ollama also decides for you, and ollama ps shows the split, for example “48%/52% CPU/GPU”. Every token passes through every layer, and system RAM is much slower than VRAM, so offloaded layers slow generation down. Try a smaller quantisation or a shorter context first.

Mixture-of-experts models offload better, because only a few experts run for each token. llama.cpp’s --n-cpu-moe N keeps the expert weights of the first N layers in system RAM and leaves attention on the GPU. That suits models like gpt-oss 120B, which runs 4 of its 128 experts per token but whose official file alone is 59 GB.

Does a Mac’s unified memory count as VRAM?

Mostly, yes. Apple Silicon has no separate graphics memory, so the GPU draws its VRAM from the same unified memory as the CPU. macOS caps how much the GPU may use by default: about two-thirds on Macs with up to 32 GB (21.3 GB of 32 GB) and three-quarters above (48 GB of 64 GB). That is why a 64 GB Mac can run a 70B model that no single 24 GB card can. How to run LLMs locally on a Mac shows what fits at each memory size and how to raise the cap.

Worked examples: RTX 4060, RTX 4090 and two RTX 3090s

“I have an RTX 4060 with 8 GB”

Run 7B to 8B models at Q4_K_M. Llama 3.1 8B needs 6.6 GB and Qwen3 8B 6.8 GB with an 8K context. At 32K, Llama 3.1 8B needs 9.6 GB, but an 8-bit KV cache brings it to 7.7 GB, which just fits. Gemma 3 12B at Q4_K_M (8.8 GB) is already over the limit, so 12B to 14B models need partial CPU offload or a 12 GB card.

“I have an RTX 4090 with 24 GB”

24 GB suits 24B to 32B models at Q4_K_M. Qwen3 32B needs 22.7 GB at 8K, a tight fit. At 32K it needs 29 GB, still 25 GB with an 8-bit cache, so 16K with an 8-bit cache (22.9 GB) is its practical limit. For long contexts, Gemma 3 27B (20 GB at 32K) and Qwen3 30B-A3B (22 GB) fit. A 70B model (47 GB) doesn’t.

“I have two RTX 3090s (48 GB in total)”

This is a common home setup for 70B models. Llama 3.3 70B at Q4_K_M needs 46.9 GB of the 48 GB with an 8K context, so there is little room to spare. A 16K window with an 8-bit cache needs 47.1 GB; for 32K, drop to Q3_K_M (42.0 GB with an 8-bit cache) and accept some quality loss. Or run Qwen3 32B at near-lossless Q8_0 (38 GB).

Free toolLLM VRAM calculatorPick a model, quantisation, context length and KV cache type to see the breakdown and which GPUs and Macs can run it.

To compare running locally with paying for a hosted API, use the LLM cost calculator.

FAQ

Questions people ask

How much VRAM do I need to run a 70B model?

About 47 GB for Llama 3.3 70B at Q4_K_M with an 8K context, 80 GB at Q8_0 and 147 GB at FP16. At Q4_K_M that means two 24 GB cards or one 48 GB card. A 32K context raises the Q4_K_M figure to 55 GB, so long contexts need an 8-bit KV cache or a smaller quantisation.

Can I run an LLM on 8 GB of VRAM?

Yes. 7B and 8B models at Q4_K_M fit with an 8K context: Llama 3.1 8B needs about 6.6 GB. For a 32K context, quantise the KV cache to 8-bit (about 7.7 GB in total). Models from 12B up need a smaller quantisation or partial CPU offload, which is slower.

Is Q4 good enough, or should I use Q8?

For most uses Q4_K_M is good enough, which is why it’s the usual default. In llama.cpp’s measurements on Llama 3 8B, Q4_K_M raised perplexity by 2.8% and Q8_0 by 0.04%. If Q8_0 fits with the context you need, use it; if it doesn’t, Q5_K_M or Q6_K are good middle steps.

Why does my model use more VRAM than its file size?

The file holds only the weights. At run time the runtime also allocates the KV cache for the whole context window up front, plus compute buffers. A long default context, or several parallel requests, can add gigabytes. Lower the context length or quantise the cache to bring it down.

How much system RAM do I need to run an LLM locally?

If the whole model fits in VRAM, a normal 16 to 32 GB desktop is enough, because llama.cpp memory-maps the file instead of copying it all into RAM first. If you offload layers to the CPU, those layers live in system RAM, so you need their size free on top of the operating system and your apps. Offloaded layers also run much more slowly.

Is 24 GB of VRAM enough for a local LLM?

For most people, yes. By our estimates 24 GB runs 27B to 32B models at Q4_K_M (Qwen3 32B needs 22.7 GB with an 8K context) and smaller models at higher quality or with long contexts. A 70B model needs about 47 GB at Q4_K_M, so on 24 GB part of it has to run from system RAM, which is much slower.

Which local LLM is best for 16 GB of VRAM?

With 16 GB you can run models up to about 14B at Q4_K_M with a 32K context (Qwen3 14B needs 15 GB), or gpt-oss 20B from its official file. The best choice depends on the task, whether coding, chat or reasoning, and changes with every new open-weights release, so filter by memory in the VRAM calculator and try two or three candidates on your own prompts.

Do mixture-of-experts models need less VRAM?

No. Every expert must be in memory, so Qwen3 30B-A3B needs about as much as a dense 30B model (20 GB at Q4_K_M with 8K). What they save is compute: only 8 of its 128 experts run for each token, so it generates text much faster than a dense model of the same size.

Try it

Tools from this guide

Glossary

Key terms in this guide

Keep reading

Keep exploring