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

面向早退大语言模型的高效推理框架

An Efficient Inference Framework for Early-exit Large Language Models

Peking University(北京大学)

Ruijie Miao, Yihan Yan, Xinshuo Yao, Tong Yang

AI总结:

本文针对早退大语言模型提出高效推理框架,通过迭代级批量推理和提前填充剩余层KV缓存,在vLLM上实现最高1.25倍加速。

摘要:

构建高效推理框架日益受到研究界的关注。早退模型作为大语言模型(LLMs)的一种变体,通过在模型足够自信时跳过剩余层并直接生成输出 token 来提升推理效率。然而,目前尚无将早退模型纳入考虑的 LLM 推理框架工作。这一点并非易事,因为现有 LLM 推理技术无法直接应用于早退模型。本文解决了构建早退模型高效推理框架中的两个关键挑战:(1)迭代级粒度的批量推理;(2)KV 缓存管理。针对前者,我们提出持续处理批次,直到所有序列都超过早退置信度阈值。针对后者,我们提出在迭代终止前填充剩余层的 KV 缓存。我们的评估表明,与在全层上运行的原版 vLLM 相比,我们的解决方案实现了最高 1.25 倍的加速。

英文摘要:

Building efficient inference framework has gained increasing interests for research community. Early-exit models, a variant of LLMs, improves the inference efficiency of LLMs by skipping rest layers and directly generate output tokens when they are confident enough. However, there is no work of LLM inference framework that takes early-exit models into consideration. This is non-trivial as prior art on LLM inference cannot be directly applied to early-exit models. In this work, we solves two key challenges in building efficient inference framework for early-exit models: (1) batch inference at iteration-level granularity; and (2) KV cache management. For the former, we propose to process the batch until all sequences surpass the early-exit confidence threshold. For the latter, we propose to fill the KV cache of rest layers before the iteration terminates. Our evaluation shows that, compared with the original vLLM operating at full layers, our solution achieves up to 1.25x speed up.

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

↑