TL;DR
Large Language Models spend an enormous amount of time and memory recalculating context during generation, yet many tokens in a sequence are essentially repeating what the model already knows. Token Filtering is a lightweight, real-time method that spots these redundant tokens before the heavy math of the attention layer happens—skipping both the computation and the memory storage. Without needing any fine-tuning or calibration data, it cuts generation latency by up to 44% while substantially outperforming existing pruning methods on long-context reasoning.
What Problem Does This Paper Address?
When an LLM generates text, the attention mechanism is the primary bottleneck, devouring compute and ballooning the "KV cache" (the running memory of past Key and Value vectors).
To speed things up, researchers typically turn to pruning (cutting out less useful model weights) or KV cache eviction (throwing away unimportant past tokens). Both have a catch:
- Offline pruning relies on pre-selected "calibration datasets" to decide what to cut before deployment. If real-world user prompts look different from the calibration data, accuracy plummets.
- KV cache eviction usually relies on attention scores to see which tokens matter. That means you still have to pay the computational toll of running the attention calculation first before you can throw anything away.
The authors ask a wonderfully direct question: Can we figure out if a token is redundant before executing attention, allowing us to skip the math and the memory storage entirely on the fly?
Methods
Enter Token Filtering, a small check inserted right before the attention layer in Transformer blocks. When a token’s attention is skipped, its output is set to zero, allowing the standard residual connection to pass the token's representation safely forward to the MLP layer intact.
Because attention scores don't exist yet at this stage, the authors invent a fast proxy to judge a token's novelty:
- Joint KV Similarity & Anchors: Each attention head maintains a running exponential moving average of previous Keys and Values—an "anchor" summarizing recent context (taking up just ~128 KB total for an 8B model). For each new token, the model checks the cosine similarity between the token's K/V vectors and the anchors. High similarity means low diversity—the token is redundant.
- Variance-Aware Fusion: Relying solely on Keys is noisy because positional embeddings warp them. Values reflect pure content better. Furthermore, if attention heads wildly disagree on how similar a token is (high variance across heads), some heads might still find it vital. The algorithm adaptively blends Key and Value similarities, automatically downweighting whichever signal has higher cross-head variance to prevent accidental pruning of nuanced tokens.
- Tail-Focused Adaptive Pruning: Early layers build foundational meaning, so Token Filtering leaves the first half of the model untouched and only prunes the later ("tail") layers. Each pruned layer uses a simple proportional feedback loop to adjust its similarity threshold at every step, ensuring the model hits your exact target skip budget (after a brief 10-step warm-up).
Datasets
Because Token Filtering operates completely online without training or calibration data, datasets are used strictly for evaluation:
- PG19: Long-range book texts used to measure language modeling perplexity across 20k+ token lengths.
- LongReason: A benchmark testing complex reasoning over extended contexts (up to 8K generated tokens).
- MMLU-Pro: Used in extended scaling tests to check general short-form reasoning.
No new benchmarks were introduced.
Key Insights and Ideas
- Novelty predicts attention: There is a striking inverse relationship between KV similarity and attention scores. Tokens that look very similar to the recent running average receive almost zero attention later on, proving you don't need to compute attention to know what attention will ignore.
- Head disagreement is a safety signal: Averaging similarity across multi-head attention can hide the fact that one specific head sees crucial new information. Downweighting high-variance signals protects informative tokens during aggressive pruning.
- Never prune the foundation: At 20% pruning on LLaMA3.1-8B, concentrating all skips in the early layers ("head-focused") balloons perplexity to a broken 143.8. Putting those exact same skips in the back half ("tail-focused") keeps perplexity at a crisp 19.16, outperforming uniform pruning (58.11). Mistakes in early layers compound; later layers are much more forgiving.
Key Results
Tested across LLaMA3.1-8B (Base and Instruct), Qwen3-8B, and Qwen3-32B against four strong baselines (H2O, HitKV, Probe Pruning, and RCPU):
- Long-Context Reasoning: On LongReason (at 20–25% pruning), Token Filtering achieves up to 1.5× higher accuracy than the best-performing baseline (e.g., 0.61 vs. RCPU's 0.32 on LLaMA3.1-8B-Instruct at 25% sparsity).
- Speed and Throughput: On LongReason at 25% pruning, Token Filtering cuts end-to-end latency by 44% (from 1948s down to 1087s) and boosts throughput by 1.79× compared to dense inference, beating all baselines in speed and ranking second only to structured weight-pruning (RCPU) in memory savings.
- Language Modeling: On PG19, Token Filtering hugs the dense baseline closely at 20% sparsity (<0.2 NLL gap) and maintains the lowest degradation even when skipping 50% of tokens.
- Scaling: Testing on Qwen3-32B showed accuracy drops were actually smaller or equal to those on the 8B model (only a 6-point drop on LongReason vs. 10 points on 8B), showing the method scales gracefully.
Limitations and Future Work
While the paper does not include a dedicated limitations section, the authors explicitly note an important sensitivity in their experiments: model-dependent hyperparameter tuning for the tail ratio ($Y$). While fixing pruning to the back 50% of layers ($Y = 0.5$) worked well for LLaMA models, Qwen3 models saw noticeable accuracy jumps when expanding pruning across 70% of layers ($Y = 0.7$, lifting Qwen3-8B LongReason accuracy from 0.62 to 0.68). Additionally, because Token Filtering keeps all model weights intact and only drops skipped KV cache entries, structured weight-pruning methods like RCPU still achieve slightly lower absolute peak memory usage when contexts aren't overwhelmingly dominant. Future directions are not explicitly discussed in the paper.
Summary updated