输出头量化的Softmax重参数化
研究论文 · 2026/09/28
大型词表使输出头成为小型语言模型的重要推理开销。我们提出 softmax 重参数化,一种在量化前选择功能等价输出头的训练后方法。该方法从每个输出行中减去词表行均值的标量倍数,并针对 RTN、激活加权 MSE 和全 Hessian GPTQ 分别通过验证 KL 选择系数。这一维搜索包含原始头和固定均值中心化,保持全精度 softmax 分布,且不改变训练好的解码器;秩一校正处理如 soft-capping 的非线性 logit 路径。在七个头上,W4 增益集中在基线量化严重扭曲预测之处:在 Phi-4-mini 上,AW-MSE KL 从 0.936 降至 0.256。增益在更强的 GPTQ 校准下依然存在,并与精确逐通道缩放和仿射量化互补。在四个头和三个 W4 量化器上,冻结的 WikiText 选择系数也能迁移到 C4 和 OpenWebMath,在系数不等于 1 的全部 18 次比较中优于均值中心化,在其余六次中与之持平。在 W2(作为压缩压力测试)下,收益扩展到几乎整个模型-量化器矩阵。匹配残差分析表明,保真度提升可伴随更大的 logit 重建误差,同时降低残差的 Fisher 加权代价。对于移位兼容头,重参数化不增加推理操作,并保持打包 W4 执行:在解码器保持 BF16 的情况下,量化 Phi 输出头使批大小为 1 的生成延迟相比 BF16 头基线降低 10.8%。
该工作为小型语言模型输出头量化提供了一种简单、无需训练且不增加推理开销的重参数化方法,在 W4/W2 下显著提升保真度并降低延迟,且与现有量化技术互补,具有实际部署价值。
Large vocabularies make output heads a substantial inference cost in small language models. We propose softmax reparameterization, a post-training method that selects a functionally equivalent output head before quantization. The method subtracts a scalar multiple of the vocabulary-row mean from every output row and selects the coefficient by validation KL separately for RTN, activation-weighted MSE, and full-Hessian GPTQ. This one-dimensional search includes the original head and fixed mean-centering, preserves the full-precision softmax distribution, and leaves the trained decoder unchanged; a rank-one correction handles nonlinear logit paths such as soft-capping. Across seven heads, W4 gains concentrate where baseline quantization substantially distorts predictions: on Phi-4-mini, AW-MSE KL falls from 0.936 to 0.256. The gains survive stronger GPTQ calibration and remain complementary to exact per-channel scaling and affine quantization. Across four heads and three W4 quantizers, frozen WikiText-selected coefficients also transfer to C4 and OpenWebMath, outperforming mean-centering in all 18 comparisons where the frozen coefficient differs from 1 and matching it in the remaining six. At W2, used as a compression stress test, benefits broaden across nearly the full model--quantizer matrix. Matched residual analysis shows that improved fidelity can accompany greater logit reconstruction error while reducing the residual's Fisher-weighted cost. For shift-compatible heads, reparameterization adds no inference operation and preserves packed W4 execution: with the decoder held in BF16, quantizing the Phi output head reduces batch-one generation latency by 10.8% relative to the BF16-head baseline.