Purpose and development
What quantization changes
Quantization reduces the numerical distinctions a model can represent so its values can occupy fewer bits. Applied to weights, the numerical parameters learned during training, it can shrink a model without removing layers. Inference evaluates the model on an input using those weights, so approximating them can change the output. This tradeoff between weight storage and retained behavior motivates the quantization discussion in A Practical Guide to Efficient AI.
Several benefits are possible, and they are different claims. A smaller artifact needs less storage. Compact resident weights can leave memory for other work. Reading fewer bytes can reduce data movement. Supported low-precision arithmetic can increase computation throughput. Yet a runtime may reconstruct weights before multiplying them, and an application's memory includes more than weights. The inference resource model explains these separate allocations.
Quantization also differs from distillation, which trains a receiving model using another model's outputs as supervision. Distillation changes what a student learns; quantization specifies how numerical values are represented. The methods can be combined, but their mechanisms and costs differ. See Distillation.
A useful quantization decision therefore names three things: the resource that needs saving, the behavior that must remain acceptable, and the execution path that will deliver the saving. Choosing a bit width comes after establishing those requirements.
Turning points
Quantization grew from the problem of representing continuously varying signals with finitely many codes. Neural networks added another concern: numerical approximation could affect both a learned computation and the process that learns it. Later deployment systems had to make those representations executable on ordinary hardware, then scale conversion to increasingly large models.
| Development | Date | Contribution |
|---|---|---|
| Quantizing for Minimum Distortion — Joel Max, MIT Lincoln Laboratory | March 1960 | Explained how a signal's distribution should influence placement of a fixed number of reconstruction levels. |
| BinaryConnect — Courbariaux, Bengio and David | 2015 | Used binary weights during propagation while retaining higher-precision state for learning. |
| Integer-arithmetic-only inference — Benoit Jacob and colleagues, Google | December 2017 preprint | Connected simulated quantization during training to practical integer execution on mobile hardware. |
| GPTQ — Elias Frantar and colleagues | October 2022 preprint | Made accurate one-shot conversion tractable for large pretrained transformers. |
| OCP Microscaling Formats — multi-company specification | September 2023, version 1.0 | Standardized shared-scale numerical blocks while leaving their physical memory layout unspecified. |
These developments address complementary problems: choosing numerical levels, learning with coarse values, converting trained models and executing the result. They coexist because solving one problem does not settle the others. Understanding the numerical representation is the first step toward choosing among them.
Numerical representation
Range and resolution
Bit width counts the bits in an encoding. Range describes the values it can represent; resolution describes the spacing between neighboring values. Fewer bits allow fewer encodings, but the format determines where those encodings are spent. With a fixed scale, integer codes reconstruct to evenly spaced values. Floating point combines a sign, an exponent that selects a magnitude scale, and a significand that distinguishes values within that scale. Its spacing generally grows with magnitude: it can cover a wide range without maintaining the same absolute resolution throughout.
| Format | Meaning | Important distinction |
|---|---|---|
| FP32 | 32-bit single-precision floating point | A higher-precision reference format. |
| FP16 | 16-bit half-precision floating point | Less range and precision than FP32. |
| BF16 | 16-bit Brain Floating Point | A wider exponent field but fewer fraction bits than FP16. |
| INT8 | Eight-bit integer codes with a numerical mapping | LiteRT uses −127…127 for symmetric weights, but −128…127 for activations. |
| INT4 | Four-bit integer codes with a numerical mapping | The documented TensorRT path uses −8…7. |
Even “FP8” leaves choices unresolved. FP8 Formats for Deep Learning specifies E4M3 with four exponent and three fraction bits, and E5M2 with five exponent and two fraction bits, each plus a sign bit. Their maximum finite magnitudes are 448 and 57,344 respectively. More exponent range comes at the expense of fraction precision; equal width does not mean equal representable values. External scaling can also change how model values fit these encodings.
Storage, multiplication and accumulation precision are separate fields in the numerical contract, not consequences of a filename. An accumulator sums products and may be wider than its operands.
Scales, rounding and clipping
An affine quantizer uses a positive scale to set reconstructed spacing and an integer zero point to identify the code for numerical zero. Encoding rounds to a code and clips it to legal bounds. Dequantization reconstructs that code's numerical value; it cannot recover distinctions discarded during encoding.
For a small example, use codes −2…2, scale 0.5 and zero point 0. The five reconstruction levels span −1…1. This is a teaching grid, not a named storage format.
Many inputs share one reconstruction
ExampleHorizontal intervals merge inputs; filled endpoints show which level owns each exact nearest-even tie.
Rounding intervals and code clipping
Scale 0.5; zero point 0; codes −2…2. Open circles exclude an endpoint; filled circles include it. Exact ties −1.25, −0.75, −0.25, 0.25, 0.75 and 1.25 reconstruct to −1, −1, 0, 0, 1 and 1. Clipping changes the rounded code only when x < −1.25 or x > 1.25; equality is excluded. Worked encodings (original → rounded code → stored code → reconstruction): 0 → 0 → 0 → 0; 0.3 → 1 → 1 → 0.5; 1.4 → 3 → 2 → 1.
- 1. Identity: no reconstruction error
- 2. −1 for x ≤ −0.75
- 3. −0.5 for −0.75 < x < −0.25
- 4. 0 for −0.25 ≤ x ≤ 0.25
- 5. 0.5 for 0.25 < x < 0.75
- 6. 1 for x ≥ 0.75
- 7. Clipping changes code: x < −1.25
- 8. Clipping changes code: x > 1.25
- 9. Open endpoints: tie belongs to the neighboring level
- 10. Filled endpoints: even code owns the exact tie
- 11. Worked reconstructions
Read coordinates and regions as data
X: -1.6–1.6 dimensionless; Y: -1.6–1.6 dimensionless, increasing up. Equal scale on both axes.
(-1.5, -1.5); (1.5, 1.5)
(-1.5, -1); (-0.75, -1)
(-0.75, -0.5); (-0.25, -0.5)
(-0.25, 0); (0.25, 0)
(0.25, 0.5); (0.75, 0.5)
(0.75, 1); (1.5, 1)
(-1.5, -1); (-1.25, -1)
(1.25, 1); (1.5, 1)
(-0.75, -0.5); (-0.25, -0.5); (0.25, 0.5); (0.75, 0.5)
(-1.25, -1); (-0.75, -1); (-0.25, 0); (0.25, 0); (0.75, 1); (1.25, 1)
(0, 0); (0.3, 0.5); (1.4, 1)
−1: (-1, -1.12)
−0.5: (-0.5, -0.62)
0: (-0.1, 0.13)
0.5: (0.65, 0.38)
1: (1, 0.88)
0 → 0: (0.05, -0.23)
0.3 → 0.5: (0.1, 0.77)
1.4 → 1: (1.5, 1.25)
−1.25: (-1.25, -1.35)
1.25: (1.25, 1.52)
Code bounds constrain the stored integer; reconstruction bounds describe its decoded values. These boundaries act at different steps of the mapping.
A symmetric mapping centers zero at code zero. An asymmetric mapping can shift the represented interval using a nonzero zero point; it gains no additional codes. LiteRT uses symmetric weights but allows asymmetric activations. Exact zero remains useful: zero-valued padding should not become an unintended nonzero input.
The equally spaced levels of an affine mapping are a design choice. In his 1960 squared-error analysis, Joel Max placed decision boundaries midway between neighboring reconstruction levels and each level at the probability-weighted mean of inputs in its interval. That lets level placement reflect the input distribution; uniform spacing is not generally the minimum-distortion choice. Minimizing this numerical distortion still does not establish neural-network task quality. Rounding can also affect learning. A 1991 Carnegie Mellon report, describing experiments from fall 1990, found that discarding small weight updates could stall training. Rescaling and probabilistic rounding helped in its tested networks. The latter sometimes preserves an update's effect instead of always rounding it away.
Which tensors change precision
A tensor is a multidimensional numerical array. Weights are reusable parameter tensors. Activations are intermediate values computed from the current input—not the functions, such as ReLU, that transform them. A linear layer forms weighted combinations of incoming values; its inputs, weights and outputs can have different representations. Transformer arrays and parameters provides the model context.
Weight-only quantization compresses weights while leaving incoming activations at higher precision. W4A16 denotes four-bit weights and sixteen-bit activations; W8A8 denotes eight-bit weights and activations. Neither label specifies integer versus floating-point encodings, scales, grouping, accumulator width or exceptions. A documented INT4 weight-only path reconstructs weights before higher-precision multiplication.
The key-value cache, or KV cache, retains attention representations derived from processed tokens so later steps can reuse them. It is neither a weight tensor nor stored text. Its lifetime and precision policy are separate choices. The TensorRT-LLM workshop demonstrates independently configured weight and cache precision. Quantizing one does not establish what happened to the other.
Sharing a scale
Granularity specifies which entries share quantization parameters. For a weight matrix written with outputs in rows and inputs in columns, each row produces one output channel. Per-tensor quantization shares one scale across the matrix; per-output-channel quantization gives each row its own. Block or group quantization partitions it further. Per-token activation scaling instead groups the features at one token position. Record the axis and group size: transposing a matrix changes what a row means.
Consider the matrix with rows [1, 3] and [4, 12]. Use three-bit storage with symmetric codes −3…3, zero point zero and nearest-even rounding; one encoding is unused. Compare one global scale of 4 with separate row scales of 1 and 4.
Change the sharing boundary
ExampleSeparating unequal row ranges improves reconstruction without changing the entries or code width.
One scale: 4
Entries are labeled original → reconstructed.
- 1. Shared scale 4
- 2. Matrix entries
Read coordinates and regions as data
X: 0.3–2.7 index; Y: 0.1–2.7 index, increasing down. Equal scale on both axes.
(0.6, 0.6); (2.4, 0.6); (2.4, 2.4); (0.6, 2.4)
(1, 1); (2, 1); (1, 2); (2, 2)
1 → 0: (1, 1.23)
3 → 4: (2, 1.23)
4 → 4: (1, 2.23)
12 → 12: (2, 2.23)
Two scales: 1 and 4
Only the sharing boundary and scales change.
- 1. Row 1: scale 1
- 2. Row 2: scale 4
- 3. Matrix entries
Read coordinates and regions as data
X: 0.3–2.7 index; Y: 0.1–2.7 index, increasing down. Equal scale on both axes.
(0.6, 0.6); (2.4, 0.6); (2.4, 1.4); (0.6, 1.4)
(0.6, 1.6); (2.4, 1.6); (2.4, 2.4); (0.6, 2.4)
(1, 1); (2, 1); (1, 2); (2, 2)
1 → 1: (1, 1.23)
3 → 3: (2, 1.23)
4 → 4: (1, 2.23)
12 → 12: (2, 2.23)
Smaller groups can resolve unequal ranges, but add metadata and constrain execution. Scales along an output dimension can sometimes be applied after a dot product; scales varying inside its summed dimension require different handling. SmoothQuant explicitly designs its scaling axes around its efficient integer matrix-multiplication path. The finest grouping is not automatically the best supported configuration.
Outliers and consequential error
An outlier is unusually large relative to the values sharing its scale. Accommodating it expands the range and spreads a fixed number of levels farther apart. Clipping it permits finer central resolution but distorts the extreme. Neither choice is intrinsically safer: numerical rarity is not functional unimportance.
For example, with codes −3…3 and zero point zero, [1, 2, 12] at scale 4 reconstructs as [0, 0, 12] under nearest-even rounding. At scale 1 it becomes [1, 2, 3]. The smaller values improve, but the last value loses 9. This arithmetic cannot decide which representation preserves the model's answer; subsequent operations determine how those perturbations matter.
LLM.int8() addressed systematic large activation features observed in its 2022 transformer experiments. Selected outlier dimensions use FP16 computation; the rest use INT8 with wider accumulation, followed by combination. This mixed-precision response preserves selected computation instead of clipping it. Its outlier thresholds are experimental choices, not universal constants.
Finer grouping, higher-precision exceptions and range redistribution solve different aspects of the problem. Their effects can interact: layers that appear safe when quantized separately may fail in combination. The Compression at the Edge discussion highlights this combinatorial difficulty. Diagnose locally, then test the combined model rather than adding isolated sensitivity results.
Preparing a quantized model
Calibration and scale timing
Post-training quantization, or PTQ, derives a quantized representation from an already-trained model without ordinary task retraining. It can still involve substantial preparation. Some conversions use weight statistics alone; others observe model inputs to choose ranges or improve reconstruction. Calibration data means representative inputs used for those choices. Labels are often unnecessary. This differs from probability calibration, which concerns whether predicted probabilities match outcome frequencies.
A range observer collects numerical statistics. Min–max calibration covers observed extrema; histogram, percentile or error-based choices can sacrifice tails for better resolution elsewhere. Different observers can produce different mappings from the same tensors. More calibration examples do not repair systematically wrong coverage.
Preserve deployment preprocessing and cover relevant tasks, languages and sequence lengths. Calibrating Beyond English compared calibration languages at fixed token budgets for grouped four-bit GPTQ and AWQ. Language-matched or multilingual data often helped, but benefits differed by model, quantizer and downstream task. The practical lesson is to evaluate coverage choices, not assume one universal mixture.
When parameters are chosen
| Scale policy | Source of parameters | Consequence |
|---|---|---|
| Static | Preparation-time calibration | Reuses fixed parameters; unexpected ranges can saturate. |
| Dynamic | Current inference values | Adapts to current ranges; adds range calculation and conversion work. |
Dynamic scaling does not update learned weights. It is also independent of bit width and grouping: a per-token scale may be calculated at runtime, while weight scales remain fixed. Some formats combine offline global scales with runtime local scales. Conversely, practitioners sometimes call selective layer precision “dynamic quantization.” Specify the actual behavior rather than relying on that label.
Keep preparation inputs, development cases used to select configurations, and final assessment cases distinct. Repeatedly adjusting a quantizer after inspecting test results makes those cases development data. Independent assessment explains the boundary.
Preserving useful computation
Independent rounding minimizes each weight's local error without considering its use. Better conversion can instead preserve layer outputs, protect weights associated with important input activity, or redistribute difficult ranges between equivalent operands. These approaches differ in what they optimize and what their runtime must execute.
Output reconstruction
GPTQ targets layer-output reconstruction: keeping the layer's outputs close to their original values on observed inputs. It rounds weights and adjusts remaining weights to compensate. Second-order information describes how this reconstruction error curves as weights change, helping choose the corrections. GPTQ derives it from calibration inputs. Its original method quantizes weights, not activations. Processing blocks sequentially lets later blocks receive outputs from already-quantized predecessors.
Activation-informed protection
Activation-aware Weight Quantization, or AWQ, appeared as a June 2023 preprint. Activation magnitudes help identify consequential weight channels. AWQ scales weights and inversely scales inputs, searching scaling choices against layer-output differences on calibration inputs and selecting weight clipping. It protects channels without storing them separately in FP16. Excessive scaling can enlarge a group's range and harm neighboring weights. “Activation-aware” describes information used during preparation; the method remains weight-only. Avoiding backpropagation does not mean ignoring reconstruction error.
Equivalent rescaling
Range redistribution also has a pre-transformer history. Qualcomm's 2019 data-free quantization work addressed deployment without customer training data. For compatible ReLU networks, paired cross-layer scaling preserved the unquantized computation while balancing weight ranges; biases also needed corresponding treatment. The equivalence does not apply to arbitrary nonlinearities.
SmoothQuant, from Guangxuan Xiao, Ji Lin and colleagues at MIT and NVIDIA, appeared in November 2022. It sought hardware-friendly INT8 execution without a separate higher-precision outlier path.
Calibration chooses how much range difficulty moves from activations to weights. Compatible preceding operations absorb scaling offline. The quantized operands now incur different errors: algebraic equality before quantization is not equality afterward.
Pair activation columns with weight rows
Feature k is a vertical strip in X and a horizontal strip in W. Reciprocal scales cancel in their product before quantization.
Before rescaling: XW = Y
X has M input rows and K feature columns; W has K feature rows and N output columns. The highlighted column k of X pairs with the highlighted row k of W in their product. Ellipses indicate omitted entries; the grid is a symbolic window, not a numerical 3×3 example.
- 1. Activation feature k: column k
- 2. Weight feature k: row k
- 3. X: symbolic matrix grid
- 4. W: symbolic matrix grid
Read coordinates and regions as data
X: 0–4 layout; Y: 0–9.5 layout, increasing down. Axes scaled independently; screen angles and distances are not comparable.
(1.5, 1); (2.5, 1); (2.5, 4); (1.5, 4)
(0.5, 6.3); (3.5, 6.3); (3.5, 7.3); (0.5, 7.3)
(0.5, 1); (3.5, 1); (3.5, 4); (0.5, 4); (0.5, 1); (1.5, 1); (1.5, 4); (2.5, 4); (2.5, 1); (3.5, 1); (3.5, 2); (0.5, 2); (0.5, 3); (3.5, 3)
(0.5, 5.3); (3.5, 5.3); (3.5, 8.3); (0.5, 8.3); (0.5, 5.3); (1.5, 5.3); (1.5, 8.3); (2.5, 8.3); (2.5, 5.3); (3.5, 5.3); (3.5, 6.3); (0.5, 6.3); (0.5, 7.3); (3.5, 7.3)
X · M×K — feature column k: (2, 0.7)
⋯: (1, 1.85)
X[1,k]: (2, 1.85)
⋯: (3, 1.85)
⋯: (1, 2.85)
X[i,k]: (2, 2.85)
⋯: (3, 2.85)
⋯: (1, 3.85)
X[M,k]: (2, 3.85)
⋯: (3, 3.85)
W · K×N — feature row k: (2, 5)
⋮: (1, 6.15)
⋮: (2, 6.15)
⋮: (3, 6.15)
W[k,1]: (1, 7.15)
W[k,j]: (2, 7.15)
W[k,N]: (3, 7.15)
⋮: (1, 8.15)
⋮: (2, 8.15)
⋮: (3, 8.15)
Product Y · M×N: (2, 9.2)
After rescaling: (XD⁻¹)(DW) = Y
Every activation column divides by its positive diagonal scale and the matching weight row multiplies by that scale. The highlighted feature k uses sₖ > 0: X[:,k]/sₖ and sₖW[k,:]. D acts on the shared K dimension. The product remains Y before quantization.
- 1. Activation feature k: column k
- 2. Weight feature k: row k
- 3. X: symbolic matrix grid
- 4. W: symbolic matrix grid
Read coordinates and regions as data
X: 0–4 layout; Y: 0–9.5 layout, increasing down. Axes scaled independently; screen angles and distances are not comparable.
(1.5, 1); (2.5, 1); (2.5, 4); (1.5, 4)
(0.5, 6.3); (3.5, 6.3); (3.5, 7.3); (0.5, 7.3)
(0.5, 1); (3.5, 1); (3.5, 4); (0.5, 4); (0.5, 1); (1.5, 1); (1.5, 4); (2.5, 4); (2.5, 1); (3.5, 1); (3.5, 2); (0.5, 2); (0.5, 3); (3.5, 3)
(0.5, 5.3); (3.5, 5.3); (3.5, 8.3); (0.5, 8.3); (0.5, 5.3); (1.5, 5.3); (1.5, 8.3); (2.5, 8.3); (2.5, 5.3); (3.5, 5.3); (3.5, 6.3); (0.5, 6.3); (0.5, 7.3); (3.5, 7.3)
XD⁻¹ · M×K — column k ÷ sₖ: (2, 0.7)
⋯: (1, 1.85)
X[1,k]/sₖ: (2, 1.85)
⋯: (3, 1.85)
⋯: (1, 2.85)
X[i,k]/sₖ: (2, 2.85)
⋯: (3, 2.85)
⋯: (1, 3.85)
X[M,k]/sₖ: (2, 3.85)
⋯: (3, 3.85)
DW · K×N — row k × sₖ: (2, 5)
⋮: (1, 6.15)
⋮: (2, 6.15)
⋮: (3, 6.15)
sₖW[k,1]: (1, 7.15)
sₖW[k,j]: (2, 7.15)
sₖW[k,N]: (3, 7.15)
⋮: (1, 8.15)
⋮: (2, 8.15)
⋮: (3, 8.15)
Product Y · M×N: (2, 9.2)
Training for quantized execution
Quantization-aware training, or QAT, adjusts parameters while exposing forward computation to quantization effects. Fake quantization rounds and clamps values, then reconstructs them in floating-point tensors. It simulates representational loss without creating the final packed artifact.
Ordinary rounding has zero derivative between boundaries and is nondifferentiable at them. A straight-through estimator substitutes an approximate gradient so training can continue. This is not the true derivative of quantization. Higher-precision parameters can accumulate small updates even while forward values occupy a coarse grid. See parameter updates for the underlying optimization process.
Retain updates between rounding boundaries
Training updates higher-precision parameters, while forward computation consumes their coarse reconstructions.
Read the diagram as text
- Retained W_t. Higher-precision parameter state preserves small updates between training steps.
- Fake quantization. Round, clamp and reconstruct using the training quantization mapping.
- Reconstructed forward values. Floating-point tensors restricted to the reconstruction levels; distinct from retained parameter state.
- Forward computation → loss. The model uses reconstructed values to compute the training loss.
- STE backward approximation. A straight-through estimator substitutes a gradient through the fake-quantization boundary. It is not the true derivative of rounding.
- Optimizer update. Combines the approximate gradient with retained higher-precision parameters.
- Retained W_(t+1). Updated higher-precision state supplies the next training step. Forward reconstructions do not overwrite it.
- Retained W_t → Fake quantization: Forward: parameters.
- Fake quantization → Reconstructed forward values: Forward: reconstruction.
- Reconstructed forward values → Forward computation → loss: Forward: model evaluation.
- Forward computation → loss → STE backward approximation: Backward: loss gradient.
- STE backward approximation → Optimizer update: Backward: approximate gradient.
- Retained W_t → Optimizer update: Retained update state.
- Optimizer update → Retained W_(t+1): Updated parameters.
BinaryConnect separated binary propagation weights from higher-precision update state. Binarized Neural Networks, by Courbariaux, Hubara, Soudry, El-Yaniv and Bengio in 2016, extended binary representations to activations. Its substituted gradient passed information within a bounded interval and canceled it outside. Binary dot products could use XNOR and population counts, but neither every operation nor all training state became binary.
TorchAO's QAT workflow separates preparation, training and conversion. The deployed mapping must match the trained simulation closely enough to test. TensorFlow's QAT guide explicitly distinguishes supported deployment configurations from experimental simulations without a supported export path.
Adaptation also needs suitable data and compute. Quantization-aware distillation adds teacher supervision to recovery training; the edge-compression panel reports that mismatched recovery data can damage reasoning models with capabilities acquired through multiple training stages. QAT is therefore an additional intervention to justify and evaluate, not a guaranteed repair after aggressive PTQ.
Storage and execution
From nominal bits to bytes
Bit packing places multiple low-bit codes into larger storage units. For values with -bit payloads, payload storage is approximately bytes. One billion sixteen-bit values require 2 GB; four-bit values require 0.5 GB, using decimal units. Neither estimate includes scales, zero points, padding, container information or higher-precision exceptions.
Effective bits per value includes representation overhead under a stated accounting boundary. Two four-bit floating-point schemes illustrate why this matters. Both use E2M1 elements—one sign, two exponent and one fraction bit—but their shared scales differ.
| Representation | Block fields | Bits per value | Additional boundary |
|---|---|---|---|
| NVFP4 | 16 × 4-bit elements + one 8-bit E4M3 scale | 4 + 8/16 = 4.5 | Also has an FP32 tensor scale. |
| MXFP4, OCP MX v1.0 | 32 × 4-bit elements + one 8-bit E8M0 scale | 4 + 8/32 = 4.25 | Specification does not fix physical packing. |
These are encoded-field calculations, not device-memory measurements. Artifact size describes a serialized object; resident weight memory describes loaded parameters; total runtime memory includes other allocations; peak memory is the maximum over a specified interval. Loading, repacking or conversion may create temporary representations. Use the inference memory ledger to keep these boundaries separate.
A concrete example comes from MobileAIBench. Its four-bit TinyLlama 1B artifact was reported as 0.6 GB on disk, while a HotpotQA run in its iPhone 14 application used 3.34 GiB RAM. The units and boundaries differ. The RAM figure is application usage, not isolated weights or a demonstrated startup peak; the comparison does not measure a speedup over higher precision.
What the runtime computes
A kernel implements a numerical operation; on a GPU it executes device-side parallel work. The kernel chapter explains that execution model. Here the central distinction is between compact storage followed by reconstruction and actual low-precision multiplication.
Packed-weight execution
Weight-only execution can reconstruct packed weights as they are consumed, avoiding a complete expanded weight buffer. Marlin rearranges weights and scales offline and schedules dequantization alongside matrix computation. A separate conversion that materializes expanded weights has different traffic and memory costs. Fusion describes where work occurs, not a new numerical format.
Integer execution
Integer execution centers codes by subtracting their zero points, then sums their products. Multiplying by both operand scales restores numerical units. Requantization encodes the result in the next operation's quantized mapping, when required.
Centered operands [2, −1] and [3, 4] give . Scales 0.5 and 0.25 yield ; output scale 0.125 and zero point 0 yield code 2 without clipping.
Wider arithmetic is part of the contract. LiteRT's INT8 convolution uses INT32 bias with scale equal to input scale times the corresponding weight scale. Its zero-centered weights also eliminate a runtime-dependent zero-point correction term. Other operators impose additional restrictions, such as matching quantization parameters across concatenated tensors.
The artifact, converter, runtime and device must agree on layouts and operations. LiteRT conversion may retain floating-point operators, whereas requiring integer-only operators exposes unsupported conversion. TensorRT can fail to build an unsupported low-precision path. Verify the selected implementation rather than treating successful loading as proof of acceleration. Implementation-layer choices belong to this execution decision.
Capacity is not speed
Memory capacity limits what can remain allocated. Memory bandwidth limits how quickly bytes can move. Arithmetic throughput limits the rate of computation. Quantization can relieve one without relieving the others. Smaller weights may make a model fit or leave room for more simultaneous sequences while conversion work or unchanged operations still determine latency.
Prefill processes known prompt positions; decode generates continuations incrementally. At small batches, decode may repeatedly load weights for relatively little arithmetic. Processing more positions together can reuse those weights. The relevant quantity is arithmetic intensity, work per byte crossing a memory boundary. Recall prefill and decode and arithmetic-versus-traffic bounds; neither phase has one universal bottleneck.
Current deployment recipes make precision a choice across several parts of the model. NVIDIA Model Optimizer separates the model-body scheme from the KV-cache scheme and provides both weight-only and weight-and-activation formats. A four-bit checkpoint therefore does not tell you which operations run at four bits or how much memory a long conversation will use. Read the precision map and confirm runtime support before predicting a benefit.
| Recipe family | What changes | What to check |
|---|---|---|
| Weight-only W4A16 | Four-bit weights with 16-bit activations | Packed layout, dequantization and supported kernels |
| NVFP4 W4A4 | Four-bit weights and activations in selected layers | Calibration, layer exceptions and target hardware support |
| Separate KV-cache precision | Stored attention keys and values | Long-context memory use and task quality |
Kernels can change that balance. Marlin's published A10 comparison used group size 128 and a large, favorably partitioned matrix. It reported retaining substantial weight-traffic benefits across larger batches where competing four-bit kernels lost relative speed. These are kernel-level results under stated shapes, not endpoint latency or quality-qualified serving throughput.
Measure first-token delay, token cadence, complete-request latency and throughput separately at relevant lengths and concurrency. Keep startup measurements separate from warm execution. A compact file does not establish loading time or peak startup memory, and a faster loaded model does not establish how quickly a new replica becomes ready.
Validation and operating choices
Diagnose numerical changes
A difference from the higher-precision model is not automatically a bug: quantization deliberately changes representable values. First establish whether the deployed path implements the intended quantized computation. Then measure the approximation it introduces. Finally assess the resulting behavior.
| Comparison | Reference | Supported conclusion |
|---|---|---|
| Implementation agreement | Same mapping, grouping and arithmetic assumptions | The deployed operation agrees within justified tolerances. |
| Numerical approximation | Higher-precision tensors or layer outputs | Where and how much numerical values changed. |
| Task behavior | Matched cases with independent outcome checks | Whether required work remains successful. |
Use the supported-domain testing approach, including rounding boundaries, saturation, grouping axes and supported shapes. A tolerance is an allowance, not an explanation. For finite values, a common check accepts , where is actual and expected. Absolute tolerance controls behavior near zero; library defaults do not establish an application's error budget.
Compare intermediate outputs and try controlled higher-precision exceptions to locate a consequential change. Recheck the complete configuration because exceptions and quantized layers interact. Execution optimizations themselves can alter numerics. TensorRT-LLM documents a Hopper FP8 fusion that combines matrix multiplication with the following activation function, SwiGLU. This implementation discards a scaling factor and can slightly reduce accuracy. An unchanged “FP8” label therefore does not guarantee unchanged behavior.
Measure retained task quality
A paired comparison evaluates baseline and candidate on the same cases. Keep prompts, preprocessing, generation settings and assessment policy fixed when isolating quantization. Repeat variable runs and preserve their uncertainty rather than treating one changed completion as a stable effect. Matched-work comparisons explains the design.
Perplexity measures how much probability a language model assigns to the tokens in an evaluation text. It exponentiates the average negative log probability assigned to each observed token; assigning those tokens higher probabilities lowers perplexity. This measures token prediction, not complete task success. Accuracy is Not All You Need also examines answer flips between correct and incorrect in either direction. Gains and regressions can cancel in aggregate accuracy. Flips omit changes between two incorrect answers, and matching the baseline does not make an answer correct.
| Baseline outcome | Candidate correct | Candidate incorrect |
|---|---|---|
| Correct | 70 | 10 regressions |
| Incorrect | 10 gains | 10 |
A task slice is a meaningful subset, such as long inputs, a language or a critical action type. Cache precision can matter especially at longer lengths. In Evaluating Quantized Large Language Models, the LongEval task tests retrieval of a requested value from key-value pairs in a long input. The following Vicuna-7B results use 16K-token inputs and the study's grouped asymmetric weight and cache quantization protocol.
| Weight precision | KV precision | Reported score |
|---|---|---|
| FP16 baseline | FP16 baseline | 57.80% |
| 8-bit | 8-bit | 56.40% |
| 8-bit | 4-bit | 37.00% |
Holding eight-bit weights fixed, changing the cache to four bits reduced the score by 19.40 percentage points. This is a quality result, not a speed measurement, and its magnitude need not transfer to another model. It demonstrates why short-context or weight-only checks can miss a consequential regression.
Finally, run the intended application harness—the software that executes complete tasks and records outcomes. Benchmark retention can coexist with altered multi-step behavior. The edge-compression panel describes both benchmark and harness testing, including retaining higher precision when smaller models became less usable. On devices, also examine latency, hardware use and battery drain alongside task and safety behavior.
Choose and maintain a configuration
Start with required behavior and the limiting resource. Filter out representations the target stack cannot execute. Try PTQ, representative calibration and selective precision before committing to adaptation whose data and compute costs may exceed the saving. QAT becomes a candidate when recovery is valuable and its deployment path is supported—not simply because it is more elaborate.
A configuration is Pareto-dominated if another candidate is at least as good on every compared objective and strictly better on at least one. The Pareto frontier contains candidates for which no such alternative exists among those examined. Compare measurements from the same operating conditions and account for uncertainty. A lower-memory candidate with worse latency may remain useful; one that violates required quality is infeasible regardless of its speed. Hacking the Inference Pareto Frontier frames this around application-specific operating requirements.
| Decision field | Record | Acceptance basis |
|---|---|---|
| Quality | Paired outcomes, critical regressions and slices | Required task behavior |
| Memory | Resident and peak measurements at named boundaries | Actual deployment ceiling |
| Latency | First-token, token cadence and completion distributions | Interactive or batch response requirement |
| Throughput | Completed work under stated load and quality | Required sustainable service rate |
| Preparation and maintenance | Conversion, adaptation, evaluation and debugging effort | Benefit sufficient to justify ongoing work |
Record the exact model revision; numerical encodings; scale and zero-point types; grouping axes and sizes; scale timing; calibration provenance; higher-precision exceptions; cache policy; and converter, runtime, compiler and device versions. Preserve workload and assessment records too. Evaluation manifests and serving benchmark contracts supply the broader reproducibility framework. An unavailable measurement remains unavailable, not zero.
Retest the affected claims when model weights, calibration coverage, precision policy, runtime kernels or workload change. Language coverage can alter conversion quality; a fusion can alter arithmetic; batching can alter performance. The justified operating choice is the complete measured configuration, not its nominal bit width. Broader lifetime economics belong in AI Cost and Performance Engineering.
Open questions
Predicting behavioral sensitivity remains difficult because numerical errors interact across layers and tasks. Progress would make precision allocation cheaper while predicting critical regressions on independent workloads, not merely matching reconstruction scores.
Calibration must cover changing languages, tasks and input lengths without becoming prohibitively expensive. Progress would identify compact preparation sets whose benefits survive distribution changes and downstream assessment.
Recovery training needs data that preserves capabilities acquired through multiple training stages. Progress would provide reproducible ways to recover quantized behavior without sacrificing specialist abilities or requiring inaccessible original training mixtures.
Portable low-precision deployment requires agreement beyond numerical encodings: packing, operation support and conversion behavior still vary. Progress would connect shared format specifications to verifiable execution contracts across backends.

























