What if you could run a 70-billion-parameter language model on hardware that costs less than a used car? That question drives one of the most practical areas of machine learning engineering: quantization. The idea is simple. Instead of storing every weight in a model at 16-bit precision, you store it at 8 bits, or 4 bits, or sometimes even fewer. The model gets smaller, faster, and cheaper to run. The tricky part is doing this without turning a sharp model into a babbling one.
This article walks through the main LLM quantization techniques, from early 8-bit methods to modern 4-bit workflows and the file formats that make local inference possible. It also covers where these methods fail, which claims deserve skepticism, and what actually works when you deploy a model.
What quantization actually changes
A neural network stores most of its knowledge in weight matrices. In a typical setup, each weight is a 16-bit floating-point number. Quantization maps those values onto a smaller grid, usually integers with a scale factor. A 4-bit weight needs one-sixteenth the memory of a 16-bit weight, which means a 7B model that normally needs about 14 GB of memory can fit in roughly 4 GB.
Memory is only part of the story. Moving weights from memory to compute is often the bottleneck during inference, so smaller weights can mean faster token generation. Some methods also quantize activations (the intermediate values computed during a forward pass) or the KV cache (stored attention state for long contexts). Those targets matter because weight-only quantization leaves activation memory untouched, which limits gains on long-context workloads.
There are two broad families. Post-training quantization (PTQ) takes a trained model and compresses it without retraining. Quantization-aware training (QAT) simulates low precision during training so the model adapts. PTQ dominates LLM work because retraining huge models is expensive. (Quantization (signal processing)))
The 8-bit era and the outlier problem

Early attempts to quantize transformers to 8 bits failed in a puzzling way. Accuracy collapsed on large models but held up on small ones. The cause turned out to be outlier features: a small number of activation channels with values far larger than the rest. A single scale factor per tensor cannot represent both the outliers and the normal values without wrecking one of them.
The LLM.int8() method solved this by keeping outlier dimensions in higher precision while computing the rest in 8-bit. The result was 8-bit matrix multiplication for large transformers with no meaningful accuracy loss. Readers who want the full mechanism can read the LLM.int8() paper on 8-bit matrix multiplication for transformers at scale, which explains the mixed-precision decomposition in detail.
A related advance made 8-bit activation quantization practical. SmoothQuant observed that activations are harder to quantize than weights because of their wide range. Its trick is mathematical: migrate quantization difficulty from activations to weights by scaling channels, so both become easier to handle. That matters for production serving, where activation memory and compute both count.
4-bit weight quantization: GPTQ and AWQ
Once 8-bit became routine, attention shifted to 4 bits, where memory savings get serious.
GPTQ, published in late 2022 and presented at ICLR 2023, is a one-shot post-training method. It quantizes weights column by column and uses second-order information (the Hessian) to decide how to round each weight so that the error on a calibration set stays small. On large models, GPTQ reaches roughly 3 to 4 bits with modest perplexity degradation. It became the default for a wave of community quantized checkpoints.
AWQ, or Activation-aware Weight Quantization, takes a different angle. It observes that a small fraction of weight channels matters far more than the rest, and it identifies those salient channels using activation statistics rather than weight magnitudes alone. Protecting that small group lets AWQ hit 4-bit weight-only quantization with strong quality retention.
Here is a rough comparison of how the major methods differ:
| Method | Bit width | What gets quantized | Needs calibration data | Typical use |
|---|---|---|---|---|
| LLM.int8() | 8-bit | Weights and activations | No | Accuracy-safe 8-bit inference |
| SmoothQuant | 8-bit | Weights and activations | Yes | Serving with 8-bit activations |
| GPTQ | 3–4-bit | Weights | Yes | GPU inference of quantized checkpoints |
| AWQ | 4-bit | Weights | Yes | Fast 4-bit GPU inference |
| QLoRA | 4-bit base | Frozen base weights | No | Fine-tuning on limited hardware |
| GGUF k-quants | 2–8-bit | Weights | Method-dependent | CPU and local inference |
A practical warning: calibration data matters more than people expect. Quantizing a code model with calibration text drawn from novels can quietly hurt performance on the tasks you care about. Matching calibration data to the deployment domain is one of the cheapest quality wins available.
QLoRA and the fine-tuning angle
Quantization is not only for inference. QLoRA combines a frozen base model quantized to 4 bits with LoRA adapters trained in higher precision. The base model’s weights stay compressed, while the small adapter matrices learn in 16-bit. This made it possible to fine-tune a 65B-parameter model on a single 48 GB GPU, which was a significant shift for practitioners without clusters.
The key insight is that gradient updates do not need to touch every weight. Low-rank adapters carry the learning, and the quantized base provides the frozen knowledge. The QLoRA paper on efficient finetuning of quantized LLMs documents the memory breakdown and the techniques (like double quantization) used to keep overhead low.
For teams watching infrastructure costs, this pattern shows up constantly in cloud deployments: a quantized base plus adapters can serve many fine-tuned variants from one memory footprint. That is the kind of detail worth tracking in cloud coverage and infrastructure news, since memory economics drive most serving decisions. (News)
GGUF, llama.cpp, and local inference
The methods above describe algorithms. Getting them into users’ hands requires a file format. GGUF is the format used by llama.cpp, introduced in 2023 as a successor to the earlier GGML format. It bundles weights, metadata, and tokenizer information in a single file and supports k-quant schemes with names like Q4_K_M, where the suffix encodes how different tensor groups are quantized.
The naming confuses newcomers, so here is the short version: higher numbers mean more bits and better quality; the K variants use mixed precision across tensor blocks rather than one uniform width. A Q4_K_M file is usually a better quality-per-byte trade than a plain 4-bit file because it spends extra bits where they matter.
Practical tips for local inference:
- Start with a mid-range k-quant such as Q4_K_M rather than the smallest file available.
- Test on your actual tasks, and do not rely on a perplexity score alone.
- Watch context length, since the KV cache can dominate memory at long contexts even when weights are tiny.
- Keep the original full-precision model for evaluation baselines.
The most common mistake is chasing the smallest file. A 2-bit quant that mangles reasoning is not a win over a 4-bit quant that runs slightly slower. The llama.cpp repository documents the format and the available quantization types for anyone who wants the details.
Hardware-native low precision and sub-4-bit research
Some low-precision work happens in silicon rather than in software. NVIDIA detailed FP8 formats, named E4M3 and E5M2 for their exponent and mantissa bit allocation, in a 2022 paper, and Hopper-generation GPUs support them natively for both training and inference. When the hardware understands the format, you avoid the unpacking overhead that software quantization sometimes introduces.
Below 4 bits, research gets more speculative. Methods like QuIP# use lattice-based codebooks, and AQLM uses additive quantization with learned codebooks, both pushing toward 2-bit weights. Reported quality at 2 bits varies widely by method, model, and benchmark. Claims of “lossless 2-bit” quantization should be treated as contested until reproduced on your workload.
There is also a measurement problem. No agreed standard benchmark exists for quantization quality. Perplexity, zero-shot accuracy, and task-specific evaluations frequently disagree, and results shift with calibration data and group size. Any “X-bit is lossless” statement is really a statement about a specific model, method, and test suite. Treat it accordingly.
What actually works in practice
After the theory, the field experience. A few patterns hold up across deployments.
First, quantize late and evaluate early. Build your evaluation harness before you touch precision. If you cannot measure the regression, you cannot decide whether 4 bits is acceptable.
Second, match the method to the bottleneck. If memory bandwidth limits token generation, weight-only 4-bit helps a lot. If long-context serving limits you, look at KV cache quantization and activation methods, because weights are not the constraint.
Third, expect task-dependent damage. Quantization tends to hurt tasks that rely on fine numerical distinctions, rare tokens, or long chains of reasoning more than it hurts simple classification or summarization. A model that looks fine on a general benchmark can still degrade on your niche task.
Fourth, version your quantized artifacts. A quantized checkpoint is tied to a specific method, group size, and calibration set. When any of those change, the artifact changes. Teams that skip this step end up unable to reproduce their own results months later. (Cloud)
For ongoing developments in model compression and serving, the news section and the blog at 9481.org track releases and tooling changes that affect these workflows. (Blog)
Conclusion
LLM quantization has matured from a research curiosity into standard engineering practice. The 8-bit methods proved that low precision could be safe. GPTQ and AWQ made 4-bit weights routine. QLoRA turned quantization into a fine-tuning enabler. GGUF brought the whole thing to laptops. And hardware-native formats like FP8 are steadily removing the software overhead.
The honest summary is that quantization is a trade-off, not a free lunch. Every bit you remove buys memory and speed at the cost of some capability, and the size of that cost depends on your model, your method, and your tasks. The teams that get the most from it are the ones that measure carefully, choose methods that match their actual bottleneck, and stay skeptical of headline claims about lossless compression.
FAQ
What is quantization in large language models?
Quantization is the process of storing a model’s weights, and sometimes its activations or KV cache, in lower-precision formats such as 8-bit or 4-bit integers instead of 16-bit floats. The goal is to cut memory use and speed up inference while keeping quality close to the original model.
Is 4-bit quantization lossless?
No. Even the best 4-bit methods introduce some degradation, though it is often small on common tasks. Whether the loss matters depends on the model, the method, the group size, and the evaluation you run. Claims of lossless 4-bit compression should be checked against task-specific tests rather than accepted at face value.
What is the difference between GPTQ and AWQ?
Both are post-training 4-bit weight quantization methods, but they decide what to protect differently. GPTQ uses second-order information to round weights with minimal error on a calibration set. AWQ identifies the small fraction of weight channels that matter most using activation statistics and preserves them. Both produce strong 4-bit checkpoints and both need calibration data.
Can I fine-tune a quantized model?
Yes, with the right approach. QLoRA keeps the base model frozen in 4-bit and trains small LoRA adapters in higher precision, which makes fine-tuning large models feasible on a single GPU. Training the quantized weights directly is much harder and less common in practice.
What does Q4_K_M mean in a GGUF file?
It is a k-quant label used by the llama.cpp project. The 4 indicates roughly 4-bit precision, K means mixed precision across tensor blocks, and M denotes a medium variant. These files often give better quality per byte than a uniform 4-bit file because extra bits go where they matter most.
Why do quantized models sometimes fail on long contexts?
Weight-only quantization shrinks the model’s parameters but leaves the KV cache at higher precision. During long-context inference, the cache can grow to dominate memory, so a model that fits comfortably at short context may run out of memory at longer ones. KV cache quantization and activation-aware methods address this, but they are separate techniques from weight compression.







