arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.19707cs.LGcs.DC
收藏

InfiniGen:基于动态KV缓存管理的大型语言模型高效生成式推理

InfiniGen: Efficient Generative Inference of Large Language Models with Dynamic KV Cache Management

Seoul National University(首尔大学)

Wonbeom Lee, Jungi Lee, Junghwan Seo, Jaewoong Sim

AI总结:

InfiniGen提出一种面向长文本生成的KV缓存管理框架,通过最小化预演推测关键token并仅预取必要缓存条目,在基于卸载的LLM推理系统中实现最高3倍性能提升且保持模型精度。

摘要:

基于Transformer的大型语言模型(LLMs)在各种自然语言处理任务中表现出令人瞩目的性能。然而,为生成长内容而服务LLM推理面临挑战,原因在于瞬态状态——即键值(KV)缓存——的巨大内存占用,该缓存随序列长度和批量大小而扩展。在本文中,我们提出了InfiniGen,这是一种专为长文本生成而设计的新型KV缓存管理框架,可与现代基于卸载的推理系统协同工作。InfiniGen利用了一个关键洞察:通过使用当前层的输入以及后续层的部分查询权重和键缓存进行最小化预演,可以推测出对计算Transformer中后续注意力层至关重要的少数重要token。这使我们能够仅预取必要的KV缓存条目(而无需全部获取),从而减轻基于卸载的LLM服务系统中来自主机内存的获取开销。我们在多个代表性LLM上的评估表明,与先前的KV缓存管理方法相比,InfiniGen将现代基于卸载系统的整体性能提升了最高3.00倍,同时提供了显著更好的模型精度。

英文摘要:

Transformer-based large language models (LLMs) demonstrate impressive performance across various natural language processing tasks. Serving LLM inference for generating long contents, however, poses a challenge due to the enormous memory footprint of the transient state, known as the key-value (KV) cache, which scales with the sequence length and batch size. In this paper, we present InfiniGen, a novel KV cache management framework tailored for long-text generation, which synergistically works with modern offloading-based inference systems. InfiniGen leverages the key insight that a few important tokens that are essential for computing the subsequent attention layer in the Transformer can be speculated by performing a minimal rehearsal with the inputs of the current layer and part of the query weight and key cache of the subsequent layer. This allows us to prefetch only the essential KV cache entries (without fetching them all), thereby mitigating the fetch overhead from the host memory in offloading-based LLM serving systems. Our evaluation on several representative LLMs shows that InfiniGen improves the overall performance of a modern offloading-based system by up to 3.00x compared to prior KV cache management methods while offering substantially better model accuracy.

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

↑