arXiv:2505.01110cs.CL2025-05被引 2

解决大上下文学习中注意力分散问题,提升模型表现

MateICL: Mitigating Attention Dispersion in Large-Scale In-Context Learning

  • 分窗处理上下文并重校注意力权重,缓解长文本注意力衰减
  • 在32k上下文下性能优于检索基线,无需额外训练检索模型
  • 适用于资源受限场景,尤其适合长上下文任务

大型语言模型在上下文学习(ICL)中表现卓越,但预训练模型的固定位置长度限制了示范样本数量。近期扩展上下文的方法因示范增多导致注意力分散。本文提出MateICL,通过将上下文划分为多个窗口(每个填满模型容量),分别处理后引入额外层重校注意力权重,随示范数增加优先关注查询词。实验表明,MateICL能有效利用更大上下文提升ICL性能。相比基于检索的基线,其在无需外部训练检索模型的情况下持续表现更优。即使在支持32k token上下文的先进推理策略下,MateICL在计算资源受限场景仍具优势。代码已公开于https://github.com/amurtadha/MateICL。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have demonstrated remarkable capabilities in In-Context Learning (ICL). However, the fixed position length constraints in pre-trained models limit the number of demonstration examples. Recent efforts to extend context suffer from attention dispersion as the number of demonstrations increases. In this paper, we introduce Mitigating Attention Dispersion in large-scale ICL (MateICL) that enables LLMs to maintain effective self-attention as the context size grows. We first split the context into multiple windows, each filled to the model's context capacity, which are processed separately. Then, we introduce an additional layer to recalibrate the attention weights, prioritizing the query tokens as the number of demonstrations increases. Our empirical results show that MateICL can effectively leverage larger contexts to improve ICL performance. Compared to retrieval-based baselines, MateICL consistently achieves better performance without requiring an externally trained retrieval model. Despite recent advances in inference strategies (e.g., 32k token contexts), our results demonstrate that MateICL remains beneficial in computationally resource-constrained settings. The code is publicly available at https://github.com/amurtadha/MateICL.

大模型上下文学习注意力机制高效推理

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