TOOL · GPU MEMORY

LLM GPU memory and KV cache calculator

Paste a Hugging Face config.json or start from a preset whose fields were read from one. The calculator multiplies those fields. It does not ask a GPU what fitted, and it does not publish a market price.

Calculator

Config read 3 Dec 2026. Qwen/Qwen2.5-7B-Instruct@a09a3545. Preset loaded from the published config. head_dim was absent, so head dimension is hidden size divided by attention heads.

Weights
14.185 GiB
KV cache per token
2 × 28 × 4 × 128 × 2 = 57,344 bytes (56 KiB)
KV cache for the batch
Type tokens and concurrent requests
Headroom
None added
Weights + KV + headroom
Waiting on tokens and concurrency

Arithmetic in the browser. Activations, scales and framework overhead are not in the sum. A 4-bit weight width is the 0.5-byte floor before scales.

What is the formula?

Weights are the checkpoint: parameter count times bytes per stored value. This page uses 2 bytes for bf16 or fp16, 1 byte for an 8-bit weight, and 0.5 bytes as the floor for 4-bit storage before scales and block metadata. The parameter count is not inside config.json. For the presets it is safetensors.total on the Hugging Face model record, read on 3 Dec 2026. One example is Qwen2.5-7B-Instruct: 7,615,616,512 parameters, so bf16 weights are that count times 2, which is 14.185 GiB. GiB on this page means bytes divided by 1024³, shown to three decimal places.

KV cache per token is 2 × layers × KV heads × head dimension × bytes per element. The 2 is keys and values. Qwen2.5-7B-Instruct’s config, commit a09a3545, has 28 layers, 4 KV heads and hidden size 3,584. It has no head_dim field. Head dimension is 3,584 / 28 attention heads = 128. At 2 bytes per element: 2 × 28 × 4 × 128 × 2 = 57,344 bytes, which is 56 KiB per token. That line was checked against the config on 3 Dec 2026.

The batch term multiplies that per-token figure by the tokens you keep and by concurrent requests. Headroom is a percent you type. Blank means none. Activations, CUDA graphs, and the scales on a quantised file are outside the sum. If a run dies while this total still fits, you are in that remainder.

KV cache per token for eight open models

Each row uses the config linked in the last column, read on 3 Dec 2026. Every one of these files omitted head_dim, so the head dimension is hidden size divided by attention heads, and that division was exact. torch_dtype was bfloat16, so the KV column uses 2 bytes per element. Llama and Gemma configs we requested the same day returned HTTP 401, so they are not in the table. Qwen2.5-72B-Instruct is the 70B-class file we could read, not a claim that 72 billion equals 70 billion.

Phi-3.5-mini-instruct is the useful counterexample. It has 32 KV heads, the same as its attention heads, so one token of bf16 cache is 384 KiB, larger than Qwen2.5-72B-Instruct at 320 KiB. A smaller parameter nickname is not a smaller cache.

KV per token in bf16. Arithmetic from config.json, read 3 Dec 2026. Not a benchmark and not a measured GPU allocation.
ModelLayersKV headsHead dimbf16 per tokenConfig
Qwen2.5-3B-Instruct36212836,864 bytes (36 KiB)config
Qwen2.5-7B-Instruct28412857,344 bytes (56 KiB)config
Qwen2.5-14B-Instruct488128196,608 bytes (192 KiB)config
Qwen2.5-32B-Instruct648128262,144 bytes (256 KiB)config
Qwen2.5-72B-Instruct808128327,680 bytes (320 KiB)config
Mistral-7B-Instruct-v0.3328128131,072 bytes (128 KiB)config
Phi-3.5-mini-instruct323296393,216 bytes (384 KiB)config
Phi-44010128204,800 bytes (200 KiB)config

Where do the parameter counts come from?

The weight term needs a parameter count the config does not carry. For each preset the count is safetensors.total on the model record, for example Qwen2.5-7B-Instruct, read 3 Dec 2026. The same field for the other seven presets is linked from the sources below via the config citation’s claim, and the calculator fills it when you pick the preset. If you paste a config, type the count yourself. A headline such as “7B” is not that integer.

Four of the rows are the size comparison on SLM vs LLM: Qwen2.5-3B-Instruct bf16 weights 5.748 GiB, 7B 14.185 GiB, 32B 61.027 GiB, 72B 135.426 GiB. The 4-bit floor is a quarter of the bf16 weight term, because 0.5 bytes is a quarter of 2, before scales. Price the GPUs on the inference cost calculator with rates you type.

Common GPU memory sizes from vendor pages

These sentences are what the linked NVIDIA pages said when we read them on 3 Dec 2026. They are capacity labels. They are not a recommendation, and they are not paired with a model row. The H100 page’s HTML did not show a separate 80 GB figure. It did describe one NVLink-bridge configuration as having 188GB of HBM3. That phrase is quoted, not converted into a card we did not see.

Vendor wording only, read 3 Dec 2026. Not a statement that a model fits.
PageWhat the page saidSource
NVIDIA A100The page names an A100 80GB and an A100 40GB, including product briefs for both PCIe parts.A100
NVIDIA H100A configuration with an NVLink bridge is described with 188GB HBM3 memory. This row is that phrase.H100
GeForce RTX 4090The page says the card comes with 24 GB of G6X memory.RTX 4090

What should you type for tokens?

Tokens in the formula are the tokens you actually keep for each request, times the number of requests the gateway will allow at once. The maximum context on a model card is a permission, not that product, unless you will let every request fill it. A long shared prefix still occupies cache on the first request. Later requests may reuse it. This sum does not model reuse. It sizes the ceiling you are willing to hold.

Bytes per KV element are the engine’s choice. A 4-bit weight file often still stores the cache in 16 bits. Quantising the weights and then forgetting the cache is how a spreadsheet says the model fits. FP8 cache uses 1 byte where bf16 uses 2, so that term halves if, and only if, the engine stores each element in one byte. Weights, scales and activations do not halve because the cache did.

Sources

  1. Qwen2.5-3B-Instruct config.json (Read 3 Dec 2026). 36 layers, 2 KV heads, head dimension 128 from hidden size 2048 divided by 16 attention heads. head_dim was absent. Parameter count 3,085,938,688 is safetensors.total on the model record, read the same day.
  2. Qwen2.5-7B-Instruct config.json (Read 3 Dec 2026). 28 layers, 4 KV heads, head dimension 128 from hidden size 3584 divided by 28 attention heads. head_dim was absent. Parameter count 7,615,616,512 is safetensors.total on the model record, read the same day.
  3. Qwen2.5-14B-Instruct config.json (Read 3 Dec 2026). 48 layers, 8 KV heads, head dimension 128 from hidden size 5120 divided by 40 attention heads. head_dim was absent. Parameter count 14,770,033,664 is safetensors.total on the model record, read the same day.
  4. Qwen2.5-32B-Instruct config.json (Read 3 Dec 2026). 64 layers, 8 KV heads, head dimension 128 from hidden size 5120 divided by 40 attention heads. head_dim was absent. Parameter count 32,763,876,352 is safetensors.total on the model record, read the same day.
  5. Qwen2.5-72B-Instruct config.json (Read 3 Dec 2026). 80 layers, 8 KV heads, head dimension 128 from hidden size 8192 divided by 64 attention heads. head_dim was absent. Parameter count 72,706,203,648 is safetensors.total on the model record, read the same day.
  6. Mistral-7B-Instruct-v0.3 config.json (Read 3 Dec 2026). 32 layers, 8 KV heads, head dimension 128 from hidden size 4096 divided by 32 attention heads. head_dim was absent. Parameter count 7,248,023,552 is safetensors.total on the model record, read the same day.
  7. Phi-3.5-mini-instruct config.json (Read 3 Dec 2026). 32 layers, 32 KV heads, head dimension 96 from hidden size 3072 divided by 32 attention heads. head_dim was absent. Parameter count 3,821,079,552 is safetensors.total on the model record, read the same day.
  8. Phi-4 config.json (Read 3 Dec 2026). 40 layers, 10 KV heads, head dimension 128 from hidden size 5120 divided by 40 attention heads. head_dim was absent. Parameter count 14,659,507,200 is safetensors.total on the model record, read the same day.
  9. NVIDIA A100 product page (Read 3 Dec 2026). The page names an A100 80GB and an A100 40GB. Those are vendor capacity labels, not a fit result for any model on this page.
  10. NVIDIA H100 product page (Read 3 Dec 2026). The HTML we read describes an NVLink-bridge configuration with 188GB of HBM3. It did not, in that HTML, state a separate 80 GB capacity.
  11. NVIDIA GeForce RTX 4090 product page (Read 3 Dec 2026). The page says the card comes with 24 GB of G6X memory.

Questions we hear first

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

There is no single card on this page. For Qwen2.5-7B-Instruct, bf16 weights are 14.185 GiB from 7,615,616,512 parameters times 2 bytes, plus 56 KiB of bf16 cache per token. Qwen2.5-72B-Instruct, the 70B-class config we could read, is 135.426 GiB of bf16 weights plus 320 KiB per token. Add the tokens and the concurrency you will allow, then your headroom. A 4-bit weight floor is smaller and still excludes scales. The cache does not shrink unless the engine stores it in fewer bytes.

What is the KV cache?

It is the key and value state kept for tokens the model has already read, so the next token does not recompute that state from scratch. For a decoder-only model the bytes per token are 2 times layers times KV heads times head dimension times bytes per element. The 2 is one key and one value.

Does FP8 KV cache halve memory?

It halves the cache term when each element is stored in 1 byte instead of 2, because the formula is linear in bytes per element. It does not halve weight memory, scales, activations or framework overhead. Set the KV byte field to 1 and leave the weight field wherever the file actually is.

Start with one task and a written scope.

Bring the workflow, the constraints and where inference should run. We use that brief to decide whether sovereign LLM & SLM fine-tuning, retrieval or a readiness review is the right first step.

Explore your AI options