Skip to content

Methodology & accuracy

How we estimate memory for local LLM inference, where the inputs come from, and how close the calculator gets to measured runs.

How close are the estimates?

Mean absolute error
0.28 GiB
Largest absolute error
1.07 GiB
Measured runs compared
16 / 16

Compared 16 of 16 historical runs across 4 hardware configurations. Each estimate uses the same indexed model and quant, 4096 tokens and batch 1, assuming an f16 KV cache and no vision encoder.

We subtract recorded memory from the calculator’s total, take the absolute value of each difference, then average them. This checks memory, not generation speed or model quality.

These runs cover a few devices and older runtime versions, not every hardware and model combination. Use the estimate for planning, not as a guarantee: drivers, allocator behavior, other apps and offloading can change actual memory use.

See measured and estimated memory for each run

How the calculator estimates memory

Memory estimates use GiB (2³⁰ bytes), even where the calculator and benchmark table label them GB. Download sizes use decimal GB (10⁹ bytes).

Model weights

Weights = (total parameters × bits per weight ÷ 8 ÷ 2³⁰) × (1 + 2%)

We use the model’s effective bits per weight (BPW) for a listed quantization, or the generic level rate when there is no indexed variant. A known file size gives BPW = file bytes × 8 ÷ total parameters. Mixture-of-experts models count all weights that must be loaded, not just the experts active per token.

Key/value (KV) cache

KV for a layer group = 2 × layers × KV heads × head dimension × cached tokens × batch × bytes per value ÷ 2³⁰

The first 2 counts both keys and values. Batch is the number of concurrent sequences. Full-attention layers cache the entire context; sliding-window layers cache the smaller of the context and the window. We add the groups using each group’s head layout. Fixed recurrent state in linear-attention layers is not counted here.

Bytes per value: f16 = 2 (default), q8_0 = 1.0625, q4_0 = 0.5625.

Total and runtime buffer

Total = (weights + KV cache + optional vision encoder) × (1 + 10%)

The extra 10% approximates activation memory. If a separate vision encoder is included, its memory also gets that buffer. This is an inference estimate, not a prediction of training memory or a runtime’s exact allocation.

VRAM Calc

Where the data comes from

  • Model cards and configs on Hugging Face supply architecture and parameter counts. The index records published quantization files and sizes where verified; a model-specific BPW without a recorded file or a generic BPW is still an estimate, not measured memory.

    Quant Hub · Model data (JSON) · Example Hugging Face config
  • The hardware index records memory capacity and bandwidth where known. Hardware pages link to vendor specifications when those sources are recorded.

    All GPUs · Hardware data (JSON)
  • The benchmarks page lists our historical local runs with their recorded runtimes. First publication is an upper bound on the measurement date, not the exact date of the run.

    Benchmarks
llama.cpp cache block layouts