arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2404.08698cs.CLcs.LG
收藏

通过自适应N元语法并行解码实现大语言模型无损加速

Lossless Acceleration of Large Language Model via Adaptive N-gram Parallel Decoding

University of Electronic Science and Technology of China(电子科技大学)

Jie Ou, Yueming Chen, Wenhong Tian

AI总结:

针对大语言模型自回归推理延迟高的问题,提出无需重训、不占额外显存的自适应N元语法并行解码无损加速方法,经两阶段流程实现最高3.67倍速度提升。

摘要:

尽管大语言模型(LLMs)已展现出卓越能力,但自回归处理带来的大量资源消耗与显著延迟仍对其形成制约。本研究提出自适应N元语法并行解码(ANPD),这是一种创新的无损加速方法,通过同时生成多个token来提升推理速度。ANPD采用两阶段流程:首先是快速草稿生成阶段,使用可根据当前交互上下文自适应调整的N-gram模块生成候选token;随后是验证阶段,由原始LLM对候选token进行评估与确认。由此,ANPD在提升处理速度的同时,完整保留了LLM原始输出的一致性。我们进一步为N-gram模块采用多级架构,提升初始草稿的准确率,从而进一步降低推理延迟。ANPD无需重新训练,也不占用额外GPU显存,是一种高效的即插即用增强方案。在实验中,LLaMA及其微调变体等模型的速度提升最高可达3.67倍,验证了所提ANPD方法的有效性。

英文摘要:

While Large Language Models (LLMs) have shown remarkable abilities, they are hindered by significant resource consumption and considerable latency due to autoregressive processing. In this study, we introduce Adaptive N-gram Parallel Decoding (ANPD), an innovative and lossless approach that accelerates inference by allowing the simultaneous generation of multiple tokens. ANPD incorporates a two-stage approach: it begins with a rapid drafting phase that employs an N-gram module, which adapts based on the current interactive context, followed by a verification phase, during which the original LLM assesses and confirms the proposed tokens. Consequently, ANPD preserves the integrity of the LLM's original output while enhancing processing speed. We further leverage a multi-level architecture for the N-gram module to enhance the precision of the initial draft, consequently reducing inference latency. ANPD eliminates the need for retraining or extra GPU memory, making it an efficient and plug-and-play enhancement. In our experiments, models such as LLaMA and its fine-tuned variants have shown speed improvements up to 3.67x, validating the effectiveness of our proposed ANPD.

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

↑