提出一种高效长文本建模注意力机制,自动提炼核心信息减少冗余。
Core Context Aware Transformers for Long Context Language Modeling
- 通过动态分组压缩生成核心令牌,聚焦关键上下文
- 在128K上下文长度下保持性能且计算开销更低
- 可直接替换现有模型注意力模块,适配性强
基于Transformer的大语言模型在众多任务中表现优异,主要归功于自注意力机制,该机制要求每个标记考虑所有前置标记作为上下文。然而当上下文长度L极大(如128K)时,上下文中的冗余信息显著增加,不仅影响建模效果,还带来不必要的计算与存储开销。本文提出一种即插即用的核上下文感知(CCA)注意力机制,包含两个互补模块:1)全局感知池化模块将输入标记分组,并根据其重要性动态压缩为一个核心标记,从而在学习过程中自动聚焦并强化核心上下文,同时抑制冗余;2)局部保留模块引入邻近标记以保持局部上下文细节表示。值得注意的是,我们的CCA-Attention可直接替换现有LLM中的自注意力模块,仅需极低微调成本。大量实验表明,该方法在长上下文建模和计算效率方面均优于当前最先进方法。
原文摘要 · Abstract (English)
Transformer-based Large Language Models (LLMs) have exhibited remarkable success in extensive tasks primarily attributed to self-attention mechanism, which requires a token to consider all preceding tokens as its context to compute attention. However, when the context length L becomes very large (e.g., 128K), the amount of potentially redundant information in the context tends to increase. The redundant context not only hampers the modeling representation performance but also incurs unnecessary computational and storage overhead. In this paper, we propose a plug-and-play Core Context Aware (CCA) Attention for efficient long-context modeling, comprising two complementary modules: 1) Globality-aware pooling module groups input tokens and dynamically compresses each group into one core token based on their significance. In this way, our method automatically focuses and strengthens core context while diminishing redundancy during the learning process, leading to effective long-term dependency modeling. 2) Locality-preserving module incorporates neighboring tokens to preserve local context for detailed representation. Notably, our CCA-Attention is able to replace the self-attention module in existing LLMs with minimal fine-tuning cost. Extensive experimental results show the superiority of our method in both long-context modeling and computational efficiency over state-of-the-art methods.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。