Model quantization represents weights and activations with lower bit widths to reduce VRAM usage and improve inference speed, usually with some accuracy loss. This article explains the numerical principles, theoretical differences among precision formats, sources of accuracy loss, applicable and unsuitable scenarios, and a practical post-quantization quality evaluation method. It also explains why self-quantization is usually unnecessary when using models via API.

Definition
Model quantization represents weights and activations with lower bit widths to reduce VRAM usage and improve inference speed, usually with some accuracy loss.
Model Quantization · model compression, low-bit quantization, weight quantization
What Is Model Quantization: Definition and Problems It Solves
Model quantization represents weights and activations with lower bit widths to reduce VRAM usage and improve inference speed, usually with some accuracy loss. It addresses deployment-side resource constraints: VRAM occupied by large model weights, memory bandwidth during inference, and throughput limits for batch processing. Quantization does not change model structure or how text is split into Tokens; it only makes numeric representations coarser. As of December 2, 2026, model parameters follow the AGTCloud Model Library real-time display.
Constraint | Common bottlenecks before quantization | Changes introduced by quantization |
VRAM capacity | Large weight footprint; a single GPU may not fit it | Weight storage decreases proportionally with bit width |
Memory bandwidth | Each step moves a large amount of weights | Data movement decreases, so throughput may improve |
Inference latency | Compute and memory access are jointly constrained | Depends on operator support; not necessarily lower |
Deployment cost | Requires more or larger accelerator cards | The same hardware can support larger batches |
First, one point should be clear: quantization is deployment optimization, not a model upgrade. It does not improve the model's knowledge, nor change tokenization rules or context length; conflating it with switching to a stronger model is a common selection bias.
Basic principles of quantization: from floating point to low-bit integers
The core idea is to linearly map a floating-point numeric range to a narrower integer range, store the scale and zero point, and approximately recover values during inference. The formulas below describe the most common symmetric/affine quantization form and are used only to explain the principle.
量化: q = round(x / scale) + zero_point
反量化:x_hat = (q - zero_point) * scale
其中 scale 由该组权重的数值范围决定,可按整层 / 按通道 / 按组分别计算
误差来源:round 的取整误差 + 区间截断 + 反量化后的近似
粒度越细(按通道、按组),误差通常越小,但计算与存储元数据的开销越大The key lies in the granularity of the scale. Sharing one scale across the entire layer is the simplest to implement, but errors become noticeable when weight value distributions differ substantially; computing scales separately per channel or per group can reduce errors, at the cost of more metadata and more complex operator implementations. This is also one of the main sources of differences among quantization schemes.
Difference between weight quantization and activation quantization
Weights are static before inference, so value ranges can be collected offline and scales can be computed in advance; activations vary with inputs, so ranges must either be computed dynamically at runtime or estimated in advance from calibration samples as a fixed range. The former is simpler to implement and lower risk, while the latter offers greater benefits but is more sensitive to the representativeness of calibration data. Many schemes first quantize only weights, and consider activation quantization after confirming acceptable quality.
Theoretical differences among common precision formats
The table below compares only the bit-width-derived theoretical magnitude, without involving any measured benchmark scores or VRAM numbers for any specific model; actual benefits are affected by framework implementation, operator compatibility, and whether high-precision layers are retained, so they must be measured.
Precision format | Bit width | Theoretical weight memory relative to FP16 | Common uses |
FP32 | 32-bit floating point | about 2x | Training and baseline reference |
FP16 / BF16 | 16-bit floating point | baseline 1x | Common inference baseline |
INT8 | 8-bit integer | about 1/2 | General deployment quantization |
INT4 | 4-bit integer | about 1/4 | Scenarios that pursue a smaller footprint |
Mixed precision | Different layers use different bit widths | Between the two | Sensitive layers retain high precision |
“about 1/2” and “about 1/4” are only bit-width arithmetic; they do not mean total VRAM or latency is halved or reduced to one quarter: activations, KV cache, operator temporary buffers, and high-precision layers retained by the framework will not shrink by the same ratio. Putting theoretical values directly into capacity planning is the most common estimation mistake in quantization projects.
Where accuracy loss comes from
Error source | Step where it occurs | Typical manifestation | Mitigation |
Rounding error | When floating-point values are mapped to integers | Small numerical shifts that accumulate layer by layer | Finer quantization granularity |
Range clipping | Clipping outliers to a fixed range | Distortion of a few extreme weights | Per-channel range calculation and outlier protection |
Calibration sample bias | When estimating activation ranges | Real inputs exceed the calibration distribution | Calibrate with representative business samples |
Layer-wise accumulation | Multiple approximations in deep networks | Long-chain reasoning is more prone to degradation | Sensitive layers retain high precision |
Operator not supported | Failure to fuse dequantization with computation | Can become slower instead | Check operator support in the target framework |
Among these, “calibration sample bias” is most easily underestimated: calibrating with general corpora while running specialized-domain inputs in production means different activation distributions can make quantization results deviate clearly from laboratory conclusions. Calibration data should come from the real business distribution, and an independent evaluation set should be retained.
Why some layers are not suitable for quantization
Layers that are especially sensitive to value distributions or that perform normalization and scaling functions can have the errors introduced by low-bit approximation amplified by subsequent layers. Mixed-precision schemes therefore often keep a small number of critical layers in FP16 and quantize the rest, recovering most quality at a very small resource cost. Deciding which layers are sensitive requires layer-wise perturbation experiments rather than classifying them by layer type based on intuition.
Impact on VRAM, latency, and inference cost
Break the impact into three dimensions instead of summarizing it as “it got faster”. The table below gives directional judgments; the actual magnitude must be measured on the target hardware and framework.
Dimension | Typical direction | Cases where it may not hold | Verification method |
Weight VRAM | Decreases proportionally to bit width | Mixed precision retains high-precision layers | Read actual usage after loading |
Throughput | May improve in batched scenarios | Unsupported operators cause extra dequantization | Fixed-batch stress-test comparison |
Single-request latency | May decrease | Memory-access benefits are not obvious at small batch sizes | Compare by percentiles, not only averages |
KV cache | Is not the same thing as weight quantization | Still occupies the main space when the context is very long | Long-context stress test |
API cost | Callers usually do not perceive it | The provider may have already optimized it internally | Check by usage and billing |
Special note on KV cache: in long-context scenarios it may become the dominant VRAM item, and weight quantization does not solve it. Treating “once quantized, longer contexts can be supported” as a conclusion makes it easy to discover only during stress testing that the bottleneck has shifted.
Scenarios where quantization is suitable and where it is not
Scenario | Suitability | Judgment basis |
Local or private deployment with limited VRAM | Suitable | Resource constraints are clear and benefits can be measured directly |
High-frequency batch inference pursuing throughput | Suitable | Bandwidth benefits are easier to realize in batches |
Strict numeric or structured output is required | Caution | Small errors may break format adherence |
Long-chain reasoning and complex reasoning tasks | Caution | Layer-wise error accumulation is more pronounced |
Only called through cloud APIs | Usually unnecessary | Deployment and precision are determined by the service provider |
Hardware or framework does not support low-bit operators | Not suitable | May be slower than not quantizing |
One-sentence judgment: only when you are responsible for deployment and resource constraints are measurable is quantization a worthwhile option to invest in. Otherwise, prioritize optimizing caller-side usage and retry strategies; the return on investment is usually higher.
How to evaluate quality after quantization
Evaluation should not rely on a single average score. It is recommended to cover at least three types of tests and compare before and after quantization using the same sample set and the same random seed:
Fixed sample-set comparison: take 500–1000 representative business samples, covering high-frequency tasks and edge cases, and compare output consistency and task scores.
Format adherence rate: separately count parsing success rates for structured outputs such as JSON, tables, and code; these tasks are more sensitive to numerical perturbation.
Online canary release: first route 10% of traffic and observe for 1 day, comparing failure rate, retry rate, average output tokens, and latency percentiles.
samples = load_eval_set() # 固定样本,含边界样例
for s in samples:
base = infer(base_model, s, seed=42)
quant = infer(quant_model, s, seed=42)
report.append({
'task': s.task,
'score_base': score(base, s.reference),
'score_quant': score(quant, s.reference),
'json_parsable': try_parse_json(quant),
'output_tokens': count_tokens(quant),
})
# 分组看:按 task 统计分位数与失败样例,不要只汇总一个平均分Focus on percentiles and failure cases: average scores may change little, but the success rate of a low-frequency critical task can drop noticeably. This kind of degradation masked by averages is the most common feedback after quantization goes live.
What criteria should be used to archive evaluation results
Each time, record the target hardware, framework version, quantization configuration, sample set version, random seed, and model version identifier in the model library. Missing any one item makes conclusions hard to reproduce weeks later. Save these as experiment metadata and include them in version control like code.
Relationship between quantization and API services
When using cloud APIs, deployment form, precision selection, and inference optimization are decided by the service provider; callers see standard interfaces, context length, and usage data. Therefore, self-quantization mainly happens in local or private deployments; if the goal is to reduce API costs, more direct actions are controlling input/output tokens, improving cache hit rate, limiting retry amplification, and choosing suitable models by task.
According to the Step-5 launch announcement published by AGTCloud on December 1, 2026, the model's overall intelligence index increased by 11 points to 40 points, total output tokens decreased by about 38%, and equivalent API cost decreased by 36%. This kind of benefit comes from inference process optimization and appears to callers as usage changes, not requiring callers to handle weight precision themselves.
Common misconceptions about model quantization
Common claim | Why it is inaccurate | More accurate phrasing |
Halving the bit width halves memory | Activations, KV cache, and temporary buffers shrink by different proportions | Theoretical scale can be referenced, but capacity planning relies on measurements |
Quantization always makes inference faster | Unsupported operators can introduce extra dequantization overhead | Benchmark and compare on the target hardware and batch size |
Quantization changes tokenization rules | The tokenizer and weight representation are two independent mechanisms | Token counts do not change because of quantization |
If the average score does not drop, it can go live | Low-frequency critical tasks may degrade noticeably | Review percentiles and failure cases by task |
Calling APIs also requires quantizing models yourself | Deployment precision is decided by the service provider | Caller-side optimization of usage and retries is more effective |
Behind these misconceptions is the same habit: mixing deployment-side optimization and caller-side optimization. Once responsibility boundaries are clear, many discussions of whether to quantize become whether to first control usage or first change deployment, and the answer is usually much clearer.
Verify model information on AGTCloud
In the AGTCloud model library you can view each model's context length, parameters, and available versions as the source of version identifiers for evaluation metadata; developer documentation provides request structure and usage field descriptions, making it easier to align token changes during canary releases with billing; when sample requests are needed for verification, use console.
The content-side division of labor remains unchanged: this article provides principles and evaluation methods that do not change with model versions, while specific parameters and available models are maintained by the model library. This way, when models are updated or prices change next time, the encyclopedia content will not become outdated information that conflicts with official statements.
Frequently asked questions
Quantization converts weights and activations from high-bit floating-point representations to low-bit numeric representations to reduce VRAM usage, lower bandwidth demand, and improve inference throughput. It addresses deployment-side resource constraints, not model capability: it does not change network structure or tokenization rules, and it does not teach the model new knowledge. The trade-off is coarser numeric representation, which can cause accuracy loss, so post-quantization quality evaluation is required.
Source
Related reading
Lin Zhiyuan
LLM Research
AGTCloud columnist on large model technology, focusing on large language models, reasoning models, multimodal generation, and model capability evaluation. Mainly provides technical interpretation and application analysis of the technical characteristics, applicable scenarios, and selection methods of models such as DeepSeek, Tongyi Qianwen, and Doubao.