← Back to AI Infrastructure Mind Map
🖥️ AI InfrastructureID: quantization-inference

Inference Quantization (cross-module)

推理量化(跨模块)
🎯Core Definition
Inference quantization = casting model weights (and optionally activations and KV cache) from FP16 to INT8/INT4/FP8 to trade memory for serving throughput (quantization theory and error analysis live in the LLM module; this card focuses on serving-side deployment). Three mainstream schemes: ① INT8 W8A8 (weights and activations both 8-bit): activations have outliers, so SmoothQuant shifts the outliers into the weights before activation quantization; ② INT4 W4A16 (4-bit weights, FP16 activations): AWQ applies activation-aware channel-wise scales into the weights to protect the "important channels" with the largest output impact — small calibration set, no backprop, cheaper than GPTQ; ③ FP8 (E4M3): native Tensor Core support on H100/B200, large dynamic range, near-zero calibration cost, the new serving default. Memory ledger: 7B FP16 ≈ 14GB → INT8 ≈ 7GB → INT4 ≈ 3.5GB; 70B goes from ≈ 140GB to ≈ 35GB, fitting one GPU.
💡Use Cases
squeezing models onto fewer GPUs and packing larger concurrent batches on each card to cut per-token cost; in interviews the LLM module tests principles (quantization error/calibration) while AI_Infra tests deployment — GPTQ/AWQ/FP8 backend selection in vLLM/SGLang, group size (e.g. 128/32), and batch-size vs memory accounting.
⚡Key Problems Solved
vs FP16, INT4 weights use 4× less memory (14GB → 3.5GB), 4× the model scale fits a single GPU, and the freed memory buys larger concurrent batches, roughly doubling serving throughput; the cost is precision loss from activation outliers and quantization noise, mitigated by calibration data and algorithms like AWQ/SmoothQuant — memory, precision and throughput form the core trade-off triangle, settled against latency budgets and quality gates on real eval sets.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Inference Quantization (cross-module).
Use Cases
In production engineering, what are the primary use cases for Inference Quantization (cross-module) and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Difference between W8A8 and W4A16? Why is activation quantization harder than weight quantization (outliers) and how does SmoothQuant migrate outliers into the weights?
2
How AWQ works: why do activation-aware scales on "important channels" preserve accuracy? Why is calibration cheaper than GPTQ (no backprop)?
3
FP8 serving: E4M3 layout and native H100 support; vs INT8 it has wider dynamic range and needs less calibration; when would you still pick INT4?
4
Serving math: 7B FP16 ≈ 14GB → INT8 ≈ 7GB → INT4 ≈ 3.5GB; how do batch size and throughput scale in the same memory? How do group sizes 128/32 trade precision and overhead?
5
Memory-precision-throughput trade-off: when to choose post-training quantization (PTQ) vs quantization-aware training (QAT)? How do you verify quantization loss stays within quality gates before rollout?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Inference Quantization (cross-module)"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardHigh-Concurrency ServingNext Card →FlashAttention Kernel & Online Softmax

🔗 More AI Infrastructure Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/AI_Infra/card/quantization-inference
中文速览与面试要点

推理量化(跨模块) (Inference Quantization (cross-module))

定义: 推理量化 = 把模型权重(必要时含激活与 KV)从 FP16 降到 INT8/INT4/FP8,用显存换吞吐的服务侧落地手段(量化原理与误差分析详见 LLM 模块,本卡聚焦服务落地)。三种主流方案: ① INT8 W8A8(权重与激活皆 8-bit): 激活存在离群值(outliers),需 SmoothQuant 把离群从激活迁移到权重再做激活量化;② INT4 W4A16(权重 4-bit、激活 FP16): AWQ 按激活幅度感知,把通道级 scale 乘进权重、保护对输出影响大的“重要通道”,校准集小、无需反向传播,比 GPTQ 更便宜;③ FP8(E4M3): H100/B200 Tensor Core 原生支持,动态范围大、几乎无需校准,是新一代服务默认。显存账本: 7B FP16 ≈ 14GB → INT8 ≈ 7GB → INT4 ≈ 3.5GB;70B 从 ≈ 140GB 压到 ≈ 35GB,可单卡部署。 使用场景: 服务侧把模型压进更少 GPU、同卡并发批更大,降低每 token 成本;面试中 LLM 模块考原理(量化误差/校准),AI_Infra 考落地——vLLM/SGLang 的 GPTQ/AWQ/FP8 后端选型、group size(如 128/32)、批大小与显存核算。 解决的问题: 相比 FP16,INT4 权重显存降 4 倍(14GB → 3.5GB),可驻留的单卡模型规模翻 4 倍,同样显存下并发批更大、服务吞吐近似翻倍;代价是激活离群值与量化噪声带来的精度损失,需校准数据与 AWQ/SmoothQuant 等算法缓解——显存、精度、吞吐构成核心权衡三角,需按延迟预算与质量门禁用实际评估集权衡。

核心要点

  • W8A8 与 W4A16 的区别?为什么激活量化比权重量化难(离群值),SmoothQuant 如何把离群从激活迁移到权重?
  • AWQ 原理: 为什么按激活幅度感知给“重要通道”更大的 scale 能保精度?与 GPTQ 相比为什么校准更便宜(无需反向传播)?
  • FP8 服务侧: E4M3 布局、H100 原生支持;与 INT8 相比动态范围更大、校准需求更小;什么场景仍需要 INT4?
  • 服务落地账: 7B FP16 ≈ 14GB → INT8 ≈ 7GB → INT4 ≈ 3.5GB;同样显存下批大小与吞吐如何变化?group size 128/32 如何影响精度与开销?
  • 显存-精度-吞吐权衡: 训练后量化(PTQ)与量化感知训练(QAT)各自何时选?上线前如何验证量化精度损失在质量门禁内?