Bring the mental model from Efficiency: Quantization, Distillation, LoRA & Sparse MoE; this page will reuse it instead of restarting from zero.
Efficiency
Quantization: Compressing Models to Integers
Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.

Concept Structure
Quantization: Compressing Models to Integers
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learning map
Quantization: Compressing Models to IntegersConceptual Bridge
What should feel connected as you move through this page.
Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.
The next edge should feel earned: use the demo prediction here before following Long Context Engineering: RoPE Scaling, KV Compression & Memory Optimization.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
Large models are often bottlenecked by memory bandwidth, not raw FLOPs. If memory bandwidth is the bottleneck, moving less data can improve throughput, though the actual speedup depends on kernels, hardware, batch size, and which tensors are quantized.
Quantization is the core trick: store weights (and sometimes activations) in low-bit integers like INT8 or INT4, with a scale factor that maps those integers back to approximate floating-point values.
A major enemy, especially in large LLM quantization, is outliers: a small number of large weights/activations can force a scale that wastes resolution for everything else.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Uniform quantization (per-tensor)
Given a tensor of weights with min/max values, choose one step size for the whole tensor and round onto integer levels:
Here is the number of bits (8 for INT8, 4 for INT4).
Finer-grained scaling: per-channel / row-wise
Instead of one scale for the whole matrix, use one scale per output channel/row. For signed symmetric quantization:
This usually improves quality because different channels have different dynamic ranges.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
rng = np.random.default_rng(0)
w = rng.normal(size=10000).astype(np.float32)
def quantize_uniform(w, bits=8):
qmin, qmax = 0, 2**bits - 1
wmin, wmax = float(w.min()), float(w.max())
delta = (wmax - wmin) / (qmax - qmin)
wq = np.clip(np.round((w - wmin) / delta), qmin, qmax).astype(np.int32)
what = (wq * delta + wmin).astype(np.float32)
return what, float(delta)
what8, d8 = quantize_uniform(w, bits=8)
what4, d4 = quantize_uniform(w, bits=4)
print("RMSE INT8:", round(float(np.sqrt(((w - what8) ** 2).mean())), 6), "delta:", round(d8, 6))
print("RMSE INT4:", round(float(np.sqrt(((w - what4) ** 2).mean())), 6), "delta:", round(d4, 6))
print("memory reduction: fp16->int8 ~2x, fp16->int4 ~4x (weight storage)")
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
The demo below asks you to predict which scaling strategy survives an outlier before revealing the quantization error. The key invariant is that a single shared scale can waste most integer levels on one large value, while per-channel scales recover resolution for ordinary rows.
Live Concept Demo
Explore Quantization: Compressing Models to Integers
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Quantization: Compressing Models to Integers should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Quantization: Compressing Models to Integers should make visible.
Visual Inquiry
Make the image answer a mathematical question
Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.
Which visible object should carry the first intuition?
Pick the cue that should make Quantization: Compressing Models to Integers easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Grounds transformer-scale INT8 inference, vector-wise normalization, and mixed-precision handling of emergent outlier feature dimensions.
Open sourceGrounds GPT-style post-training weight quantization using approximate second-order information and error-compensating updates.
Open sourceClaim Review
Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.
Claims without a substantive review badge still need exact source-support review.
dettmers-2022-llm-int8, frantar-2022-gptq
Use equation, code, and demo objects to check whether the source support is operational.
Dettmers et al. show transformer-scale 8-bit inference needs separate normalization constants and mixed-precision handling for emergent outlier features. Frantar et al. ground GPT-style post-training weight quantization with approximate second-order/error compensation. The page math, code, and demo instantiate scale quantize/dequantize, memory savings, and outlier-driven per-tensor vs per-channel RMSE.
Sources: LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale, GPTQ: Accurate Post-Training Quantization for Generative Pre-trained TransformersChecks the page's finite uniform-quantization and scale/outlier lesson only; it does not claim a full GPTQ solver, exact LLM.int8 routing, calibrated model accuracy, hardware speedups, activation quantization coverage, or all low-bit methods.A bounded review summary is present; still check caveats and exact source scope.Oracle PASS: Dettmers supports Int8 scaling/dequantization, single-scale outlier precision loss, vector-wise constants, and mixed-precision outlier handling; Frantar supports low-bit GPT weight quantization as compression with reconstruction-error control and reduced memory movement. Scope excludes full GPTQ, exact LLM.int8 routing, calibrated accuracy, speedup, activation coverage, and all low-bit methods.
Reviewer: codex+oracle; reviewed 2026-05-07Source support candidates
paper 2022LLM.int8(): 8-bit Matrix Multiplication for Transformers at ScaleGrounds transformer-scale INT8 inference, vector-wise normalization, and mixed-precision handling of emergent outlier feature dimensions.
paper 2022GPTQ: Accurate Post-Training Quantization for Generative Pre-trained TransformersGrounds GPT-style post-training weight quantization using approximate second-order information and error-compensating updates.
Practice Loop
Try the idea before it explains itself
Reduce memory and bandwidth by storing weights/activations in low-bit integers (INT8/INT4) with careful scaling to limit accuracy loss.
Before touching the demo, predict one visible change that should happen in Quantization: Compressing Models to Integers.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Quantization: Compressing Models to Integers
What is the smallest example that makes Quantization: Compressing Models to Integers click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:efficiency/quantization.
- Source ids to inspect: dettmers-2022-llm-int8, frantar-2022-gptq
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Quantization: Compressing Models to Integers Object key: concept:efficiency/quantization Context: Efficiency Anchor id: concept/concept-notebook/efficiency/quantization Open question: What is the smallest example that makes Quantization: Compressing Models to Integers click without losing the math? Evidence to inspect: - Source ids to inspect: dettmers-2022-llm-int8, frantar-2022-gptq - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/efficiency/quantization
concept:efficiency/quantization