arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.14477cs.CL
收藏

解放上下文长度:一种通过查询-键压缩实现的高效选择性注意力方法

Unshackling Context Length: An Efficient Selective Attention Approach through Query-Key Compression

Huawei CBG(华为消费者业务集团)

Haoyu Wang, Tong Teng, Tianyu Guo, An Xiao, Duyu Tang, Hanting Chen, Yunhe Wang

AI总结:

针对长上下文 LLM 的 token 选择信息丢失问题,本文提出 ESA,通过压缩 query-key 向量实现 token 级高效选择,并在最高 256k 基准上达到优于同类方法、可比甚至超过全注意力外推的效果。

摘要:

高效处理长上下文序列仍是大型语言模型(LLM)面临的一项重大挑战。序列外推中现有的 token 选择方法要么采用永久驱逐策略,要么按块选择 token,这可能导致关键信息丢失。我们提出 Efficient Selective Attention(ESA,高效选择性注意力),这是一种通过在 token 级别高效选择最关键的 token 来计算注意力,从而扩展上下文长度的新方法。ESA 通过将 query 和 key 向量压缩为低维表示,降低了 token 选择的计算复杂度。我们使用上下文长度为 8k 和 32k 的开源 LLM,在最大长度达 256k 的长序列基准上评估 ESA。ESA 优于其他选择性注意力方法,尤其是在需要检索多条信息的任务中;其在各类任务上取得与全注意力外推方法相当的性能,并在某些任务上取得更优结果。

英文摘要:

Handling long-context sequences efficiently remains a significant challenge in large language models (LLMs). Existing methods for token selection in sequence extrapolation either employ a permanent eviction strategy or select tokens by chunk, which may lead to the loss of critical information. We propose Efficient Selective Attention (ESA), a novel approach that extends context length by efficiently selecting the most critical tokens at the token level to compute attention. ESA reduces the computational complexity of token selection by compressing query and key vectors into lower-dimensional representations. We evaluate ESA on long sequence benchmarks with maximum lengths up to 256k using open-source LLMs with context lengths of 8k and 32k. ESA outperforms other selective attention methods, especially in tasks requiring the retrieval of multiple pieces of information, achieving comparable performance to full-attention extrapolation methods across various tasks, with superior results in certain tasks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑