TL;DR
SuffixDecoding is a novel, model-free speculative decoding method that leverages efficient suffix trees to exploit the repetitive nature of AI agent workloads. By caching previous outputs and adaptively speculating long token sequences, it achieves up to 5.3× speedups without the computational overhead or training requirements of traditional draft models.
The Challenge of Agentic Workloads
Large Language Model (LLM) inference is notoriously bottlenecked by autoregressive generation, where text is produced one token at a time. Speculative decoding has emerged as the standard solution to reduce latency: a smaller "draft" model quickly guesses several future tokens, which the large "target" model then verifies in a single parallel pass.
However, the landscape of LLM applications is shifting from simple, independent chatbot queries to complex agentic workflows—such as coding assistants (e.g., SWE-Bench) or multi-agent reasoning loops. These workloads are uniquely repetitive. Agents frequently regenerate similar code structures, adhere to rigid JSON schemas, or iteratively refine the same text.
Existing speculative methods struggle to capitalize on this predictability:
- Model-based methods (like EAGLE) require specialized training and consume significant GPU resources to generate drafts, often failing on the extremely long context windows typical of agentic tasks.
- Model-free methods (like Prompt Lookup Decoding) are fast but inflexible. They speculate a fixed number of tokens regardless of their confidence, leading to wasted computation when predictions are incorrect.
Methods: The SuffixDecoding Approach
To address these limitations, the authors introduce SuffixDecoding, which replaces the traditional neural draft model with a highly efficient pair of suffix trees.
- The Suffix Tree Cache: The system maintains two distinct trees: a global tree that caches millions of tokens from historical outputs across sessions, and a per-request tree that caches the current prompt and ongoing generation.
- Pattern Matching: At each decoding step, the algorithm searches the trees for the longest sequence of recently generated tokens. A match reveals exactly how the model has completed that specific sequence in the past.
- Adaptive Speculation: Instead of guessing a fixed number of tokens, SuffixDecoding scales its speculation based on confidence using a simple heuristic: $MAX\_SPEC = \alpha p$. The longer the matched pattern ($p$), the more tokens the system dares to speculate. If the match is short, it remains conservative to avoid wasting the target model's verification time.
- Tree-based Speculation: Moving beyond linear lookups, SuffixDecoding constructs a "speculation tree" of multiple likely paths. The target LLM can verify these branching paths simultaneously, maximizing the acceptance rate.
- Hybrid Fallback: When the suffix tree lacks a confident match (e.g., during highly creative generation), the system seamlessly falls back to a traditional draft model (like EAGLE-3), ensuring robust performance across diverse tasks.
Key Insights
- Repetition is a Feature: In the era of AI agents, LLM outputs are often bounded by structured formats (SQL, JSON, Python). Suffix trees are mathematically ideal for exploiting this structural predictability.
- Model-Free is "Free": Generating a draft token from a suffix tree takes approximately 20 microseconds on a CPU. This is orders of magnitude faster than running even the smallest neural network on a GPU, freeing up compute for the target model.
- Online Adaptation: The system learns in real-time. As it processes a new task—such as querying a specific SQL database—it continuously adds those outputs to the tree, improving its speedup dynamically as the task progresses.
Key Results
The researchers evaluated SuffixDecoding on a mix of repetitive agentic tasks (SWE-Bench, AgenticSQL) and diverse open-ended tasks (Spec-Bench). The method significantly outperformed both model-based and model-free baselines.
- AgenticSQL: SuffixDecoding achieved a massive 5.3× speedup over vanilla decoding, outperforming EAGLE-2/3 by 2.8× and Token Recycling by 1.9×.
- SWE-Bench: It delivered a 2.5× speedup on real-world software engineering tasks. Notably, model-based baselines like EAGLE-2/3 frequently failed on these tasks due to context length limits, whereas SuffixDecoding handled them effortlessly.
- End-to-End Efficiency: When integrated into the vLLM serving engine, SuffixDecoding reduced the total time to complete software engineering tasks by up to 4.5×, even when accounting for prefilling and code execution overhead.
- Memory Efficiency: The authors demonstrated that a high-end server with 2TB of RAM can store roughly a month's worth of generated tokens in a suffix tree before requiring any cache eviction.
Limitations and Future Work
While highly effective for agentic workloads, SuffixDecoding faces challenges on purely open-ended, non-repetitive tasks (like creative writing), where the suffix tree finds few historical matches. In these scenarios, the system relies heavily on its hybrid fallback mechanism.
Additionally, the current scoring heuristic sometimes struggles to optimally choose between candidates from the global versus per-request trees. Future work could explore more sophisticated statistical scoring to bridge this gap, as well as optimize how suffix trees interact with high-throughput batched serving environments.
Summary updated