Low-bit attention, such as SageAttention, has emerged as an effective approach for accelerating model inference, but its applicability to training remains poorly understood. In prior work, we introduced SageBwd, a trainable INT8 attention that quantizes six of seven attention matrix multiplications while preserving fine-tuning performance. However, SageBwd exhibited a persistent performance gap to full-precision attention (FPA) during pre-training. In this work, we investigate why this gap occurs and demonstrate that SageBwd matches full-precision attention during pretraining. Through experiments and theoretical analysis, we reach a few important insights and conclusions: (i) QK-norm is necessary for stable training at large tokens per step, (ii) quantization errors primarily arise from the backward-pass score gradient dS, (iii) reducing tokens per step enables SageBwd to match FPA performance in pre-training, and (iv) K-smoothing remains essential for training stability, while Q-smoothing provides limited benefit during pre-training.
翻译:低比特注意力(如SageAttention)已成为加速模型推理的有效方法,但其在训练中的适用性仍鲜为人知。在先前工作中,我们提出了SageBwd,一种可训练的INT8注意力机制,它在量化七个注意力矩阵乘法中的六个的同时保持了微调性能。然而,SageBwd在预训练阶段始终存在与全精度注意力(FPA)的性能差距。本研究探讨了这一差距产生的原因,并证明SageBwd在预训练中能够匹配全精度注意力的性能。通过实验与理论分析,我们得出了若干重要见解与结论:(i)QK归一化对于大每步令牌数下的稳定训练是必要的;(ii)量化误差主要源于反向传播中的分数梯度dS;(iii)减少每步令牌数可使SageBwd在预训练中匹配FPA性能;(iv)K平滑对训练稳定性仍至关重要,而Q平滑在预训练中带来的收益有限。