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

压缩上下文以提升大型语言模型的推理效率

Compressing Context to Enhance Inference Efficiency of Large Language Models

University of Surrey(萨里大学);University of Manchester(曼彻斯特大学)

Yucheng Li, Bo Dong, Chenghua Lin, Frank Guerin

AI总结:

提出Selective Context方法,通过剪除输入上下文冗余来压缩上下文,在长文档和对话任务中降低50%上下文成本,减少36%内存和32%推理时间,同时保持性能几乎不变。

摘要:

大型语言模型(LLMs)在各种任务上取得了显著性能。然而,它们在处理长文档和扩展对话时面临挑战,原因是计算需求显著增加,包括内存和推理时间,并且当输入超过LLM的固定上下文长度时可能出现上下文截断。本文提出了一种名为Selective Context的方法,通过识别并剪除输入上下文中的冗余部分来使输入更加紧凑,从而提升LLM的推理效率。我们使用需要长上下文处理的常见数据源(包括arXiv论文、新闻文章和长对话)在摘要生成、问答和响应生成任务上测试了我们的方法。实验结果表明,与使用完整上下文相比,Selective Context在保持可比性能的同时显著降低了内存成本并减少了生成延迟。具体来说,我们实现了上下文成本降低50%,导致推理内存使用减少36%,推理时间减少32%,同时在四个下游应用中仅观察到BERTscore下降0.023和忠实度下降0.038,表明我们的方法在效率和性能之间取得了良好的平衡。

英文摘要:

Large language models (LLMs) achieved remarkable performance across various tasks. However, they face challenges in managing long documents and extended conversations, due to significantly increased computational requirements, both in memory and inference time, and potential context truncation when the input exceeds the LLM's fixed context length. This paper proposes a method called Selective Context that enhances the inference efficiency of LLMs by identifying and pruning redundancy in the input context to make the input more compact. We test our approach using common data sources requiring long context processing: arXiv papers, news articles, and long conversations, on tasks of summarisation, question answering, and response generation. Experimental results show that Selective Context significantly reduces memory cost and decreases generation latency while maintaining comparable performance compared to that achieved when full context is used. Specifically, we achieve a 50\% reduction in context cost, resulting in a 36\% reduction in inference memory usage and a 32\% reduction in inference time, while observing only a minor drop of .023 in BERTscore and .038 in faithfulness on four downstream applications, indicating that our method strikes a good balance between efficiency and performance.

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

↑