arXiv:2602.23057cs.CLcs.AI2026-02被引 1

改进Transformer注意力,让模型更灵活稳定地控制关注强度。

Affine-Scaled Attention: Towards Flexible and Stable Transformer Attention

  • 引入可学习的缩放与偏置,放松软最大值归一化约束。
  • 在多规模语言模型预训练中提升训练稳定性与下游表现。
  • 适合追求模型训练稳定性和注意力可控性的研究者。

Transformer注意力通常使用软最大值归一化,强制注意力权重和为1。尽管在许多场景下有效,但这一约束限制了对注意力幅度的灵活控制,可能导致训练中注意力过于集中或不稳定。已有工作尝试注意力下沉或门控机制,但控制能力有限。本文提出仿射缩放注意力(Affine-Scaled Attention),在标准注意力基础上引入输入相关的缩放因子和偏置项,作用于已归一化的注意力权重。该设计放宽了严格归一化约束,同时保持值表示的聚合性,使模型能以受控方式调整注意力的相对分布与整体尺度。我们在多种模型规模的大规模语言模型预训练中进行实验,结果表明,相比标准软最大值注意力和注意力下沉基线,该方法在训练稳定性、优化行为及下游任务性能上均有持续提升。这表明,对注意力输出进行适度重加权是改善Transformer注意力行为的一种实用且有效的方式。

原文摘要 · Abstract (English)

Transformer attention is typically implemented using softmax normalization, which enforces attention weights with unit sum normalization. While effective in many settings, this constraint can limit flexibility in controlling attention magnitudes and may contribute to overly concentrated or unstable attention patterns during training. Prior work has explored modifications such as attention sinks or gating mechanisms, but these approaches provide only limited or indirect control over attention reweighting. We propose Affine-Scaled Attention, a simple extension to standard attention that introduces input-dependent scaling and a corresponding bias term applied to softmax-normalized attention weights. This design relaxes the strict normalization constraint while maintaining aggregation of value representations, allowing the model to adjust both the relative distribution and the scale of attention in a controlled manner. We empirically evaluate Affine-Scaled Attention in large-scale language model pretraining across multiple model sizes. Experimental results show consistent improvements in training stability, optimization behavior, and downstream task performance compared to standard softmax attention and attention sink baselines. These findings suggest that modest reweighting of attention outputs provides a practical and effective way to improve attention behavior in Transformer models.

Transformer注意力机制训练稳定模型优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。