用分隔符压缩文本段落,实现大模型推理加速50%以上
SepLLM: Accelerate Large Language Models by Compressing One Segment into One Separator
- 将无意义的分隔符转化为信息载体,压缩前后内容
- 在Llama-3-8B上实现超过50%的KV缓存减少
- 支持百万级长序列处理,适合实时生成场景
大型语言模型在自然语言处理任务中表现卓越,但其庞大的规模带来巨大的计算负担和推理延迟,主要源于二次复杂度。本文发现:某些看似无意义的分隔符(如标点)对注意力分数的贡献远超语义性标记。这表明,分隔符之间的内容可有效压缩至分隔符本身而不造成显著信息损失。基于此,我们提出SepLLM——一种即插即用的加速框架,通过压缩段落并移除冗余标记来提升推理效率,并实现训练加速的高效内核。在无需训练、从头训练及后训练等多种设置下验证有效性。以Llama-3-8B为骨干,在GSM8K-CoT基准上实现超过50%的KV缓存缩减,同时保持性能相当。此外,在流式场景中,能够稳定处理高达400万或更多令牌的序列,维持一致的语言建模能力。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have exhibited exceptional performance across a spectrum of natural language processing tasks. However, their substantial sizes pose considerable challenges, particularly in computational demands and inference speed, due to their quadratic complexity. In this work, we have identified a key pattern: certain seemingly meaningless separator tokens (i.e., punctuations) contribute disproportionately to attention scores compared to semantically meaningful tokens. This observation suggests that information of the segments between these separator tokens can be effectively condensed into the separator tokens themselves without significant information loss. Guided by this insight, we introduce SepLLM, a plug-and-play framework that accelerates inference by compressing these segments and eliminating redundant tokens. Additionally, we implement efficient kernels for training acceleration. Experimental results across training-free, training-from-scratch, and post-training settings demonstrate SepLLM's effectiveness. Notably, using the Llama-3-8B backbone, SepLLM achieves over 50% reduction in KV cache on the GSM8K-CoT benchmark while maintaining comparable performance. Furthermore, in streaming settings, SepLLM effectively processes sequences of up to 4 million tokens or more while maintaining consistent language modeling capabilities.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。