arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2404.10308cs.LGcs.AI
收藏

分层上下文合并:改善预训练 LLM 的长上下文理解

Hierarchical Context Merging: Better Long Context Understanding for Pre-trained LLMs

KAIST(韩国科学技术院);University of Michigan(密歇根大学);Carnegie Mellon University(卡内基梅隆大学);Hanyang University ERICA(汉阳大学ERICA校区);Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学);NAVER(NAVER(韩国网络公司))

Woomin Song, Seunghyuk Oh, Sangwoo Mo, Jaehyung Kim, Sukmin Yun, Jung-Woo Ha, Jinwoo Shin

AI总结:

本文提出免训练的 HOMER 分层上下文合并方法,通过分块、层级合并、token 约减和对数内存计算顺序,提升预训练 LLM 的长上下文理解与内存效率。

摘要:

大型语言模型(LLM)已在各类自然语言处理任务中展现出卓越性能。然而,它们面临的一个主要限制是上下文长度限制,即其能够处理的最大 token 数。以往工作已探索通过架构调整和位置编码修改来放宽该限制,但这些方法通常需要昂贵的训练,或未能解决自注意力的计算需求问题。本文提出 Hierarchical cOntext MERging(HOMER),这是一种旨在克服上述限制的新型免训练方案。HOMER 采用分治算法,将长输入划分为可管理的块。随后,每个块通过分层策略被集中处理,该策略在递进的 transformer 层中合并相邻块。每次合并之前都会使用一种 token 约减技术,以确保内存使用效率。我们还提出一种优化的计算顺序,将内存需求降低为随输入长度呈对数级扩展,使其尤其适用于内存限制严格的环境。实验证明,所提方法具有优越性能和内存效率,可推动 LLM 在需要扩展上下文的场景中更广泛使用。代码位于 https://github.com/alinlab/HOMER。

英文摘要:

Large language models (LLMs) have shown remarkable performance in various natural language processing tasks. However, a primary constraint they face is the context limit, i.e., the maximum number of tokens they can process. Previous works have explored architectural changes and modifications in positional encoding to relax the constraint, but they often require expensive training or do not address the computational demands of self-attention. In this paper, we present Hierarchical cOntext MERging (HOMER), a new training-free scheme designed to overcome the limitations. HOMER uses a divide-and-conquer algorithm, dividing long inputs into manageable chunks. Each chunk is then processed collectively, employing a hierarchical strategy that merges adjacent chunks at progressive transformer layers. A token reduction technique precedes each merging, ensuring memory usage efficiency. We also propose an optimized computational order reducing the memory requirement to logarithmically scale with respect to input length, making it especially favorable for environments with tight memory restrictions. Our experiments demonstrate the proposed method's superior performance and memory efficiency, enabling the broader use of LLMs in contexts requiring extended context. Code is available at https://github.com/alinlab/HOMER.

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

↑