NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Attention-Level Speculation

Jack Cai, Ammar Vora, Randolph Zhang, Mark O'Connor, Mark C. JeffreyICML 2025

As Large Language Models (LLMs) expand to massive context windows of 128K tokens and beyond, they inevitably hit a "latency wall." In standard transformer architectures, the compute time for Feed-Forward Networks (FFNs) remains constant regardless of context length. However, the time spent on self-attention grows linearly with every new token added to the Key-Value (KV) cache.

Conventional scaling techniques struggle to mitigate this bottleneck. Tensor Parallelism (TP) requires frequent communication that eventually outweighs compute benefits, while Data Parallelism (DP) improves overall throughput but does not reduce the latency of a single user's request. Meanwhile, static approximations like "Attention Sinks" speed up processing but cause models to fail on complex reasoning and math tasks where distant context is crucial.

To address this, researchers introduce Attention-Level Speculation (ALSpec), a novel parallelization strategy that applies the classic computer architecture concept of speculative execution to the attention layer.

How ALSpec Works

ALSpec aims to overlap the growing cost of attention with other operations, effectively hiding its latency without breaking the model. It achieves this through a predict-then-verify mechanism:

  1. The Predictor (Low-Cost Approximation): Instead of executing a full attention pass immediately, ALSpec uses a "Speculative Flash Decode" kernel. This computes a rapid, partial attention result using only the first few tokens (the "sinks") and the most recent tokens (the "local" window).
  2. The Speculation: While one set of devices calculates the exact, full attention, another device takes the approximated output and immediately begins running the subsequent FFN layer.
  3. The Verification: Once the exact attention computation finishes, ALSpec compares it to the approximation using an $L_2$ distance metric. If the error falls below a predefined safety threshold ($\lambda$), the speculative FFN result is committed, effectively skipping the time it took to compute the real attention. If the error is too high, the speculative work is discarded, and the model reverts to the exact path.
Comparison of parallelization strategies, highlighting how Attention-Level Speculation overlaps attention and feed-forward operations.

To implement this on real hardware, the authors developed a Static Graph, Dynamic Concurrency (SGDC) execution paradigm, allowing the system to dynamically fork and merge these speculative paths while maintaining a standard operation-by-operation host view.

Key Insights and Performance

The researchers evaluated ALSpec using Llama 3.1 (8B and 70B) across a battery of benchmarks, including reasoning (MMLU_PRO, GSM8K, MATH), information retrieval (Needles in a Haystack), and general QA.

The standout insight is the success of dynamic speculation over static pruning. While static attention pruning fails on hard math problems, ALSpec dynamically accepts approximations only when mathematically safe. This allows it to maintain baseline accuracy even on tasks requiring global context. Furthermore, the authors found that deeper layers in the transformer are significantly more tolerant of approximation, with up to 90% of attention operations successfully speculated in some tests.

Latency per token across varying context lengths, demonstrating how ALSpec hides the growing cost of attention.

By turning a sequential process (Attention $\rightarrow$ FFN) into a parallel one, ALSpec delivers substantial performance gains:

  • Speedup: On Tenstorrent N150 NPU devices, ALSpec achieved up to a 1.65x end-to-end speedup for Llama 3.1 8B at a 128K context length compared to standard tensor parallelism.
  • Latency Reduction: The latency overhead specifically attributed to attention was reduced by up to 5x.
  • High Hit Rates: Using a safety threshold of $\lambda = 0.1$, the system maintained speculation hit rates between 50% and 90% across most benchmarks.
  • Accuracy Preservation: Unlike pure attention sinks, which failed completely in a 16K "Needle in a Haystack" test (recovering 0/10 keys), ALSpec recovered all keys, matching the full-attention baseline.

Limitations and Future Directions

While highly effective, ALSpec currently requires "spare" compute resources to perform the speculative work alongside the exact computation. If a system is already at 100% utilization with massive batch sizes, the relative gains may diminish. Additionally, the current implementation is optimized for Tenstorrent's NPU architecture, meaning a native CUDA implementation for NVIDIA GPUs remains future work.

Looking ahead, the authors suggest that this "predict-then-verify" paradigm could be extended beyond self-attention to other expensive operations in deep learning, paving the way for faster, more efficient inference architectures.

Summary updated

BibTeX
@inproceedings{cai2025attention,
  author = {Jack Cai and Ammar Vora and Randolph Zhang and Mark O'Connor and Mark C. Jeffrey},
  title = {{Attention-Level Speculation}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=4OszSYdsgO},
}
Figure