arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.05483cs.CLcs.LG
收藏

只需阅读两次:弥补循环语言模型的回忆差距

Just read twice: closing the recall gap for recurrent language models

Simran Arora, Aman Timalsina, Aaryan Singhal, Benjamin Spector, Sabri Eyuboglu, Xinyi Zhao, Ashish Rao, Atri Rudra, Christopher Ré

AI总结:

本文针对循环大语言模型长上下文回忆受数据顺序影响的问题,将其归结为集合不相交性问题,并提出 JRT-Prompt 与 JRT-RNN,显著提升 ICL 质量和预填充吞吐量。

摘要:

在语言建模困惑度上可与 Transformers 竞争的循环大语言模型正快速涌现(例如 Mamba、RWKV)。令人兴奋的是,这些架构在推理期间使用恒定大小的内存。然而,由于内存有限,循环 LM 无法回忆并使用长上下文中的所有信息,导致上下文学习(ICL)质量脆弱。高效 LM 的一个关键挑战是选择哪些信息应存储、哪些应丢弃。在本工作中,我们观察到信息呈现给 LM 的顺序会影响选择难度。为将其形式化,我们表明信息回忆的难度可归结为一个称为集合不相交性(set disjointness,SD)的问题的难度;SD 是通信复杂性中的典型问题,要求流式算法(例如循环模型)判断输入的多个集合是否不相交。我们从经验和理论上表明,求解 SD 所需的循环内存会随集合顺序而变化,即较小集合是否在上下文中先出现。我们的分析表明,为缓解对数据顺序的依赖,可以在上下文中将信息按正确顺序排列,或者以非因果方式处理提示。为此,我们提出:(1)JRT-Prompt,其中上下文在提示中被重复多次,从而有效地向模型展示所有数据顺序。在 16 个循环 LM 和 6 个 ICL 任务上平均,这带来 11.0 ± 1.3 分的提升;在生成长度 32k、批量大小 16、NVidia H100 上,其生成预填充吞吐量比 FlashAttention-2 高 11.9 倍。随后我们提出(2)JRT-RNN,它使用非因果前缀线性注意力来处理提示,并在各任务平均上,在 360M 参数、30B token 时达到 Transformer 质量的 99%,在 1.3B 参数、50B token 时达到 96%,同时预填充吞吐量比 FA2 高 19.2 倍。

英文摘要:

Recurrent large language models that compete with Transformers in language modeling perplexity are emerging at a rapid rate (e.g., Mamba, RWKV). Excitingly, these architectures use a constant amount of memory during inference. However, due to the limited memory, recurrent LMs cannot recall and use all the information in long contexts leading to brittle in-context learning (ICL) quality. A key challenge for efficient LMs is selecting what information to store versus discard. In this work, we observe the order in which information is shown to the LM impacts the selection difficulty. To formalize this, we show that the hardness of information recall reduces to the hardness of a problem called set disjointness (SD), a quintessential problem in communication complexity that requires a streaming algorithm (e.g., recurrent model) to decide whether inputted sets are disjoint. We empirically and theoretically show that the recurrent memory required to solve SD changes with set order, i.e., whether the smaller set appears first in-context. Our analysis suggests, to mitigate the reliance on data order, we can put information in the right order in-context or process prompts non-causally. Towards that end, we propose: (1) JRT-Prompt, where context gets repeated multiple times in the prompt, effectively showing the model all data orders. This gives $11.0 \pm 1.3$ points of improvement, averaged across $16$ recurrent LMs and the $6$ ICL tasks, with $11.9\times$ higher throughput than FlashAttention-2 for generation prefill (length $32$k, batch size $16$, NVidia H100). We then propose (2) JRT-RNN, which uses non-causal prefix-linear-attention to process prompts and provides $99\%$ of Transformer quality at $360$M params., $30$B tokens and $96\%$ at $1.3$B params., $50$B tokens on average across the tasks, with $19.2\times$ higher throughput for prefill than FA2.

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

↑