移除残差连接可让Transformer更适配低比特量化,提升压缩效率。
The Quantization Benefits of Residual-Free Transformers

- 通过移除残差连接,使激活值更接近高斯分布,降低量化误差。
- 残差自由模型在8比特量化下仍保持90%以上精度,优于传统模型。
- 适合需要高效部署的场景,如边缘设备或大规模推理服务。
大规模Transformer训练与部署受加速器间激活、梯度和优化器状态传输的制约。低比特量化提供自然解决方案,但变压器激活值常呈重尾分布且受异常值主导,导致简单量化损失严重。我们发现这一难题不仅源于量化器,也源于架构设计。具体而言,残差连接会令训练中激活值偏离高斯分布。通过对比带残差与无残差的Transformer,我们证明该效应导致残差模型在低精度下量化误差与精度下降更显著。通过过量峰度分析,我们揭示残差混合会放大非高斯性,而无残差模型中的密集混合则抑制非高斯性。随后我们展示,借助正交初始化、谱或二阶优化及深度感知注意力温度缩放,残差自由模型可实现可训练性。在语言任务中,全精度性能略有下降,但模型保持近高斯激活,并显著提升对低比特量化的鲁棒性。研究揭示了模型设计中精度与可压缩性间的权衡,推动面向量化的架构级基础模型设计。
原文摘要 · Abstract (English)
Large-scale transformer training and deployment are increasingly constrained by the transfer of activations, gradients, and optimizer states across accelerators. Low-bit quantization offers a natural remedy, but transformer activations are often heavy-tailed and outlier-dominated, making simple quantization highly lossy. We show that this difficulty is not only a property of the quantizer, but also of the architecture. Specifically, residual connections can drive transformer activations away from Gaussianity during training. Using controlled comparisons between residual and residual-free transformers, we demonstrate that this effect leads to substantially higher quantization error and accuracy degradation at low precision in residual models. We explain the phenomenon through an excess kurtosis analysis, showing that residual mixing can amplify non-Gaussianity, whereas dense mixing in residual-free contracts non-Gaussianity. We then show that residual-free transformers can be made trainable using orthogonal initialization, spectral or second-order optimization, and depth-aware scaling of attention temperature. In language tasks, while there is a small drop in full precision performance, these models retain near-Gaussian activations and exhibit significantly improved robustness to low-bit quantization. Our results identify an accuracy--compressibility trade-off in transformer design and motivate architecture-level approaches to quantization-friendly foundation models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。