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

LLoCO:离线学习长上下文

LLoCO: Learning Long Contexts Offline

UC Berkeley(加州大学伯克利分校)

Sijun Tan, Xiuyu Li, Shishir Patil, Ziyang Wu, Tianjun Zhang, Kurt Keutzer, Joseph E. Gonzalez, Raluca Ada Popa

AI总结:

LLoCO通过上下文压缩与LoRA域内微调离线学习长上下文,将4k token的LLaMA2-7B扩展至128k token,以30倍更少token实现7.62倍推理加速和11.52倍微调吞吐提升。

摘要:

由于自注意力机制的二次计算和内存开销以及生成过程中庞大的KV缓存规模,处理长上下文仍然是大语言模型(LLMs)面临的一项挑战。我们提出LLoCO,一种通过上下文压缩和基于LoRA的域内参数高效微调来离线学习上下文的新方法。我们的方法使大语言模型能够创建原始上下文的简洁表示,并高效地检索相关信息以准确回答问题。我们的方法将4k token的LLaMA2-7B模型的有效上下文窗口扩展到可处理多达128k token。我们在多个长上下文问答数据集上评估了我们的方法,证明LLoCO显著优于上下文学习,同时在推理过程中使用的token数量减少了30倍。LLoCO在推理过程中实现了高达7.62倍的加速,在微调过程中实现了11.52倍更高的吞吐量,大幅降低了长文档问答的成本。这使其成为高效长上下文处理的一个有前景的解决方案。我们的代码已在https://github.com/jeffreysijuntan/lloco上公开。

英文摘要:

Processing long contexts remains a challenge for large language models (LLMs) due to the quadratic computational and memory overhead of the self-attention mechanism and the substantial KV cache sizes during generation. We propose LLoCO, a novel approach to address this problem by learning contexts offline through context compression and in-domain parameter-efficient finetuning with LoRA. Our method enables an LLM to create a concise representation of the original context and efficiently retrieve relevant information to answer questions accurately. Our approach extends the effective context window of a 4k token LLaMA2-7B model to handle up to 128k tokens. We evaluate our approach on several long-context question-answering datasets, demonstrating that LLoCO significantly outperforms in-context learning while using $30\times$ fewer tokens during inference. LLoCO achieves up to $7.62\times$ speed-up during inference and $11.52\times$ higher throughput during finetuning, substantially reduces the cost of long document question answering. This makes it a promising solution for efficient long context processing. Our code is publicly available on https://github.com/jeffreysijuntan/lloco.

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

↑