CodeQuant2 improves reasoning model speed and accuracy with better quantization

CodeQuant2: Enhanced Outlier Mitigation and Adaptive Clustering for Low-Precision LRMs

Computation and Language

Summary

Large reasoning AI models become slower and less efficient when using low-precision math, which reduces their accuracy. The authors noticed that early steps in the model’s thinking process cause big changes in calculations that typical methods miss. They created CodeQuant2, a new way to carefully group and adjust the model’s numbers, making low-precision models more accurate without slowing them down. Their method also uses a custom software kernel to speed up the process, giving better results on reasoning tasks while running almost three times faster than previous methods.

What this means in practice

  • For machine learning engineers: Deploy large reasoning models efficiently by reducing inference time and improving accuracy with adaptive low-precision quantization techniques.
  • For hardware accelerator designers: Optimize custom hardware for reasoning tasks by incorporating quantization methods that handle activation outliers and adapt codebook sizes per layer.

Authors

Xingyu Liu, Xiangyang Yin, Tianhua Xia, Haiyu Wang, Sai Qian Zhang

Abstract

Large reasoning models (LRMs) improve task performance by generating longer intermediate reasoning traces, but this substantially increases inference costs and makes low-precision quantization increasingly important. However, aggressively quantized models often perform poorly on reasoning tasks. We observe larger activation fluctuations during the first decoding steps of reasoning. Calibration that omits these early states may miss their activation fluctuations. To address these reasoning-specific quantization challenges, we propose \textbf{CodeQuant2}, a clustering-based LUT quantization framework for low-precision large reasoning models. CodeQuant2 mitigates activation outliers with rotation and scaling, uses clustering to represent non-uniform weight distributions, and adapts codebook sizes to the quantization difficulty of each layer. Guided by our observation of reasoning-time activation behavior, CodeQuant2 further improves calibration sample selection to better match actual decoding statistics. Combined with our customized LUT CUDA kernel, CodeQuant2 delivers substantial accuracy improvements on reasoning benchmarks while achieving up to $2.85\times$ speedup over BF16.