LLM Inference Quantization
이 경로는 기존 Numerical Precision and Quantization path 이후에 보는 실전 양자화 경로입니다.
기존 path가 FP32, BF16, FP8처럼 “숫자를 어떤 형식으로 표현하는가”를 먼저 다룬다면, 이 path는 LLM inference에서 quantization이 무엇을 줄이고, 어디서 빨라지고, 언제 품질을 잃는지를 다룹니다.
첫 카드는 quantization을 정확도 트릭이 아니라 memory traffic과 KV cache budget을 바꾸는 시스템 레버로 봅니다.
두 번째 카드는 quantization의 실제 문법인 scale, zero-point, rounding, clipping을 다룹니다.
세 번째 카드는 weight, activation, KV cache 중 무엇을 quantize하는지에 따라 이득과 위험이 어떻게 달라지는지 분리합니다. 이 구분을 알아야 이후 granularity, PTQ와 QAT, GPTQ/AWQ/SmoothQuant, quantized GEMM, arithmetic intensity, vLLM serving benchmark를 같은 지도 위에 놓을 수 있습니다.
네 번째 카드는 scale 하나를 tensor, channel, token, group, block 중 어디까지 공유할지 결정하는 granularity를 다룹니다. 같은 INT4라도 group size와 memory layout에 따라 정확도, metadata overhead, kernel 효율이 달라진다는 점을 연결합니다.
다섯 번째 카드는 학습이 끝난 모델을 다시 학습하지 않고 quantize하는 PTQ workflow를 다룹니다. Calibration data로 range를 정한다는 뜻, static과 dynamic quantization의 차이, PTQ와 QAT의 위치 차이를 분리합니다.
여섯 번째 카드는 W4A16 weight-only quantization을 다룹니다. GPTQ는 Hessian으로 rounding error를 보정하고, AWQ는 activation이 큰 channel을 quantize 전에 보호한다는 차이를 비교합니다.
일곱 번째 카드는 activation quantization을 다룹니다. W8A8/FP8이 compute throughput과 연결되는 이유, static/dynamic scaling의 차이, LLM activation outlier를 per-token scale이나 별도 precision path로 다루는 방식을 설명합니다.
여덟 번째 카드는 KV cache quantization을 다룹니다. Long-context serving에서 cache memory가 concurrency를 제한하는 이유와 key/value가 서로 다른 granularity를 필요로 하는 이유를 분리합니다.
아홉 번째 카드는 quantized matmul 실행을 다룹니다. Quantized storage와 quantized execution의 차이, fused dequantization, W4A16과 W8A8/FP8이 arithmetic intensity와 병목에 미치는 영향을 연결합니다.
- Why Quantization Matters — LLM inference에서 quantization을 정확도 트릭이 아니라 memory traffic, energy, KV cache budget을 줄이는 시스템 레버로 이해한다.
- Scale, Zero Point, and Clipping — quantization에서 real value가 integer grid로 들어가고 다시 나오는 과정을 scale, zero-point, rounding, clipping으로 이해한다.
- Weights, Activations, KV Cache Quantization — LLM inference에서 weight, activation, KV cache를 각각 양자화할 때 얻는 이득과 위험이 어떻게 다른지 구분한다.
- Quantization Granularity — quantization에서 scale 하나를 tensor, channel, token, group, block 중 어디까지 공유할지 결정하는 기준을 이해한다.
- Post-Training Quantization and Calibration — 학습이 끝난 모델을 다시 학습하지 않고 quantize할 때 calibration data로 scale을 정하고 검증하는 흐름을 이해한다.
- Weight-Only Quantization: GPTQ and AWQ — W4A16 weight-only quantization에서 GPTQ와 AWQ가 INT4 weight 품질을 보존하는 서로 다른 방식을 이해한다.
- Activation Quantization and Outliers — W8A8과 FP8처럼 activation까지 quantize할 때 compute speedup이 생기는 이유와 activation outlier를 다루는 방법을 이해한다.
- KV Cache Quantization — long-context serving에서 KV cache quantization이 memory capacity, concurrency, attention quality에 어떤 영향을 주는지 이해한다.
- Quantized Matmul and Arithmetic Intensity — quantized weights와 activations가 matmul kernel 안에서 어떻게 dequantize, accumulate, rescale되며 arithmetic intensity에 어떤 영향을 주는지 이해한다.