面向高效大语言模型推理的跨层KV共享系统研究
A Systematic Study of Cross-Layer KV Sharing for Efficient LLM Inference
AI总结:
本文提出统一框架系统研究跨层KV共享技术,通过全面实验发现KV缓存减半时多数配置可在保持性能的同时提升吞吐量,进一步压缩时上层KV配对更优但需额外训练成本,为高效LLM推理提供选型依据。
摘要:
近年来,在大语言模型(LLMs)的高效推理中,跨层共享键值(KV)缓存已被证明是有效的。为了系统性地研究不同的跨层KV共享技术,我们提出了一个统一框架,该框架涵盖了若干近期方法及其新变体。我们在该框架的所有配置上进行了全面实验,评估了它们在语言建模和下游任务中的生成吞吐量与性能。我们发现,当将KV缓存大小减少2倍时,大多数配置能够在保持有竞争力的性能的同时,实现比标准Transformer更高的吞吐量。然而,当进一步减小KV缓存大小时,将所有层的查询与上层KV配对表现更好,但代价是额外的训练成本和预填充延迟。我们希望这项工作能够帮助用户对跨层KV共享方法做出更明智的选择,并促进未来关于高效LLM推理的研究。
英文摘要:
Recently, sharing key-value (KV) cache across layers has been found effective in efficient inference of large language models (LLMs). To systematically investigate different techniques of cross-layer KV sharing, we propose a unified framework that covers several recent methods and their novel variants. We conduct comprehensive experiments on all the configurations of the framework, evaluating their generation throughput and performance in language modeling and downstream tasks. We find that when reducing the size of the KV cache by 2$\times$, most configurations can achieve higher throughput than standard transformers while maintaining competitive performance. When further reducing the size of the KV cache, however, pairing queries of all layers with KVs of upper layers performs better, at the expense of additional training cost and prefilling latency. We hope that this work will help users make more informed choices of cross-layer KV sharing approaches and facilitate future research on efficient LLM inference.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。