arXiv:2410.19318cs.CLcs.AI2024-10被引 2

用双模型压缩与检索扩展上下文窗口,成本更低效果更好。

Two are better than one: Context window extension with multi-grained self-injection

  • 用两个短上下文模型构成压缩-解码结构,只在底层传递信息。
  • 通过树状结构快速检索多粒度上下文,支持长文本理解。
  • 适合资源有限但需长文本处理的场景,如文档分析。

当前大语言模型的上下文窗口受限,严重制约其广泛应用。尽管持续预训练可有效扩展上下文,但数据获取与计算成本高昂。为此,我们提出SharedLLM,基于多粒度上下文压缩与查询感知信息检索的设计理念。该方法由两个短上下文模型(如LLaMA-2)组成:下层模型作为压缩器,上层模型作为解码器。上层接收来自下层的多粒度压缩上下文信息,并对运行文本进行上下文感知建模。信息仅在最低层传递,避免下层长前向路径和上层冗余交叉注意力模块。基于此架构,我们设计了一种树状数据结构,高效编码、存储与检索文本块的多粒度上下文信息。结合搜索算法,可根据输入查询快速从不同层级中提取相关信息。整个过程因发送方与接收方源自同一模型层,称为自注入(self-injection)。

原文摘要 · Abstract (English)

The limited context window of contemporary large language models (LLMs) remains a huge barrier to their broader application across various domains. While continual pre-training on long-context data is a straightforward and effective solution, it incurs substantial costs in terms of data acquisition and computational resources. To alleviate this issue, we propose SharedLLM, a novel approach grounded in the design philosophy of multi-grained context compression and query-aware information retrieval. SharedLLM is composed of two short-context LLMs such as LLaMA-2, termed upper model and lower model. The lower model functions as a compressor while the upper model acts as a decoder. The upper model receives compressed, multi-grained context information from the lower model and performs context-aware modeling on the running text. Information transfer between the compressor and decoder occurs only at the lowest layers to refrain from long forward paths in the lower model and redundant cross-attention modules in the upper model. Based on this architecture, we introduce a specialized tree-style data structure to efficiently encode, store and retrieve multi-grained contextual information for text chunks. This structure, combined with a search algorithm, enables rapid encoding and retrieval of relevant information from various levels of the tree based on the input query. This entire process, wherein the sender and receiver are derived from the same LLM layer, is referred to as self-injection.

上下文扩展双模型自注入长文本

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