arXiv:2510.11602cs.CLcs.LG2025-10被引 1

拆解注意力机制,发现核心是跨位置信息混合。

Deconstructing Attention: Investigating Design Principles for Effective Language Modeling

  • 通过可控变体实验,逐一测试注意力的四大设计原则。
  • 去掉信息混合功能后模型近乎随机,其他部分可大幅简化。
  • 不同注意力形式交替使用能协同提升性能,适合轻量化模型设计。

Transformer语言模型的成功普遍归功于点积注意力机制,其包含四个关键设计原则:跨位置信息混合(实现多标记交互)、序列依赖激活(注意力权重随输入动态调整)、特定数学形式(点积相似度加softmax加权)以及查询与键耦合到演化隐藏状态(将注意力锚定在当前层)。然而这些原则的必要性尚未被系统验证。本文通过设计受控变体,选择性放松这些原则,在所有层统一应用或构建混合架构(仅部分层保留标准注意力),进行实证分析。结果表明,跨位置信息混合机制不可或缺,其缺失会导致模型退化为近似随机行为;而数学形式和序列依赖性可显著放宽,尤其当它们在部分层中保留时表现仍佳。令人惊讶的是,孤立无效的变体在与标准注意力交替使用时反而取得稳健性能,揭示出协同效应。研究深化了对注意力有效性的理解,并为简化语言模型提供了新路径。

原文摘要 · Abstract (English)

The success of Transformer language models is widely credited to their dot-product attention mechanism, which interweaves a set of key design principles: mixing information across positions (enabling multi-token interactions), sequence-dependent activations (where attention weights adapt to each input), a specific mathematical form (dot-product similarities plus softmax weighting), and coupling of queries and keys to evolving hidden states (grounding attention in the current layer). However, the necessity of each of these principles remains largely untested. In this work, we systematically deconstruct attention by designing controlled variants that selectively relax these principles, applied both uniformly across all layers and in hybrid architectures where only some layers retain standard attention. Our empirical analysis reveals that mechanisms for mixing tokens are indispensable, as their absence collapses models to near-random behavior, while the exact mathematical form and sequence dependency can be substantially relaxed, especially when preserved in just a subset of layers. Surprisingly, even variants that fail in isolation can achieve robust performance when interleaved with standard attention, highlighting a cooperative effect. These findings deepen our understanding of what truly underpins attention's effectiveness and open new avenues for simplifying language models without sacrificing performance.

注意力机制语言模型模型简化

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