用混合注意力提升小模型猜词效率,让大模型更快生成。
Mixture of Attentions For Speculative Decoding
- 设计混合注意力结构,增强小模型预测能力。
- 单机部署下速度提升9.5%,接受长度增长25%。
- 适合移动端部署,断网时仍能保持生成准确率。
大型语言模型(LLMs)参数量的增长导致计算需求激增,难以高效部署。推测解码(SD)利用小模型提前提出未来词元,由大模型并行验证,显著提升效率。现有基于大模型激活的小模型虽速度快,但存在训练时缺乏策略性及观测不全的问题。为此,本文提出一种基于混合注意力的新型小模型架构,适用于单设备部署与客户端-服务器部署两种场景。在单设备下,该方法使EAGLE-2的推理速度提升9.5%,接受长度增加25%;在客户端-服务器设置中,无论网络状况如何,均实现最低延迟,且在完全断连时仍能维持较高生成准确性,优于直接调用大模型API的方式。
原文摘要 · Abstract (English)
The growth in the number of parameters of Large Language Models (LLMs) has led to a significant surge in computational requirements, making them challenging and costly to deploy. Speculative decoding (SD) leverages smaller models to efficiently propose future tokens, which are then verified by the LLM in parallel. Small models that utilise activations from the LLM currently achieve the fastest decoding speeds. However, we identify several limitations of SD models including the lack of on-policyness during training and partial observability. To address these shortcomings, we propose a more grounded architecture for small models by introducing a Mixture of Attentions for SD. Our novel architecture can be applied in two scenarios: a conventional single device deployment and a novel client-server deployment where the small model is hosted on a consumer device and the LLM on a server. In a single-device scenario, we demonstrate state-of-the-art speedups improving EAGLE-2 by 9.5% and its acceptance length by 25%. In a client-server setting, our experiments demonstrate: 1) state-of-the-art latencies with minimal calls to the server for different network conditions, and 2) in the event of a complete disconnection, our approach can maintain higher accuracy compared to other SD methods and demonstrates advantages over API calls to LLMs, which would otherwise be unable to continue the generation process.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。