SageBwd: 一种可训练的低比特注意力
SageBwd: A Trainable Low-bit Attention
AI总结:
SageBwd通过降低比特数实现高效的注意力机制,通过理论分析和实验发现QK-范数和K-平滑对训练稳定性至关重要,从而在预训练中实现与全精度注意力的性能匹配。
摘要:
低比特注意力,如SageAttention,已作为一种加速模型推理的有效方法出现,但其在训练中的适用性仍不明确。在先前的工作中,我们引入了SageBwd,一种可训练的INT8注意力,它在量化六个七的注意力矩阵乘法的同时,保持了微调性能。然而,SageBwd在预训练过程中始终存在与全精度注意力(FPA)的性能差距。在本工作中,我们研究了这种差距出现的原因,并展示了SageBwd在预训练过程中可以匹配全精度注意力。通过实验和理论分析,我们得出了一些重要的见解和结论:(i)QK-范数对于在每步大量token下的稳定训练是必要的;(ii)量化误差主要来自反向传播得分梯度dS;(iii)减少每步token数量使SageBwd在预训练中能够匹配FPA性能;(iv)K-平滑对于训练稳定性至关重要,而Q-平滑在预训练中提供有限的好处。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。