AI, LLM & Machine Learning Engineering Model Memory & GPU Sizing Weight-precision memory accounting

Model Quantisation Memory Savings Calculator

A model's weight memory is just parameters times bytes per parameter, so quantisation buys memory in exact proportion to the bits it removes: FP16 to INT4 is a factor of four, no more and no less. This calculator applies that arithmetic honestly — including the weights you keep at full precision and the storage overhead that scales and zero-points add — and returns the footprint before and after, the memory freed, the compression ratio, the effective bits per weight and whether the result fits in the GPU memory you have.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Parameter countTotal parameters in billions. A 70B model is 70; a 7B model is 7.70 B params
Source precisionThe precision the checkpoint is published in, before you quantise it.FP16 / BF16 — 16 bits
Target precisionThe precision you are quantising the weights to.INT4 — 4 bits
Share of weights quantisedMost schemes leave embeddings, normalisation and some sensitive layers at the source precision.95 %
Scale and zero-point overheadExtra bits per quantised weight for group scales and offsets: roughly (scale bits + zero bits) ÷ group size.0.5 bits/wt
Available GPU memoryMemory you can devote to weights, summed across GPUs. Leave room for the KV cache and activations.48 GB

It returns

  • Size at target precision — Weights only, counting the unquantised share and the scale overhead.
  • Size at source precision
  • Memory freed
  • Compression ratio
  • Effective bits per weight
  • GPU memory left after weights

The formula

S=Nb8109
beff=q(bt+c)+(1q)bs
r=bsbeff

In plain text: Size (GB) = parameters × bits per weight ÷ 8 ÷ 1,000,000,000

  • SWeight memory (GB)
  • NParameter count (parameters)
  • bEffective bits per weight, including scale overhead (bits)
  • 8Bits per byte (—)

Sizes here use decimal gigabytes (10⁹ bytes), which is how checkpoint sizes are normally quoted. A 70B model at 16 bits is 140 GB on that convention.

Updated Category Model Memory & GPU Sizing Verified against published test cases Reading time 12 min

What quantisation buys, exactly

Every parameter in a neural network occupies a fixed number of bits, so the weight memory is a product of two numbers and nothing else: parameters × bits ÷ 8 bytes. Quantisation reduces the second factor. Going from 16 bits to 4 divides the footprint by four, and going from 16 to 8 halves it. There is no compression algorithm involved and no data-dependent ratio to estimate — the saving is arithmetic.

That certainty is what makes quantisation the first tool to reach for when a model does not fit. A 70-billion-parameter model at BF16 needs 140 GB and requires at least two 80 GB accelerators. The same model at 4 bits needs about 35 GB and fits on one. The hardware bill roughly halves, and so does the fixed cost in any hosting comparison.

Two things complicate the clean division, and both are in this calculator because leaving them out is how estimates come in optimistic. Not every weight is quantised. Embedding tables, layer-norm parameters and the output projection are commonly left at higher precision because they are disproportionately sensitive, and they are a real share of a smaller model's parameters. Quantised weights need metadata. Integer formats store a scale, and often a zero-point, per group of weights, so the true cost is the nominal bit width plus the metadata amortised across the group.

Put the two together and a scheme described as "4-bit" typically lands somewhere above 4 effective bits per weight. The calculator reports that effective figure explicitly, because it is what actually determines whether the model fits.

What quantisation does not touch is the key-value cache, which scales with context length and batch size rather than with parameter count. On a long-context deployment it can rival the weights. Size it with the KV cache size calculator before concluding you have room.

The formula, and where the extra bits come from

The base relation is S = N × b ÷ 8, with N in parameters and S in bytes. With N in billions and S in decimal gigabytes it simplifies to S = N × b ÷ 8 directly: 70 billion parameters at 16 bits is 70 × 16 ÷ 8 = 140 GB.

The quantised share. If a fraction q of weights moves to the target precision and the rest stays at the source precision, the effective bit width is a weighted average. At 95% quantised to 4 bits with 5% left at 16, the unquantised remainder alone contributes 0.05 × 16 = 0.8 bits per weight — more than the metadata overhead in most schemes, and easily overlooked.

The scale overhead. Integer quantisation maps a group of real-valued weights onto integers using a scale and, in asymmetric schemes, a zero-point. Those are stored per group, not per weight, so the cost per weight is (scale bits + zero-point bits) ÷ group size. A 16-bit scale and a 16-bit zero-point over a group of 64 weights adds 32 ÷ 64 = 0.5 bits per weight. Over a group of 128 it adds 0.25. Smaller groups track the local distribution of weights more closely and cost more memory — that is the entire trade-off behind group size.

Combining them:

b_eff = q × (b_target + overhead) + (1 − q) × b_source

and the compression ratio is b_source ÷ b_eff, which is what you should quote rather than the nominal ratio of bit widths. In the default configuration — 95% of weights at 4 bits with a 0.5-bit overhead, 5% left at 16 — the effective width is 5.075 bits and the ratio is 16 ÷ 5.075 = 3.15×, not 4×.

To go the other way and work out the parameter count for an architecture you are designing, use the transformer parameter count calculator.

Worked example: a 70B model from BF16 to 4-bit

You have a 70-billion-parameter model published at BF16 and a single 48 GB GPU. The quantisation scheme you plan to use converts 95% of the weights to 4 bits, leaves embeddings and normalisation at 16, and uses a 16-bit scale and 16-bit zero-point over groups of 64, giving 32 ÷ 64 = 0.5 bits per weight of metadata.

  1. Size at source. 70 × 16 ÷ 8 = 140 GB. Far beyond a 48 GB card.
  2. Quantised portion. 0.95 × (4 + 0.5) = 0.95 × 4.5 = 4.275 bits per weight.
  3. Unquantised portion. 0.05 × 16 = 0.8 bits per weight.
  4. Effective bits. 4.275 + 0.8 = 5.075 bits per weight.
  5. Size at target. 70 × 5.075 ÷ 8 = 355.25 ÷ 8 = 44.40625 GB.
  6. Memory freed. 140 − 44.40625 = 95.59 GB.
  7. Compression ratio. 16 ÷ 5.075 = 3.153×, against the 4× the nominal bit width suggests.
  8. Headroom. 48 − 44.41 = 3.59 GB left on the card.

It fits — barely. And 3.59 GB is not enough headroom to serve anything useful: at the Llama-3-70B geometry the KV cache costs about 320 KiB per token, so 3.59 GB holds roughly 11,000 tokens in total across all concurrent sequences, before activations and framework overhead take their share. The honest conclusion is that this configuration loads on one 48 GB card and serves one short conversation.

Change the scheme to a group size of 128 (overhead 0.25 bits) and quantise 98% of weights: 0.98 × 4.25 + 0.02 × 16 = 4.165 + 0.32 = 4.485 bits, giving 70 × 4.485 ÷ 8 = 39.24 GB and 8.76 GB of headroom. Same nominal precision, 5 GB more room, purely from metadata and coverage decisions.

How to read the result

Effective bits per weight is the number that matters. It is the honest description of the scheme, it determines the footprint exactly, and it is comparable across formats in a way that a format name is not. When you see two schemes both described as 4-bit, compare their effective bit widths and you will usually find they differ.

Headroom decides whether the configuration is usable, not whether it loads. Fitting the weights is necessary and nowhere near sufficient. The KV cache, the activations of the forward pass, communication buffers and allocator fragmentation all come out of what is left. A configuration with 5% headroom loads and then fails under the first concurrent request.

Memory saved translates into hardware count, which is where the money is. The useful question is not "how many gigabytes did I free" but "did I cross a boundary" — from two GPUs to one, from an 80 GB card to a 48 GB one, from a rented cluster to a workstation. Savings that do not cross a boundary change nothing about the bill. Feed the result into the GPU hours cost calculator to price the difference.

Expect a speed gain as well as a memory gain. Token generation is bound by memory bandwidth, and each decode step reads the whole model, so halving the bytes read roughly doubles the ceiling on tokens per second. The throughput calculator quantifies it. Whether the full gain is realised depends on the kernels: dequantisation costs arithmetic, and a format without an efficient kernel for your hardware can be smaller without being faster.

The calculator says nothing about quality. Memory is exactly predictable from bit width; accuracy is not. The only reliable way to know what a quantisation costs you is to evaluate the quantised model on your own task, with your own prompts, against the unquantised baseline.

Weight memory by parameter count and precision

Each cell is parameters × bits ÷ 8, in decimal gigabytes, with every weight quantised and no scale overhead — the floor for each precision. Real schemes land above these figures.
ParametersFP32 (32 bits)FP16 (16 bits)INT8 (8 bits)INT4 (4 bits)
7B28 GB14 GB7 GB3.5 GB
13B52 GB26 GB13 GB6.5 GB
34B136 GB68 GB34 GB17 GB
70B280 GB140 GB70 GB35 GB
405B1,620 GB810 GB405 GB202.5 GB

Read across a row to see which precision crosses a hardware boundary. A 70B model needs two 80 GB accelerators at FP16, one at INT8, and fits a single 48 GB card at INT4 only if the scheme's effective width stays near 4 bits.

Group size is the dial behind the overhead

Quantisation error depends on how well one scale represents a group of weights, so smaller groups track the local distribution better and lose less accuracy. They also store more scales. With a 16-bit scale and a 16-bit zero-point, a group of 32 costs 1.0 extra bit per weight, a group of 64 costs 0.5, a group of 128 costs 0.25 and a group of 256 costs 0.125. On a nominally 4-bit format, moving from group 32 to group 128 cuts effective width from 5 bits to 4.25 — a 15% memory difference decided entirely by a configuration flag. Symmetric schemes that drop the zero-point halve these numbers again.

What this calculation does not tell you

  • Whether quality holds. Bit width predicts memory exactly and accuracy not at all. Evaluate on your own task; the degradation is model-specific and task-specific.
  • Whether the format has a fast kernel. A layout with no optimised kernel for your GPU may be smaller and slower, because dequantisation runs in the inner loop.
  • Whether training or fine-tuning still works. Quantised weights are for inference. Fine-tuning approaches that attach adapters to a quantised base keep the base frozen precisely because you cannot back-propagate into 4-bit integers directly.
  • The KV cache. It is a separate term that grows with context and batch, and it is quantised separately.
  • Activation memory. Intermediate tensors during the forward pass need room too, and they scale with batch size and hidden dimension.
  • Whether the checkpoint downloads at the target size. Some formats store both quantised weights and metadata in a container that also carries the original tensors. Check the file, not the label.

Where quantisation sits among the ways to make a model fit

When a model does not fit, four options are available and they are not equivalent.

Quantise. The saving is exact, the work is a one-off conversion, and the quality cost is real but usually modest down to 4 bits. It is the first thing to try, and often the only thing needed.

Add GPUs and shard. Tensor parallelism splits each layer across devices, so memory adds up and so does bandwidth, which helps speed as well. It costs linearly in hardware and adds a communication step per layer that shows up as reduced efficiency.

Use a smaller model. A well-chosen smaller model at higher precision is frequently better than a large model crushed to 2 bits, and it is cheaper on every axis. Compare candidates on your task rather than on parameter count.

Offload to host memory. Keeping some layers in CPU RAM lets an oversized model run at all, at a speed penalty severe enough that it suits batch work and not interactive serving, because host memory bandwidth is an order of magnitude below GPU memory bandwidth.

Whichever you choose, size the whole deployment rather than the weights alone. Weights plus KV cache plus activations is the real requirement — the GPU VRAM requirement calculator assembles all three — and the hosting economics that follow from the GPU count are what the self-hosted versus API break-even calculator turns into a monthly figure.

Frequently asked questions

Does 4-bit quantisation really give a 4× memory saving?

Only if every weight is quantised and the format carries no metadata, which no practical scheme achieves. Scales and zero-points add bits per weight, and embeddings and normalisation layers are usually kept at higher precision. A typical configuration lands near 5 effective bits per weight, for a real ratio around 3.2× rather than 4×. Use the effective bits figure to compare schemes honestly.

How much accuracy does quantisation cost?

That cannot be read off the bit width, which is why this calculator does not claim it. The loss depends on the model, the quantisation method, the calibration data and the task, and two 4-bit schemes can differ substantially. The only dependable procedure is to evaluate the quantised model against the full-precision baseline on your own benchmark. What is certain is that the degradation grows as bit width falls, and that below 4 bits it stops being a rounding detail.

Should I quantise the KV cache as well?

Frequently yes, and it is a separate decision from the weights. The cache scales with context length and batch size rather than with parameter count, so on long-context serving it can be the larger term. Storing it at 8 bits instead of 16 halves it exactly. Since it holds activations rather than learned parameters, the sensitivity to precision is generally lower than for weights — but as with weights, measure rather than assume.

Does a quantised model run faster?

Usually, because decoding is bound by memory bandwidth and each step reads the entire model. Halving the bytes read doubles the bandwidth-bound ceiling on tokens per second. Realising that gain depends on the kernels: dequantisation costs arithmetic in the inner loop, and a format without an optimised implementation for your hardware can be smaller without being faster. Measure the throughput after converting.

What does the scale and zero-point overhead field mean?

It is the metadata cost per weight: (scale bits + zero-point bits) ÷ group size. A 16-bit scale and 16-bit zero-point over groups of 64 weights is 32 ÷ 64 = 0.5 bits per weight. Larger groups reduce it — 0.25 at group 128 — but a single scale then has to represent a wider range of weights, which costs accuracy. Symmetric schemes omit the zero-point and halve the overhead.

Why do the sizes use decimal GB rather than GiB?

Because checkpoint sizes and model cards are quoted that way, and it makes the arithmetic clean: 70 billion parameters at 16 bits is exactly 140 GB. GPU memory is usually reported in binary units, so a card advertised as 80 GB shows slightly less than 80 decimal GB of usable capacity. The difference is around 7%, which matters when a configuration fits by a narrow margin — leave headroom rather than relying on the last gigabyte.

Can I fine-tune a quantised model?

Not by updating the quantised weights directly — integer weights are not differentiable in the usual sense. The standard approach freezes the quantised base and trains small low-rank adapter matrices in higher precision alongside it, which keeps memory low during training while leaving the base untouched. If you plan to fine-tune conventionally, start from the full-precision checkpoint and quantise afterwards.

Is a large model at 2 bits better than a smaller model at 8?

It depends on both models and your task, and the question is worth testing rather than reasoning about. What the memory arithmetic tells you is that the comparison is fair: a 70B model at 2 bits is 17.5 GB and a 13B model at 8 bits is 13 GB, so they are genuinely competing for the same hardware. Run both on your evaluation set. Very low bit widths degrade unevenly across tasks, so a result on one benchmark may not transfer.

References