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

TokenGate:适配大语言模型以实现快速且内存高效的预填充的学习型令牌剪枝方法

TokenGate: Adapting LLMs for Fast and Memory-Efficient Prefill with Learned Token Pruning

Stanford University(斯坦福大学);UC Berkeley(加州大学伯克利分校)

Liana Patel, Rishabh Ranjan, Ion Stoica, Matei Zaharia, Carlos Guestrin

AI总结:

TokenGate是一种即插即用组件,通过令牌门控注意力机制实现长上下文输入的可学习令牌剪枝,可加速Transformer预填充、降低内存且不损失精度,能扩展Qwen3等模型。

摘要:

专业人类读者处理大型输入(如代码仓库和长文档)时会略读,仅仔细阅读重要内容。而语言模型会通过每个模型层处理所有输入令牌,导致长上下文输入的处理成本显著增加。我们提出TokenGate,这是一个小型的即插即用组件,可扩展现有训练模型,实现对长上下文输入的端到端可学习令牌剪枝,以实现快速且内存高效的预填充。为解决令牌剪枝中不可微的Top-K算子导致的端到端学习难题,我们提出令牌门控注意力机制,这是一种受混合专家(Mixture-of-Experts)启发的机制,利用令牌重要性分数对注意力对数进行重新加权。在各类任务中,TokenGate在Transformer预填充阶段实现了1.4至11.3倍的首令牌生成时间(TTFT)加速,峰值内存降低1.5至3.4倍,且精度无下降。与表现最佳的现有令牌剪枝方法相比,TokenGate实现了最高6.4倍的预填充加速和2倍的峰值内存降低。TokenGate可原生扩展标准Transformer(如Qwen3)和混合注意力模型(如Qwen3.5),其轻量级适配与标准参数高效微调相当。我们的代码可在以下网址获取:this https URL。

英文摘要:

Expert human readers process large inputs (e.g., code repositories and long documents) by skimming to closely read only what matters. On the other hand, language models process all input tokens through each model layer, resulting in significant processing costs for long-context inputs. We introduce TokenGate, a small, drop-in component that extends existing trained models to enable end-to-end learnable token pruning over long-context inputs for fast and memory-efficient prefill. To enable end-to-end learning despite the non-differentiable top-K operator for token pruning, we introduce token-gated attention, a mechanism inspired by Mixture-of-Experts that re-weights attention logits using token importance scores. Across diverse tasks, TokenGate achieves $1.4$-$11.3\times$ faster time-to-first token (TTFT) and $1.5$-$3.4\times$ lower peak memory at no accuracy degradation for prefill in transformers. Compared to the best-performing prior methods for token-pruning, TokenGate gives up to $6.4\times$ faster prefill and $2\times$ lower peak memory. TokenGate natively extends both standard transformers (e.g., Qwen3) and hybrid-attention models (e.g., Qwen3.5) with simple lightweight adaptation comparable to standard parameter-efficient fine-tuning. We make our code available at: https://github.com/tokengate-models/TokenGate.

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

↑