arXiv:2410.05258cs.CLcs.LG2024-10ICLR被引 1

通过相减机制增强相关注意力,减少无关信息干扰。

Differential Transformer

  • 用两个softmax结果相减生成注意力,抑制噪声。
  • 在长文本建模和幻觉抑制上优于传统Transformer。
  • 适合需要精准定位关键信息的场景,如问答与摘要。

Transformer模型容易过度关注无关上下文。本文提出Diff Transformer,通过差分注意力机制计算注意力分数:即两个独立softmax注意力图的差值。该相减操作有效消除噪声,促进稀疏注意力模式的出现。在语言建模任务中,无论模型规模或训练数据量如何扩大,Diff Transformer均优于标准Transformer。更令人关注的是,其在实际应用中表现突出:在长上下文建模、关键信息检索、幻觉缓解、上下文学习及激活异常值减少方面均有显著优势。由于较少受无关上下文干扰,该模型在问答与文本摘要中能有效降低幻觉。在上下文学习中,不仅提升准确率,还对输入顺序变化更具鲁棒性,解决了长期存在的顺序敏感问题。实验表明,Diff Transformer是推进大语言模型发展的高效且有前景的架构。

原文摘要 · Abstract (English)

Transformer tends to overallocate attention to irrelevant context. In this work, we introduce Diff Transformer, which amplifies attention to the relevant context while canceling noise. Specifically, the differential attention mechanism calculates attention scores as the difference between two separate softmax attention maps. The subtraction cancels noise, promoting the emergence of sparse attention patterns. Experimental results on language modeling show that Diff Transformer outperforms Transformer in various settings of scaling up model size and training tokens. More intriguingly, it offers notable advantages in practical applications, such as long-context modeling, key information retrieval, hallucination mitigation, in-context learning, and reduction of activation outliers. By being less distracted by irrelevant context, Diff Transformer can mitigate hallucination in question answering and text summarization. For in-context learning, Diff Transformer not only enhances accuracy but is also more robust to order permutation, which was considered as a chronic robustness issue. The results position Diff Transformer as a highly effective and promising architecture to advance large language models.

注意力机制幻觉抑制长文本建模

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