TokenGate: Adapting LLMs for Fast and Memory-Efficient Prefill with Learned Token Pruning
Liana Patel, Rishabh Ranjan, Ion Stoica, Matei Zaharia, Carlos Guestrin
Stanford University · UC Berkeley
Published October 19, 2026 · on the feed October 20, 2026 · ▲ 9 · arXiv 2610.26754
The abstract
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.3times faster time-to-first token (TTFT) and 1.5-3.4times 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.4times faster prefill and 2times 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.
The Brief
2:22A short podcast summary of the paper. Written and voiced by AI.
Transcript
TokenGate. Adapting LLMs for Fast and Memory-Efficient Prefill with Learned Token Pruning. By Liana Patel and four others, from Stanford University and UC Berkeley. Published on the nineteenth of October. Its code repository is worked out: about one hundred source files, with a readme and a licence.
Expert human readers handle large inputs, a code repository or a long document, by skimming. They read closely only what matters. Language models do the opposite. Every input token is processed through every model layer, whether it matters or not, and for long-context inputs that uniform treatment carries a significant processing cost. Prefill, the stage where the whole input is taken in before the first token comes out, is where the cost lands, in time and in memory.
TokenGate gives an existing trained model something like the skimming habit. It is a small, drop-in component that extends the model so that token pruning over long-context inputs becomes learnable end to end. Tokens can be dropped during prefill rather than carried through every layer, and the goal is a prefill that is both fast and memory-efficient, without building a new model from scratch.
The obstacle to learning this end to end is the top-K operator that does the pruning. It selects the highest-scoring tokens, and a hard selection like that is not differentiable, so a learning signal cannot pass through it. The answer is token-gated attention, a mechanism inspired by Mixture-of-Experts, which re-weights attention logits using token importance scores. Adapting a model this way is simple and lightweight, comparable to standard parameter-efficient fine-tuning, and it natively extends both standard transformers such as Qwen3 and hybrid-attention models such as Qwen3.5.
Across diverse tasks, TokenGate cuts time to first token by between one point four and eleven point three times. Peak memory falls by between one point five and three point four times. Both come with no accuracy degradation for prefill in transformers. Against the best-performing prior methods for token pruning, the margin is up to six point four times faster prefill, and two times lower peak memory.
The skimming reader from the opening carries the whole design. Skimming is a learned judgment about what to skip, and TokenGate turns that judgment into something a trained model can acquire, through a gate soft enough to learn through. Because it attaches to models that already exist, adopting it costs an adaptation comparable to ordinary fine-tuning rather than a new model.
More with an account
Listen to every day’s papers
Daily playlists, deep dives, quests for the papers, and quizzes on their key terms.
Join free