arXiv:2505.22107cs.CLcs.LG2025-05ICML被引 7

提出动态分组注意力,高效处理长文本中的冗余计算问题。

Curse of High Dimensionality Issue in Transformer for Long-context Modeling

  • 将序列建模转为监督学习,揭示注意力稀疏性
  • 仅少数关键词影响预测,计算可大幅精简
  • 适合需要长文本处理的模型优化场景

基于Transformer的大语言模型通过自注意力机制捕捉长程依赖,在自然语言处理中表现优异。然而,长上下文建模面临显著的计算效率问题:尽管注意力权重通常稀疏,所有词元仍消耗相等的计算资源。本文将传统概率序列建模重新表述为监督学习任务,实现相关与无关词元的分离,更清晰地揭示冗余性。理论分析表明,仅少数词元对预测有显著贡献。基于此,我们将注意力优化建模为线性编码问题,提出分组编码策略,理论上证明其具备更强抗随机噪声能力并提升学习效率。受此启发,提出动态分组注意力(DGA),利用分组编码在注意力计算中显式聚合不重要词元,减少冗余。实验表明,DGA显著降低计算成本,同时保持竞争力。代码已开源:https://github.com/bolixinyu/DynamicGroupAttention。

原文摘要 · Abstract (English)

Transformer-based large language models (LLMs) excel in natural language processing tasks by capturing long-range dependencies through self-attention mechanisms. However, long-context modeling faces significant computational inefficiencies due to \textit{redundant} attention computations: while attention weights are often \textit{sparse}, all tokens consume \textit{equal} computational resources. In this paper, we reformulate traditional probabilistic sequence modeling as a \textit{supervised learning task}, enabling the separation of relevant and irrelevant tokens and providing a clearer understanding of redundancy. Based on this reformulation, we theoretically analyze attention sparsity, revealing that only a few tokens significantly contribute to predictions. Building on this, we formulate attention optimization as a linear coding problem and propose a \textit{group coding strategy}, theoretically showing its ability to improve robustness against random noise and enhance learning efficiency. Motivated by this, we propose \textit{Dynamic Group Attention} (DGA), which leverages the group coding to explicitly reduce redundancy by aggregating less important tokens during attention computation. Empirical results show that our DGA significantly reduces computational costs while maintaining competitive performance.Code is available at https://github.com/bolixinyu/DynamicGroupAttention.

Transformer长文本建模注意力优化

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