Quantization

Quantization stores model values in lower precision, commonly int8 or 4-bit formats, to reduce memory bandwidth and serving cost. It matters most for model serving of local models, cost and latency optimization, and local versus hosted models decisions.

The practical question is not “how many bits can we use?” but “which lower-precision representation preserves enough task quality while fitting the serving budget?”

Int8 quantization

Uniform symmetric int8 quantization can use scale , quantized value , and reconstruction . The error affects logits, attention, and sometimes tool-routing reliability.

Here is a real-valued weight or activation, is the stored integer, and maps between integer units and the original numeric scale. The constant 127 is the largest positive signed int8 value, so the largest magnitude in the tensor sets the scale for all other values under per-tensor symmetric quantization.

Worked example

For values , the largest magnitude is , so symmetric int8 quantization uses

Value Quantized Reconstructed Error
-1.25-93-1.245-0.005
-0.10-7-0.094-0.006
0.0000.0000.000
0.80600.803-0.003
1.701271.7000.000

The endpoint maps exactly to 127 by construction. Intermediate values absorb rounding error, so real models need layer-wise and task-level evaluation after quantization rather than relying on memory savings alone.

ChoiceTrade-off
Weight-only quantizationReduces model memory with fewer activation changes.
Weight-and-activation quantizationCan improve throughput but is more sensitive to outliers.
Per-tensor scaleSimpler metadata, worse fit for heterogeneous channels.
Per-channel scaleMore metadata, often lower reconstruction error.

Where quantization is applied

TargetTypical benefitRisk
Weightslower memory footprint and bandwidthdegraded rare-token or domain behavior.
Activationsfaster kernels and lower memory trafficsensitivity to outliers and long-context states.
KV cachelonger context or more concurrent sessionsaccumulated attention error.
Embeddingssmaller vector storeschanged nearest-neighbor rankings.

Quantization is therefore evaluated at the system level. A 4-bit model that answers normal chat well may still fail tool routing, numeric extraction, multilingual prompts, or long-context retrieval synthesis.

Evaluation

Compare the quantized model to the reference model on the routes it will actually serve: direct answers, structured extraction, RAG answers, tool calls, refusals, and long-context prompts. Track exact-schema validity, unsupported-claim rate, latency, memory, and cost. If quantization changes only a few logits, the visible failures may appear in rare but important edge cases.

Caveats

Quantization can degrade rare-token behavior, arithmetic, multilingual quality, or long-context stability before aggregate benchmarks show large drops. It can also change determinism if kernels, batching, or hardware differ between reference and serving environments.

References