CopySpec:通过推测性复制粘贴加速LLM,且不损害质量
CopySpec: Accelerating LLMs with Speculative Copy-and-Paste Without Compromising Quality
AI总结:
CopySpec通过识别重复序列并推测复制粘贴,在不损害质量且无需额外GPU内存的情况下,显著加速LLM生成,与推测解码集成可额外提速49%,并提供了新数据集MT-Redundant。
摘要:
我们提出了CopySpec,一种简单而有效的技术,用于解决LLM在生成与先前输出或可从上下文逐字提取的响应高度相似时的低效问题。CopySpec识别模型聊天历史或上下文中的重复序列,并推测相同的令牌将随后出现,从而在不损害输出质量且无需额外GPU内存的情况下实现无缝复制。为评估我们方法的有效性,我们使用七个LLM和五个数据集进行了实验:MT-Bench、CNN/DM、GSM8K、HumanEval以及我们新创建的数据集MT-Redundant。本文引入的MT-Redundant将MT-Bench的第二轮转换为对第一轮答案的变体请求,模拟用户请求修改先前响应的现实场景。我们的结果显示了显著的加速:在CNN/DM上最高达2.35倍,在选定的MT-Redundant类别的第二轮上最高达3.08倍,在GSM8K自我修正任务的第三轮上最高达2.66倍。重要的是,我们展示了CopySpec与推测解码无缝集成,在MT-Redundant所有八个类别的第二轮上,相对于推测解码平均额外获得49%的加速。虽然LLM,即使使用推测解码,随着上下文大小的增长推理速度会变慢,但CopySpec利用更大的上下文来加速推理,使其成为更快的补充解决方案。我们的代码和数据集公开于https://github.com/RazvanDu/CopySpec。
英文摘要:
We introduce CopySpec, a simple yet effective technique to tackle the inefficiencies LLMs face when generating responses that closely resemble previous outputs or responses that can be verbatim extracted from context. CopySpec identifies repeated sequences in the model's chat history or context and speculates that the same tokens will follow, enabling seamless copying without compromising output quality and without requiring additional GPU memory. To evaluate the effectiveness of our approach, we conducted experiments using seven LLMs and five datasets: MT-Bench, CNN/DM, GSM8K, HumanEval, and our newly created dataset, MT-Redundant. MT-Redundant, introduced in this paper, transforms the second turn of MT-Bench into a request for variations of the first turn's answer, simulating real-world scenarios where users request modifications to prior responses. Our results demonstrate significant speed-ups: up to 2.35x on CNN/DM, 3.08x on the second turn of select MT-Redundant categories, and 2.66x on the third turn of GSM8K's self-correction tasks. Importantly, we show that CopySpec integrates seamlessly with speculative decoding, yielding an average 49% additional speed-up over speculative decoding for the second turn of MT-Redundant across all eight categories. While LLMs, even with speculative decoding, suffer from slower inference as context size grows, CopySpec leverages larger contexts to accelerate inference, making it a faster complementary solution. Our code and dataset are publicly available at https://github.com/RazvanDu/CopySpec.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。