Inference Engineeringestimator

Quantisation memory planner

Quantisation stores a model’s weights in fewer bits. Going from 16-bit to 4-bit cuts the weight memory to roughly a quarter, which is often the difference between needing several GPUs and needing one.

Some formats fit

2 of 6 formats fit on one H100 SXM with 10% kept free: INT4, group 128, NF4 (QLoRA).

Fit on one H100 SXM2 of 6formats
Weights and KV cache by format
  • FP32301.5 GB5 GPUs
  • BF16 / FP16161.5 GB3 GPUs
  • FP891.5 GB2 GPUs
  • INT891.5 GB2 GPUs
  • INT4, group 12857.8 GBFits
  • NF4 (QLoRA)57.6 GBFits
  • Weights
  • KV cache

Model and hardware

70B parameters.

Prompt plus output, per sequence.

KV cache precision

80 GB each. GPUs needed counts tensor-parallel GPUs, up to 64.

Your allowance, per GPU. vLLM keeps 10% free by default.

Smaller groups are more accurate and cost more bits.

By format

Weights in BF16140 GB70B parameters × 2 bytes
Weights in NF4 (QLoRA)36.1 GB74% less than BF16
KV cache21.5 GB8 sequences × 8.2K tokens
Memory and GPUs needed by weight format
FormatBits per weightWeightsWith KV cacheWith 10% freeGPUs neededOne GPU
FP3232280 GB301.5 GB335 GB5Doesn’t fit
BF16 / FP1616140 GB161.5 GB179.4 GB3Doesn’t fit
FP8870 GB91.5 GB101.6 GB2Doesn’t fit
INT8870 GB91.5 GB101.6 GB2Doesn’t fit
INT4, group 1284.15636.4 GB57.8 GB64.3 GB1Fits
NF4 (QLoRA)4.12736.1 GB57.6 GB64 GB1Fits
Where the extra bits come from

Grouped formats store a scale per group, so they use more than their nominal bits. At 4 bits, group 128 with an FP16 scale and a 4-bit zero point adds 0.156 bits per weight; GPTQ reports about 0.15. Rows above: INT4, group 128: 4 bits plus an FP16 scale and a 4-bit zero point for every 128 weights (GPTQ, AWQ). NF4 (QLoRA): 4 bits plus 8-bit block constants (block 64) that are themselves quantised in blocks of 256 (QLoRA double quantisation).

What it shows

Quantisation stores a model’s weights in fewer bits. Going from 16-bit to 4-bit cuts weight memory to roughly a quarter. The saving is a little smaller, because grouped formats also store a scale for each group of weights.

Pick a model and a GPU. The tool shows each format’s weight memory, the total with the KV cache, the total with free memory reserved, and the GPUs needed.

How to read it

  • Bars show weights in dark and KV cache in colour for each format. The label says “Fits” or how many GPUs.
  • Bits per weight is the format’s width plus its overhead. For group size 128 with a 16-bit scale and a 4-bit zero point, that is 4 + 20 ÷ 128 = 4.156 bits.
  • Weights is parameters × bits ÷ 8. A mixture-of-experts model stores every expert, so all its parameters count.
  • “With KV cache” adds the cache for your context and batch. Weight quantisation does not shrink it.
  • “With free” divides the total by the share of memory the server may use. “GPUs needed” is the smallest tensor-parallel group that holds it.
  • INT8 and FP8 count as 8 bits. AWQ uses the GPTQ group layout, which is an assumption. Memory is not speed.

Questions

Why isn’t 4-bit exactly a quarter of 16-bit?

Each group of weights carries its own scale, and often a zero point. With group size 128, a 16-bit scale and a 4-bit zero point add 20 bits per 128 weights, about 0.16 bits per weight. Smaller groups improve accuracy but cost more: at group size 32 the overhead is 0.625 bits per weight.

What is the difference between GPTQ, AWQ and NF4?

GPTQ and AWQ are post-training methods that quantise the weights of a trained model, each choosing the rounding differently. NF4 is a 4-bit data type from QLoRA whose levels follow a normal distribution, with a constant stored per block of 64 weights. This tool counts their storage, not their accuracy.

What does double quantisation do?

QLoRA quantises the per-block constants themselves. The first-level constants go from 32 bits per 64 weights (0.5 bits per weight) to 8 bits each, plus a 32-bit constant for every 256 of those, about 0.127 bits per weight in total.

Does quantising the weights also shrink the KV cache?

No. The cache holds activations, not weights, and has its own precision. Many servers can store it in FP8 for half the memory. The effect on quality depends on the model, so evaluate it before relying on it.

Does a smaller format always make serving faster?

Not automatically. Decode speed improves when it is memory-bound and the kernels read the compact weights efficiently. Some formats need dequantisation on the fly, and some hardware has no native support for a format, so measure on your stack. The Token throughput estimator shows how weight bytes feed into step time.

Sources

Explore further

  • llama.cppRuns quantized models on laptops and servers, with GGUF formats from 2-bit to 8-bit.

Last updated

More tools

All tools

Your first senior-level
lesson is free.

Choose a course, open a free lesson, and explore an idea you’ve wanted to understand.