KV Cache calculator

Isolate the key-value cache from weights. Context length and concurrent sequences scale KV, not the model replica.

Pick a model and settings to see memory demand.

Advanced settings

GiB (2^30 bytes)

Custom model structure

Parsed in the browser. The file is not uploaded.

Only huggingface.co, config.json, no token. Private repos are rejected.

Estimate

Unknown

Missing budget, incomplete data, or a deployment mode this version cannot judge.

Estimated memory range: 4.92 GiB5.42 GiB

Weights use selected file metadata. Runtime extras are still estimated.

Weights4.36 GiB
KV cache (raw)0.44 GiB
KV extras (quant metadata / packing)0.00 GiB
Activation / workspace0.06 GiB
Engine reserve0.06 GiB
Safety margin0.00 GiB

Software compatibility

Documented support. Enough memory does not mean this engine, quant, and OS will run. Support does not mean it will be fast.

Assumptions that affect this result

  • Full-resident weight estimates use total parameters, including inactive MoE experts.
  • Weight bytes come from the selected weight files only, not from every file in the repository.
  • Download file size is not peak GPU memory. Runtime layout, allocator padding, and KV are extra.
  • Counted files: qwen2.5-7b-instruct-q4_k_m-00001-of-00002.gguf, qwen2.5-7b-instruct-q4_k_m-00002-of-00002.gguf.
  • Context budget is the number of cached tokens per sequence (prompt plus reserved generation).
  • Concurrent sequences share one model replica; weights are not multiplied by sequence count.
  • KV dtype is independent of weight quantization unless you change it.
  • Using 4 KV heads, not 28 query heads.
  • Prefill peak and steady decode occupancy are not the same. The high scenario is closer to prefill/workspace pressure.
  • Engine reserve is not the same as bytes the model actually uses for weights and KV.
  • llama.cpp compute buffers grow with context and batch. Values here are user-adjustable scenarios, not measured traces — unless a matching calibration is shown.

Calculation method

Try these changes