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

Lookahead:一种具有无损生成准确率的大型语言模型推理加速框架

Lookahead: An Inference Acceleration Framework for Large Language Model with Lossless Generation Accuracy

Ant Group(蚂蚁集团)

Yao Zhao, Zhitian Xie, Chen Liang, Chenyi Zhuang, Jinjie Gu

AI总结:

本文提出了名为lookahead的LLM推理加速框架,通过基于Trie的多分支检索与验证机制实现单步接受多token,在保证无损生成准确率和最坏性能不退化的前提下,在Alipay等实际场景中实现了2.66至6.26倍的显著推理加速。

摘要:

随着大型语言模型(LLMs)在问答、翻译、文本摘要和对话系统等各种任务中取得显著进展,对信息准确性的需求变得至关重要,特别是对于像Alipay这样服务数十亿用户的严肃金融产品。然而,对于一个服务数百万用户的现实产品,与单纯的实验模型相比,LLMs的推理速度成为一个关键因素。因此,本文提出了一个用于加速推理过程的通用框架,在保持无损生成准确率的同时,为基于LLM的场景显著提升了速度并降低了成本。在传统推理过程中,每个token由LLM顺序生成,导致时间消耗与生成的token数量成正比。为了改进这一过程,我们名为lookahead的框架引入了一种多分支策略。我们不再每次生成单个token,而是提出了一种基于Trie的检索和验证机制,使得在一个前向步骤中能够接受多个token。我们的策略具有两个显著优势:(1) 它保证了输出的绝对正确性,避免了任何近似算法;(2) 我们方法的最坏情况性能等同于传统过程。我们进行了广泛的实验,以证明应用我们的推理加速框架所取得的显著改进。自2023年4月起,我们的框架已在Alipay广泛部署,并获得了2.66倍至6.26倍的显著加速。我们的代码可在 https://github.com/alipay/PainlessInferenceAcceleration 获取。

英文摘要:

As Large Language Models (LLMs) have made significant advancements across various tasks, such as question answering, translation, text summarization, and dialogue systems, the need for accuracy in information becomes crucial, especially for serious financial products serving billions of users like Alipay. However, for a real-world product serving millions of users, the inference speed of LLMs becomes a critical factor compared to a mere experimental model. Hence, this paper presents a generic framework for accelerating the inference process, resulting in a substantial increase in speed and cost reduction for our LLM-based scenarios, with lossless generation accuracy. In the traditional inference process, each token is generated sequentially by the LLM, leading to a time consumption proportional to the number of generated tokens. To enhance this process, our framework, named \textit{lookahead}, introduces a \textit{multi-branch} strategy. Instead of generating a single token at a time, we propose a Trie-based retrieval and verification mechanism to be able to accept several tokens at a forward step. Our strategy offers two distinct advantages: (1) it guarantees absolute correctness of the output, avoiding any approximation algorithms, and (2) the worst-case performance of our approach is equivalent to the conventional process. We conduct extensive experiments to demonstrate the significant improvements achieved by applying our inference acceleration framework. Our framework is widely deployed in Alipay since April 2023, and obtain remarkable 2.66x to 6.26x speedup. Our code is available at https://github.com/alipay/PainlessInferenceAcceleration.

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

↑