TL;DR
Post-training quantization (PTQ) enables low-cost inference by compressing LLMs using a small calibration dataset, but how does the choice of calibration data impact generalization? Across 40+ datasets and multiple LLM families, this work reveals a surprising result: calibrating models with in-distribution, task-matched data offers virtually no performance benefit over using unrelated, out-of-distribution text. Alongside these findings, the authors introduce MI-optimize, a modular, extensible toolbox for benchmarking and combining modern LLM quantization algorithms.
What Problem Does This Paper Address?
While post-training quantization (PTQ) can shrink large models down to 4, 3, or 2 bits without retraining, performance often degrades at lower bit-widths. Standard PTQ methods rely on a small set of "calibration data" (typically around 128 samples from generic pre-training corpuses like C4) to minimize rounding error.
In practical applications, practitioners often wonder: Should we calibrate our quantizer on data tailored to the target downstream task? While conventional machine learning dogma holds that in-distribution (I.I.D.) training data outperforms out-of-distribution (OOD) data, the impact of calibration data distributions on the generalization ability of quantized LLMs has remained largely unstudied.
Methods
The authors systematically investigate generalization under two paradigms:
- Standard Evaluation (S1): Measuring general capability degradation using standard calibration data (C4) across 26 common NLP benchmarks.
- Domain-Shift Evaluation (S2): Altering the calibration data distribution to test cross-dataset and cross-subject shifts:
- Cross-dataset: Calibrating on one dataset and evaluating on another within the same NLP task (e.g., calibrating on SQuAD and testing on NewsQA).
- Cross-subject: Calibrating on one academic discipline and evaluating on another (e.g., calibrating on STEM and evaluating on Humanities).
Experiments evaluate four leading PTQ techniques—GPTQ, AWQ, SpQR, and SmoothQuant—across weight precisions from 4-bit down to 2-bit (with 8-bit activation quantization for SmoothQuant) on LLaMA-2 (7B, 13B), LLaMA-3 (8B), and Baichuan2-7B.
To unify this pipeline, they introduce MI-optimize, a modular framework decoupling model loading, dataset handling, quantization algorithms (allowing mixed-layer techniques), and inference engines (vLLM, TensorRT).
Datasets
The benchmark evaluates over 40 datasets:
- S1 (26 datasets across 9 task categories): Common sense reasoning (WinoGrande, HellaSwag, PIQA, SWAG, WSC273, WNLI), math (MathQA), multi-turn dialogue (MuTual, MuTual_plus), bias evaluation (CrowS-Pairs, Toxigen), scientific QA (PubMedQA, OpenBookQA, SciQ, ARC-Easy, ARC-Challenge, MC-TACO), reading comprehension (RACE, QA4MRE), NLI (MNLI, RTE, QNLI, ANLI), sentiment (SST-2), and syntax (BLiMP).
- S2 English (BOSS Benchmark): 16 datasets covering Extractive QA (SQuAD, AdversarialQA, NewsQA, SearchQA), Sentiment Analysis (Amazon, DynaSent, SemEval, SST), NLI (MNLI, ANLI, ContractNLI, WANLI), and Toxicity Detection (Civil Comments, AdvCivil, Implicit Hate, ToxiGen).
- S2 Chinese (C-EVAL & CMMLU): Spanning Humanities, Social Sciences, and STEM disciplines for cross-dataset and cross-subject evaluations.
Key Insights and Ideas
- Task-aligned calibration does not yield better models: Calibrating on I.I.D. data does not reliably outperform calibrating on OOD data. The win rate of I.I.D. calibration over OOD calibration hover around random chance across all tasks.
- Why this happens: Unlike fine-tuning, PTQ does not specialize a model to a domain; its mathematical objective is simply to reconstruct unquantized weight activations and preserve generic representation geometry. Thus, the quantizer only needs representative, high-entropy token activations, not domain-specific semantics.
- Asymmetric task sensitivity: Tasks requiring multi-step precision (scientific knowledge QA, math, reading comprehension) are brittle to quantization. In contrast, classification tasks like natural language inference (NLI) remain remarkably robust even under aggressive bit reduction.
- Outlier preservation matters at low bits: At 2 bits, standard GPTQ experiences near-total catastrophic collapse on reasoning benchmarks, whereas SpQR maintains usable accuracy by isolating outlier weights in higher precision.
Key Results
- I.I.D. vs. OOD Win Rates: When comparing I.I.D. calibration sets directly against OOD calibration sets, the I.I.D. win rate was only 0.45 on English cross-dataset tasks (BOSS), 0.61 on Chinese cross-dataset tasks, and 0.43 on Chinese cross-subject tasks.
- Bit-width Thresholds: Across S1 benchmarks, 4-bit and 3-bit models retain most full-precision performance (often within 1–3% of FP16). At 2-bit, performance drops drastically: GPTQ 2-bit drops 0-shot accuracy by 40.60% on scientific QA and 34.81% on reading comprehension.
- Toolbox Mixed-Method Quantization: Using MI-optimize to combine SmoothQuant (for activations) with GPTQ (for weights) lowered 3/8-bit perplexity on WikiText-2 from 24,041.06 (SmoothQuant alone) down to 290.77 (SmoothQuant + GPTQ).
Limitations and Future Work
- Extremely low bit-widths: At 2-bit precision without outlier retention, many models degrade to near-zero accuracy on zero-shot tasks, making fine-grained distribution shift comparisons impossible in that regime.
- Model Scale Coverage: The study focuses heavily on 7B–13B parameters; exploring whether massive models (70B+) exhibit different calibration data sensitivities remains for future work.
- Expanding Tooling: The authors note that the MI-optimize toolbox, while extensible, does not yet support every emerging quantization algorithm or model architecture family.
Summary updated