How much VRAM do you need to run an LLM?

We may earn commissions when you shop through the links below. Learn more

How model size, precision, quantization, context length and batch size drive GPU memory — with worked estimates.

  • By AIHostCompare
  • Published
  • Updated
  • 18 sources · Explainer
On this page12 sections

Summary

For inference, the memory you need is roughly the weights plus the KV cache plus runtime overhead. Weights take the parameter count times the bytes per parameter: about 2 GB per billion parameters at BF16, 1 GB at FP8 and roughly 0.5 GB at 4-bit. The KV cache grows with every token held in memory, across all concurrent requests, and at the long contexts agents need it rivals the weights. Serving frameworks do not hand the whole card to the model, so leave headroom before you pick a GPU. Without a GPU, the same arithmetic applies to system RAM, at lower speed.

  • Weights = parameters × bytes per parameter (2 at BF16, 1 at FP8, about 0.5 at 4-bit).
  • KV cache per token = 2 × layers × KV heads × head size × bytes; multiply by tokens held at once.
  • Estimates differ mostly in the context length they assume; check it before comparing two numbers.
  • Mixture-of-experts models must load every expert, even though few are active per token.
  • Full fine-tuning with Adam needs about 16 bytes per parameter before activations; adapters need far less.

1. The three parts of GPU memory

Serving a language model uses GPU memory for three things: the weights, the KV cache that holds the attention keys and values of every token in flight, and working memory for activations, the CUDA context and the serving framework itself.

Inference memory

VRAM needed ≈ weights + KV cache + runtime overhead

The first two follow from the model card and your settings. The third depends on the runtime, and it is why a card is never fully available to the model. vLLM, for example, lets the model executor use a fixed fraction of GPU memory, set by --gpu-memory-utilization, which defaults to 0.92 in the current documentation , and by default it captures CUDA graphs, which “take up extra memory in the GPU” .

2. Weights: parameters × precision

Weights need one value per parameter. Multiply the parameter count by the bytes per value: a billion parameters at BF16 take about 2 GB.

Memory per billion parameters by precision

Memory per billion parameters by precision
PrecisionBytes per parameterGB per billion parameters
FP3244.0
BF16 / FP1622.0
FP8 / INT811.0
4-bit (INT4, NF4, MXFP4)0.50.5

Qwen3-8B has 8.2 billion parameters , so its weights take about 16.4 GB at BF16, 8.2 GB at FP8 and roughly 4.1 GB at 4-bit. Quantised formats store scales next to the values, so real 4-bit files are slightly larger than half a byte per parameter.

Mixture-of-experts models load every expert

A mixture-of-experts model uses only some parameters per token, but all of them must be in memory. Qwen3-30B-A3B has 30.5 billion parameters in total and 3.3 billion activated : it computes like a small model but needs about 61.0 GB for BF16 weights. The format matters as much as the count: OpenAI’s gpt-oss-120b has 117 billion parameters, and because its expert weights ship in MXFP4 it runs on a single 80 GB GPU, while gpt-oss-20b runs within 16 GB .

Lower precision is not free

In vLLM’s words, quantised models “take less memory at the cost of lower precision” . Check the model provider’s evaluations at the precision you plan to run, or run your own on your prompts.

3. KV cache: context length × concurrent requests

For every token the model is working on, each layer keeps a key vector and a value vector per KV head. The PagedAttention paper gives the example of OPT-13B, where one token takes 800 KB: 2 (key and value) × 5,120 (hidden size) × 40 (layers) × 2 bytes .

KV cache per token

bytes per token = 2 × layers × KV heads × head size × bytes per value

Newer models use grouped-query attention, with fewer KV heads than query heads, which shrinks the cache. Qwen3-8B has 32 query heads but 8 KV heads . With the layer count and head size from each model’s configuration file, the cache at BF16 comes out as follows:

KV cache at BF16 by number of tokens held in memory

Scroll sideways for all columns.

KV cache at BF16 by number of tokens held in memory
ModelLayers × KV heads × head sizePer token8K tokens32K tokens128K tokens
Qwen3-8B 36 × 8 × 128147,456 bytes1.2 GB4.8 GB19.3 GB
Qwen3-30B-A3B 48 × 4 × 12898,304 bytes0.8 GB3.2 GB12.9 GB
Qwen2.5-72B-Instruct 80 × 8 × 128327,680 bytes2.7 GB10.7 GB42.9 GB
Qwen3-8B and Qwen3-30B-A3B support 32,768 tokens natively and 131,072 with YaRN scaling  ; Qwen2.5-72B-Instruct lists a full context of 131,072 tokens .

The token count that matters is everything held at once: context length × concurrent requests. Ten chats with 8K tokens each need the same cache as one chat with 80K tokens. That is why a model that “fits” in a quick test can run out of memory under load.

Two settings bring the cache down. vLLM notes that storing the KV cache in FP8 “can significantly reduce its memory footprint”, so more tokens fit in the same memory , and capping context length (max_model_len) and batch size (max_num_seqs) limits how much cache can be requested .

4. Worked estimates for three open models

Adding weights and a 32,768-token KV cache at BF16 gives the memory to plan for before runtime overhead:

Weights plus a 32,768-token BF16 KV cache, in GB

Weights plus a 32,768-token BF16 KV cache, in GB
ModelBF16 weightsFP8 weights4-bit weights
Qwen3-8B21.213.08.9
Qwen3-30B-A3B64.233.718.5
Qwen2.5-72B-Instruct156.183.447.1
Our calculation from the model cards and configuration files cited above. Runtime overhead comes on top.
  • Qwen3-8B needs about 21.2 GB at BF16: tight on a 24 GB card once overhead is added, comfortable on 48 GB, and about 13.0 GB with FP8 weights.
  • Qwen3-30B-A3B computes like a 3B model but needs about 64.2 GB at BF16, because every expert stays loaded.
  • Qwen2.5-72B-Instruct needs about 156.1 GB at BF16, more than two 80 GB GPUs leave for vLLM at its default setting (147.2 GB). With FP8 weights (83.4 GB) it fits on one 141 GB H200 or across two 80 GB GPUs. At 4-bit it fits a 48 GB card only with a shorter budget: about 39.0 GB with 8K tokens.

Why estimates for the same model differ

Memory calculators rarely disagree about the weights. They disagree about the context they assume, whether they count the KV cache at all, and how much of the card they treat as usable. The same model and precision give very different answers:

Qwen3-8B at BF16 under four common assumptions, in GB

Qwen3-8B at BF16 under four common assumptions, in GB
AssumptionEstimate
Weights plus a flat 20% margin19.7
Weights plus a 32,768-token KV cache21.2
The same, divided by a usable share of 0.9223.1
Weights plus a 131,072-token KV cache35.7
Our calculation. The usable share is vLLM’s default of 0.92; other runtimes reserve memory differently.

Before you compare two estimates, check the context length and the number of concurrent requests behind each. To run the arithmetic for your own model, precision and context, use the VRAM / model fit tool.

5. Long contexts: sizing for a 64K-token agent

Agents need long contexts, and the KV cache grows with every token. Hermes Agent, for example, requires a model with at least 64,000 tokens of context and asks you to set a local model to 64K, for instance --ctx-size 65536 in llama.cpp . Ollama uses a context window of 4,096 tokens unless you raise it with OLLAMA_CONTEXT_LENGTH or num_ctx , so the default is far below what such an agent needs.

At 65,536 tokens, Qwen3-8B needs about 26.1 GB with BF16 weights and cache, more than a 24 GB card holds. With FP8 weights and an FP8 KV cache it comes to about 13.0 GB. The model supports 32,768 tokens natively, so a 64K window also means enabling YaRN scaling as its model card describes .

Concurrency multiplies the cache again: in Ollama, the memory a model needs scales with the number of parallel requests times the context length . Size for the number of conversations the agent runs at once, not for one.

6. When one GPU is not enough

vLLM’s own guidance for choosing a layout is short:

  • If the model fits on a single GPU, run it on that GPU; distributed inference is probably unnecessary.
  • If it is too large for one GPU but fits on one node with several GPUs, use tensor parallelism.
  • If it is too large for one node, combine tensor parallelism with pipeline parallelism .

Tensor parallelism splits the model across GPUs (tensor_parallel_size) , and those GPUs then exchange data on every layer. That is where the interconnect in the GPU cloud checklist matters: GPUs linked by NVLink handle it far better than cards that only talk over PCIe.

Before adding GPUs, try the cheaper levers: quantise the weights, store the KV cache in FP8, and cap the context length and concurrency to what your application needs.

7. Fine-tuning needs a different budget

Training keeps far more than the weights. The ZeRO paper breaks down mixed-precision training with the Adam optimiser: 2 bytes per parameter for FP16 weights, 2 for gradients and 12 for the FP32 copy of the weights, momentum and variance, 16 bytes in total. A 1.5-billion-parameter GPT-2 therefore needs at least 24 GB, against 3 GB for its FP16 weights alone . By the same arithmetic, fully fine-tuning Qwen3-8B needs about 131.2 GB for model states before any activations, which means several GPUs and a sharded optimiser.

Adapters change the budget

Low-rank adapters train a small number of extra weights instead. Compared with GPT-3 175B fine-tuned with Adam, the LoRA authors report 10,000 times fewer trainable parameters and a 3 times smaller GPU memory requirement . QLoRA combines a 4-bit base model with adapters and made it possible to fine-tune a 65B model on a single 48 GB GPU .

8. Match the estimate to a GPU

With an estimate in hand, pick the smallest memory tier that leaves headroom for overhead and traffic peaks. The table lists every GPU in our catalog that has a verified price today:

GPUs with a verified price, by memory

Scroll sideways for all columns.

GPUs with a verified price, by memory
GPUMemoryBandwidthProvidersLowest on-demand, per hrLowest serverless, per hr
T416 GB GDDR60.32 TB/s1Not listed$0.59≈ €0.527 (estimated conversion from $0.59)
V10016 GB HBM20.90 TB/s2$0.79≈ €0.706 (estimated conversion from $0.79)Not listed
A1024 GB GDDR60.60 TB/s3$0.867≈ €0.774 (estimated conversion from $0.867)$1.03≈ €0.917 (estimated conversion from $1.03)
L424 GB GDDR60.30 TB/s3$0.855≈ €0.764 (estimated conversion from $0.855)$0.80≈ €0.715 (estimated conversion from $0.80)
A10040 GB HBM21.55 TB/s2$1.99≈ €1.78 (estimated conversion from $1.99)$2.10≈ €1.88 (estimated conversion from $2.10)
L4048 GB GDDR60.86 TB/s1$1.00≈ €0.893 (estimated conversion from $1.00)Not listed
L40S48 GB GDDR60.86 TB/s5$1.55≈ €1.38 (estimated conversion from $1.55)$1.77≈ €1.58 (estimated conversion from $1.77)
RTX 6000 Ada Generation48 GB GDDR60.96 TB/s1$1.57≈ €1.40 (estimated conversion from $1.57)Not listed
RTX A600048 GB GDDR60.77 TB/s2$0.50≈ €0.447 (estimated conversion from $0.50)Not listed
A100 PCIe80 GB HBM2e1.94 TB/s1$1.35≈ €1.21 (estimated conversion from $1.35)Not listed
A100 SXM480 GB HBM2e2.04 TB/s3$1.60≈ €1.43 (estimated conversion from $1.60)$2.50≈ €2.23 (estimated conversion from $2.50)
H100 PCIe80 GB HBM2e2.00 TB/s4$2.50≈ €2.23 (estimated conversion from $2.50)$3.53≈ €3.16 (estimated conversion from $3.53)
H100 SXM80 GB HBM33.35 TB/s7$3.20≈ €2.86 (estimated conversion from $3.20)$3.95≈ €3.53 (estimated conversion from $3.95)
GH200 Grace Hopper Superchip (96GB HBM3)96 GB HBM34.00 TB/s1$2.29≈ €2.05 (estimated conversion from $2.29)Not listed
RTX PRO 6000 Blackwell96 GB GDDR7Not verified1Not listed$3.03≈ €2.71 (estimated conversion from $3.03)
RTX PRO 6000 Blackwell Max-Q Workstation Edition96 GB GDDR71.79 TB/s1$2.74≈ €2.45 (estimated conversion from $2.74)Not listed
H200 SXM141 GB HBM3e4.80 TB/s5$3.99≈ €3.56 (estimated conversion from $3.99)$4.54≈ €4.06 (estimated conversion from $4.54)
B200 SXM180 GB HBM3e7.70 TB/s5$6.00≈ €5.36 (estimated conversion from $6.00)$6.25≈ €5.58 (estimated conversion from $6.25)
Instinct MI300X192 GB HBM35.30 TB/s1$2.59≈ €2.31 (estimated conversion from $2.59)Not listed
Memory and bandwidth from the GPU catalog (vendor datasheets); prices per GPU-hour from provider records. A multi-GPU node's price is divided by its number of GPUs, so the lowest price can belong to a node that is rented whole.“Not listed” means no provider in our dataset offers the GPU with that pricing type.Oldest price in this table:Observed · StalePrices in USD, excluding VAT. ≈ marks a price the provider lists in EUR, converted at the ECB rate of 25 Sep 2026.≈ Estimated conversion from the listed USD price at the ECB reference rate of 23 Oct 2026 (1 EUR = 1.1193 USD). Billing currency not verified: providers may bill in USD, and your bank's rate and fees differ. Prices exclude VAT. EUR list prices are shown as the provider lists them (the dataset converts them to USD at the ECB rate of 25 Sep 2026).

Providers for each tier are listed in the inference hosting and GPU cloud comparisons. By memory tier: RTX 4090 cloud (24 GB), L40S hosting (48 GB) and H100 hosting (80 GB).

9. Running a model without a GPU

A model can also run from ordinary system memory. llama.cpp runs on x86 CPUs with AVX, AVX2, AVX512 and AMX, and its CPU+GPU hybrid mode exists to “partially accelerate models larger than the total VRAM capacity” . Ollama shows where a loaded model lives: ollama ps reports 100% GPU, 100% CPU (system memory) or a split between the two .

The arithmetic does not change: weights plus KV cache must fit, now in RAM, next to the operating system and everything else on the server. On a 16 GB machine, Qwen3-8B at 4-bit with a 32,768-token cache needs about 8.9 GB and fits, while Qwen3-30B-A3B at 4-bit needs about 15.3 GB for its weights alone and does not leave enough room.

Expect CPU-only generation to be slower than on a GPU; that gap is what the hybrid mode above partially closes. It suits small models, light traffic and background agents; test your model at the context length you need before you pick a plan. CPU servers are compared under AI VPS, and providers with Ollama templates or guides under Ollama hosting.

Next steps

Sources

Factual statements about providers, models, software and law link to these sources: primary sources first (official pricing pages, documentation, model cards and legal texts), third-party sources only where necessary and clearly labelled. Prices and specifications in the tables come from the AIHostCompare dataset; each provider's own sources and verification times are listed on its provider page, and the methodology explains how we verify data. Recommendations and rules of thumb are our editorial judgment.

  1. Engine arguments: --gpu-memory-utilization, --kv-cache-dtype (opens in a new tab)

    vLLM project · Official documentation · docs.vllm.ai · accessed

    ↩
  2. Conserving memory (opens in a new tab)

    vLLM project · Official documentation · docs.vllm.ai · accessed

    ↩
  3. Qwen3-8B model card (opens in a new tab)

    Qwen team (Alibaba Cloud) · Model card · huggingface.co · accessed

    ↩
  4. Qwen3-30B-A3B model card (opens in a new tab)

    Qwen team (Alibaba Cloud) · Model card · huggingface.co · accessed

    ↩
  5. gpt-oss-120b model card (opens in a new tab)

    OpenAI · Model card · huggingface.co · accessed

    ↩
  6. ↩
  7. Qwen3-8B config.json (opens in a new tab)

    Qwen team (Alibaba Cloud) · Model card · huggingface.co · accessed

    ↩
  8. Qwen3-30B-A3B config.json (opens in a new tab)

    Qwen team (Alibaba Cloud) · Model card · huggingface.co · accessed

    ↩
  9. Qwen2.5-72B-Instruct config.json (opens in a new tab)

    Qwen team (Alibaba Cloud) · Model card · huggingface.co · accessed

    ↩
  10. Qwen2.5-72B-Instruct model card (opens in a new tab)

    Qwen team (Alibaba Cloud) · Model card · huggingface.co · accessed

    ↩
Show all 18 sources
  1. Quantized KV cache (opens in a new tab)

    vLLM project · Official documentation · docs.vllm.ai · accessed

    ↩
  2. Hermes Agent quickstart: minimum context of 64K tokens (opens in a new tab)

    Nous Research · Official documentation · hermes-agent.nousresearch.com · accessed

    ↩
  3. FAQ: context window, CPU and GPU loading, concurrency and K/V cache quantisation (opens in a new tab)

    Ollama · Official documentation · docs.ollama.com · accessed

    ↩
  4. Parallelism and scaling (opens in a new tab)

    vLLM project · Official documentation · docs.vllm.ai · accessed

    ↩
  5. ↩
  6. ↩
  7. ↩
  8. llama.cpp: supported hardware and CPU+GPU hybrid inference (opens in a new tab)

    ggml-org (llama.cpp project) · Official documentation · github.com · accessed

    ↩