Close-up of a GPU circuit board representing reduced-precision LLM inference

Quantization for LLM Inference: What to Cut Without Breaking Quality

Quantization for LLM inference trades numeric precision for memory and memory bandwidth, and memory bandwidth is usually what you are paying for. Store weights in 8 or 4 bits instead of 16 and the same model fits on a smaller or fewer GPUs, loads faster, and often decodes faster too. The catch is that the rounding error lands somewhere, and it rarely lands where a generic benchmark looks.

This guide on quantization for LLM inference is about decisions: what can be quantized, which format fits which situation, how much memory you actually save, and an evaluation protocol that tells you whether a quantized checkpoint is safe for your workload. It is the sibling of the LoRA fine-tuning guide (which changes behavior) and the vLLM serving guide (which runs the result).

Three things you can quantize

  • Weights. The biggest win and the most common choice. Weight-only schemes keep activations in 16-bit and dequantize on the fly, so the saving is memory and bandwidth rather than raw compute.
  • Activations. Quantizing the intermediate values too (for example W8A8) lets hardware run low-precision matrix multiplies, which speeds up compute-bound prefill. It is more sensitive to outliers and needs calibration data.
  • The KV cache. Storing keys and values in FP8 halves the per-token footprint, raising the number of concurrent sequences. Mechanism and arithmetic are in KV cache explained for builders.

The formats you will actually meet

FormatBitsGood forWatch out for
FP8 (W8A8)8Recent data-center GPUs with native FP8; near-lossless in many casesNeeds hardware support; older cards fall back to slower paths
INT8 (weight-only or SmoothQuant-style)8Broad hardware support; conservative memory cutActivation outliers can hurt if activations are also quantized
AWQ4Fitting a bigger model on one card; preserves salient weightsCalibration set choice matters; kernel availability varies
GPTQ4 (or 3/8)Mature tooling, many pre-quantized checkpointsSlower to produce; quality depends on group size
GGUF (llama.cpp k-quants)2–8CPU, laptops, edge devicesDifferent runtime from GPU servers

Two papers explain the 4-bit options most teams reach for: AWQ (activation-aware weight quantization) protects the small fraction of weights that matter most, and GPTQ uses second-order information to round weights layer by layer. Which one your server can run is a matter of kernel support, so check the vLLM quantization documentation for the list on your version rather than assuming.

Memory math you can do in your head

Weights take parameters × bytes per parameter. Add a few percent for scales and zero-points in 4-bit schemes (group-wise quantization stores extra metadata), and you get quick estimates:

ModelFP16FP8 / INT84-bit (AWQ/GPTQ)Fits on
8B≈ 16 GB≈ 8 GB≈ 5 GB4-bit: a 12 GB consumer card; FP8: a 16–24 GB card
32B≈ 64 GB≈ 32 GB≈ 19 GB4-bit: one 24 GB card with short context
70B≈ 140 GB≈ 70 GB≈ 40 GBFP16: two 80 GB cards. FP8: one 80 GB card, tight. 4-bit: one 80 GB card with room for KV cache

The 70B row is the one that changes budgets. Moving from two 80 GB GPUs to one halves your hardware line item, but remember that weights are not the only consumer. The memory you free is exactly the KV cache headroom that decides concurrency. In a worked case, a 70B FP8 model on one 80 GB card leaves under 10 GB for cache, while the 4-bit version leaves over 30 GB, roughly tripling the sequences you can keep resident at the same context length.

Where quality breaks first

Leaderboard averages hide the failures that matter to applications. In practice, quantization damage shows up unevenly:

  • Strict structured output. A small rise in malformed JSON or schema violations, even when prose quality looks identical.
  • Code and math. Multi-step reasoning accumulates rounding error; pass rates drop faster than perplexity does.
  • Long context. Retrieval of a specific fact 60k tokens back degrades earlier than short-context chat, especially when the KV cache is also quantized.
  • Non-English and rare domains. Calibration data skews English, so low-resource languages and niche vocabulary lose more.
  • Refusal and tone behavior. Safety-tuned behavior can shift slightly; test your policy prompts explicitly.

An evaluation protocol that fits in an afternoon

  1. Build a task set from production. 300–500 real prompts (redacted) that cover each route, with expected outputs or rubrics. If you do not have one, golden datasets for LLM apps explains how to assemble and version it.
  2. Run baseline and candidate at temperature 0 on identical prompts, same serving stack, same sampling settings. Run each three times if your engine is not deterministic.
  3. Score three things separately: task success, format validity (schema pass rate), and safety/refusal behavior. Add a long-context slice if you serve long prompts.
  4. Set acceptance gates before you look. Example: task score drop ≤ 1.5 points, schema-invalid rate increase ≤ 0.3 percentage points, zero new policy failures.
  5. Inspect the diffs, not just the averages. Sort by largest score change and read 30 examples; patterns show up fast.
  6. Measure the speed you actually got. TTFT, ITL, and max concurrency at your SLO, because some 4-bit kernels are slower than FP8 at large batch sizes.

A candidate that passes all gates is ready for a staged rollout, not a switchover. Route 1% of live traffic to it with the traffic canary described in canary prompts for LLM deploys, and wire the offline gates into CI using the pattern in agent evals in CI.

Speed is not automatic

People assume 4 bits means 4× faster. Weight-only quantization reduces bytes read per decode step, which helps most when the batch is small and decode is bandwidth-bound. At large batch sizes, compute dominates, dequantization overhead appears, and the advantage narrows or reverses. W8A8 with native FP8 hardware is the case where prefill genuinely speeds up. The only reliable approach is to benchmark your own batch size and prompt-length mix, as laid out in LLM batching and latency.

Mistakes that make quantization look worse than it is

  • Trusting an unknown upload. A 4-bit checkpoint from a random hub account may have been calibrated on tiny data, with a different group size than the README claims. Prefer vendor-published or self-produced checkpoints, and record provenance.
  • Changing three things at once. Moving to FP8 weights, an FP8 KV cache, and a new serving version in one release makes any regression impossible to attribute. Change one axis per experiment.
  • Calibrating on the wrong text. Calibration sets drawn from English web prose do not represent your SQL-heavy or Korean-language traffic. Use a few hundred prompts from your own routes where the method allows it.
  • Reading perplexity as acceptance. Perplexity can barely move while JSON validity falls. Your gate should be task metrics, not language-model loss.
  • Forgetting the memory freed has to be used. If you quantize but leave concurrency settings unchanged, you pay the quality cost and bank none of the capacity gain. Re-run the sizing arithmetic and raise limits deliberately.

Decision guide

SituationStart withReason
Model fits comfortably in FP16, quality-criticalNo quantization, maybe FP8 KV cacheSimplest path; memory is not your constraint
Modern GPU, want 2× capacity with minimal riskFP8 weights (and test FP8 KV)Smallest quality delta in typical reports
Model does not fit your card4-bit AWQ or GPTQOnly way to fit; budget extra eval time
Edge, laptop, or CPU-onlyGGUF k-quant (Q4_K_M or Q5_K_M)Runtime built for it
Fine-tuned adapter on a big baseQuantize the base, evaluate adapter on topRe-validate; adapters trained on FP16 may shift after quantization

If you plan to fine-tune after quantizing the base, the QLoRA route trains adapters against a 4-bit model by design. For the serving-side bookkeeping that keeps all of this reproducible, store the quantization method, group size, calibration dataset, and checkpoint hash with the model entry, as recommended in the LLMOps production guide.

FAQ

What is quantization in LLM inference?

It is storing model weights, and sometimes activations or the KV cache, in fewer bits than the original 16-bit format. The model uses less memory and bandwidth, so it fits on smaller hardware and can decode faster, at the cost of some rounding error.

Does quantization reduce accuracy?

Usually a little, and sometimes not measurably at 8 bits. At 4 bits the loss is larger and more uneven: structured output, code, math, long context, and low-resource languages tend to degrade first. Always evaluate on your own tasks.

Should I use FP8, INT8, or 4-bit?

Use FP8 if your GPUs support it natively and you want a low-risk saving. Use INT8 for broad hardware compatibility. Use 4-bit AWQ or GPTQ when a model otherwise does not fit, and plan extra evaluation.

How much memory does a 70B model need after 4-bit quantization?

Roughly 40 GB for the weights including quantization metadata, versus about 140 GB in FP16. You still need free memory for the KV cache and activations, so a single 80 GB GPU is a realistic target with moderate context lengths.

Is a quantized model always faster?

No. Weight-only quantization helps most when decoding is memory-bandwidth-bound at small batch sizes. At high concurrency, kernel efficiency and dequantization overhead matter, so benchmark with your real batch and prompt mix.

Can I quantize and fine-tune the same model?

Yes. QLoRA trains small adapters on top of a frozen 4-bit base. If you instead quantize a model after fine-tuning, re-run your evaluation set, because rounding can shift the behavior the adapter taught.

Related reading

About Mudasir Syed

Check Also

Engineer watching a staged rollout progress bar and test results before a release

Canary Prompts for LLM Deploys: Catch Regressions Early

Canary prompts are small, fixed requests with a known-good expectation that you replay against every …

Leave a Reply