A precision format is a budget of bits
Every weight in a neural network is a number stored in a fixed number of bits, and the format decides how those bits are spent. FP32 uses one sign bit, eight exponent bits and 23 mantissa bits. FP16 keeps the same sign and mantissa width of ten bits but shrinks the exponent to five, which caps the largest representable value at 65,504 and makes overflow a genuine risk during training. BF16 keeps the full eight-bit exponent range of FP32 and pays for it with a seven-bit mantissa, so it can represent very large and very small magnitudes while carrying roughly three decimal digits of precision. That range-over-precision trade is why BF16 became the default for training large models: a gradient that briefly spikes does not turn into an infinity and poison the run.
Below 16 bits the formats split into two families. FP8, available on H100, L40S, Ada-generation GeForce cards and Blackwell, keeps a floating-point layout with either three or four mantissa bits (E4M3 and E5M2). INT8 and INT4 are plain integers paired with a scale factor, and sometimes a zero point, that maps the integer grid back onto the original range of values. The scale is stored once per tensor, per output channel, or per small group of weights, and the group size is the main fidelity knob. GPTQ and AWQ typically use groups of 128 weights; GGUF k-quants group 32 weights into a sub-block inside a 256-weight super-block, storing a scale for each sub-block and a second scale for the super-block. Smaller groups track the distribution more closely and cost more metadata, which is why a so-called 4-bit checkpoint is rarely exactly four bits per weight.
The memory arithmetic worth memorising
Weight memory is parameters multiplied by bytes per parameter, and bytes per parameter is bits divided by eight. A 7B model is 14 GB in BF16, 7 GB at INT8, and 3.5 GB if you could hit exactly four bits. In practice a 7B Q4_K_M file lands near 4.1 to 4.4 GB because scales, zero points and a few tensors kept at higher precision add roughly half a bit per weight. The same arithmetic scales cleanly: an 8B model is 16 GB in BF16, about 8.5 GB at eight bits and 4.7 to 5.0 GB at four bits; a 70B model is 140 GB, 70 GB and roughly 40 GB; a 405B model is 810 GB, 405 GB and about 230 GB. Those numbers decide what hardware you can rent before you write a single line of serving code.
Two corrections matter in real deployments. First, not every tensor is quantized. Embedding tables and the output projection are often kept in BF16 because they are large, sensitive to rounding, and cheap relative to the transformer blocks in compute terms; in some models they account for a billion parameters on their own. Some architectures also protect the first and last blocks or the router layers of a mixture-of-experts model. Second, weight quantization does nothing for the KV cache or for activations, and at long context those can be larger than the weights. A 4-bit 7B model with a 16 GB cache is a 20 GB workload, not a 4 GB one, and people who budget only for weights are the ones who file the out-of-memory bug.
Speed comes from bytes moved, not from FLOPs
Token generation is memory-bandwidth-bound. To produce one token at batch size one, the GPU must read every weight in the model once, and the ceiling on throughput is bandwidth divided by bytes per token. A 7B model in BF16 reads 14 GB per token; on an RTX 4090 with about 1,008 GB/s of memory bandwidth that implies a theoretical 72 tokens per second, and real implementations land around 40 to 60 once kernel overhead and cache misses are counted. The same model at four bits reads roughly 4.2 GB per token, which raises the ceiling to about 240 tokens per second and typically delivers 90 to 150. That gap, not the arithmetic throughput of the tensor cores, is why quantization feels like a upgrade on a single GPU.
Batching changes the picture in a useful way. Weights are read once per decode step and reused across every sequence in the batch, so throughput rises almost linearly with batch size until the KV cache or compute becomes the constraint. Quantization and batching therefore compound: four-bit weights free memory that you can spend on a larger batch, which amortises the remaining weight reads over more tokens. Prefill, the phase that processes the prompt, is compute-bound instead, at roughly two floating-point operations per parameter per token. Weight-only four-bit quantization does not use integer tensor cores on most GPUs; it dequantizes into FP16 and runs an FP16 matrix multiply, so a long prompt can actually be slower than BF16 because of the dequantization work. FP8 is different, since Ada and Hopper chips have native FP8 tensor cores and can roughly double prefill throughput when the kernels and the model support it.
The main methods and what each optimises
GPTQ quantizes one layer at a time and uses second-order information from a small calibration set to compensate for the error each weight introduces. It needs a few hundred calibration samples, produces 3-bit and 4-bit checkpoints, and has mature GPU kernels in ExLlama, Marlin and vLLM. Quality at four bits is usually close to the original; at three bits the cracks widen quickly. AWQ takes a different route: it looks at activation magnitudes to find the small number of weight channels that matter most, scales those channels up before rounding so they survive with more resolution, and folds the scale back into the previous layer. It also needs calibration data, tends to edge out GPTQ at the same bit width, and is well supported in vLLM and TGI.
GGUF k-quants are the llama.cpp family, designed for local and CPU inference. They are block-based and mostly data-free, mixing precision across tensors so that attention and feed-forward weights get different treatment; the naming encodes that mix, which is why Q4_K_M and Q4_0 are not comparable artefacts. Q4_K_M is the usual default for desktop use, Q5_K_M and Q6_K trade memory for fidelity, and Q2 or Q3 exist for machines that would otherwise not run the model at all. An importance matrix, built from text representative of your workload, measurably improves the low-bit variants.
Three more families are worth knowing. Bitsandbytes NF4 underpins QLoRA: it maps weights onto quantiles of a normal distribution, which is close to optimal for the roughly Gaussian weight distributions in transformers, and double quantization shrinks the scale metadata again. SmoothQuant and LLM.int8 address a different problem, activation outliers: SmoothQuant migrates magnitude from activations into weights so both sides can be multiplied in INT8, while LLM.int8 keeps the outlier channels in higher precision and multiplies the rest in INT8. FP8 and the Blackwell-era block formats NVFP4 and MXFP4 push the scaling into hardware, with per-block exponents that track local ranges far better than a single per-tensor scale. The practical lesson across all of them is that calibration data is part of the artefact: a checkpoint calibrated on English Wikipedia, then deployed on Hindi legal text or dense JSON, can lose more quality than the bit width suggests.
What degrades first, and how you would notice
Eight-bit weights are close to transparent for most workloads; the difference from BF16 usually sits inside sampling noise. Four bits is where the interesting failures live. Chat still reads well, because conversational text is redundant and the model can recover from a slightly wrong token. The losses concentrate in multi-step arithmetic, exact API names and code syntax, strict JSON or schema adherence, retrieval at awkward positions in a long context, low-resource languages, and long instruction chains where each step must be followed precisely. Reasoning models amplify the effect: a one percent chance of a wrong intermediate step compounds across fifty steps into a visibly worse answer.
Model size changes the threshold. A 70B model at four bits usually beats a 7B model at BF16 on the same memory budget, because over-parameterisation gives the larger model redundancy to absorb rounding error. A 1B to 3B model at four bits is much more fragile, and at two or three bits small models often collapse into repetitive or incoherent output. The working rule is to spend memory on parameters first and precision second, then verify on your own task rather than trusting the rule.
Perplexity is a weak proxy and should not be your acceptance test. A rise of 0.1 to 0.2 in perplexity can hide a five to ten percent drop in exact-match accuracy on a structured extraction task, because perplexity averages over easy tokens that the model gets right either way. Quantization also changes style in ways metrics miss: more preamble before an answer, broken markdown tables, a refusal where the base model complied. If a downstream parser depends on the first line being JSON, that is a functional regression even when the prose is fine.
KV cache and activations are separate decisions
Weight-only quantization, usually written W4A16, leaves the KV cache in FP16 and leaves activations in BF16. That is the safest combination and the one most local setups use. It also means the cache can dominate. A 7B model with 32 layers, 32 attention heads and a head dimension of 128 stores about 0.5 MB per token in FP16, so 32K tokens of context costs 16 GB, four times the four-bit weights. Grouped-query attention changes that by sharing key and value heads: Llama-3-8B keeps eight KV heads and needs about 128 KB per token, so the same 32K context costs 4 GB. Architecture choice affects memory as much as bit width does.
Quantizing the cache to FP8 halves it again and is supported in vLLM and TensorRT-LLM with a single flag. The risk is concentrated in long-context retrieval, where the model must distinguish a needle from similar distractor text; FP8 cache is usually fine for chat and risky for forensic document search, so test the task you actually run. Activation quantization is a bigger step. LLM activations contain outlier channels that can be twenty to a hundred times larger than the median, and naively rounding them to INT8 destroys information. Methods like SmoothQuant move that magnitude into the weights, and per-token dynamic scaling helps, but the payoff is compute rather than memory, so it matters at high batch size and long prefill, not at single-user decode.
A selection guide by situation
- One 24 GB GPU, single user, chat or coding: four-bit AWQ, GPTQ or Q4_K_M, with 8-bit if the context you need still fits.
- Multi-user serving on H100 or L40S: FP8 weights with FP8 KV cache, because the tensor cores make it a throughput win rather than only a memory trick.
- Serving on older Ampere cards without FP8: AWQ or GPTQ at four bits with Marlin kernels, and BF16 for the output head.
- Fine-tuning: QLoRA with an NF4 frozen base, BF16 adapters, then merge into BF16 or serve the adapter alongside a shared base.
- Laptop or CPU-only: GGUF Q4_K_M by default, Q5_K_M or Q6_K if RAM allows, Q3 only when the alternative is not running the model.
- Long-context RAG: keep the cache in FP16 until you have measured retrieval accuracy, then try FP8 as an experiment rather than an assumption.
- Regulated or high-stakes decisions: BF16 or 8-bit, with a documented evaluation before anyone proposes four bits.
How to measure without fooling yourself
Compare like with like. Use the same prompts, the same chat template, the same sampling parameters, the same maximum token count and the same context length. A surprising share of reported quantization regressions are actually template mismatches: the four-bit build ships a different default system prompt or stop sequence, and the model is being asked a slightly different question. Fix the seed where the runtime supports it, set temperature to zero for extraction tasks, and run both variants on the same machine so thermal throttling does not become a variable.
Two hundred to five hundred examples per task gives a usable signal; twenty examples cannot separate four bits from BF16. Score with exact match, F1 or a rubric, not by reading a handful of outputs. On the performance side, record tokens per second at your real concurrency, time to first token, p95 latency and peak memory from torch.cuda.max_memory_allocated or nvidia-smi dmon rather than a single instantaneous reading. Then pin the artefact: repository, filename, quantization method, group size, calibration dataset, runtime version and kernel backend. Checksum the file, because two downloads labelled Q4_K_M from different uploaders are not guaranteed to be the same tensor values.
Common mistakes
- Budgeting only for weights and then discovering that a 32K context cache needs more memory than the model.
- Benchmarking the four-bit build at long context against a BF16 build at short context and blaming quantization for the difference.
- Calibrating on the wrong domain, such as English web text for a deployment dominated by code or Indic languages.
- Re-quantizing an already quantized checkpoint instead of starting from the original BF16 weights, which stacks rounding error.
- Assuming four bits is always faster on a GPU; dequantization overhead can make prefill slower than BF16.
- Skipping the output head and embeddings when estimating size, then wondering why the file is a gigabyte larger than the arithmetic predicted.
- Treating a perplexity delta as sufficient evidence and never running a task-level evaluation.
- Forgetting that the runtime, not the filename, decides which kernels run, so the same checkpoint performs differently in llama.cpp, vLLM and Transformers.