Large language model (LLM)-based agent applications often incur high response time. Speculative decoding is a promising solution to improve the inference efficiency of LLM agents without impacting generation quality. However, state-of-the-art speculative decoding algorithms exhibit substantial speed degradation under large batch sizes, limiting their effectiveness to deploy in real-world agent applications. In this work, we first present a systematic analysis of speculative decoding for LLM agents and identify two dominant factors of speedup degradation: high rejection rate of speculative tokens, and under-utilization of dynamic token budgets.B ased on these observations, we propose AgentSpec, a speculative decoding algorithm that addresses the limitations of existing methods for LLM agents. AgentSpec incorporates structure-isolated drafting that constrains speculation to semantically coherent segments of the agent workflow, reducing the drafts of irrelevant semantic paths and achieving an extremely low rejection rate. Moreover, AgentSpec adopts redundancy-aware budget allocation that exploits agent-level information to better utilize the dynamically-free token budget during the agent inference. We implement and evaluate AgentSpec on five different workloads and four different models from four different LLM families in vLLM. Our results demonstrate the superiority of AgentSpec over state-of-the-arts.
Figures & tables
Figure 1: Speedup in terms of Goodput (number of generated tokens divided by the execution time) ( Liu et al., 2024 ) under various maximum batch size in vLLM for different speculative decoding algorithms on USACO dataset with Code Generation Agent implemented by Reflexion agentic workflow on Qwen-3-8B.
Metric
EAGLE-3
NGram
SuffixDecoding
AgentSpec
Rejection Rate
53.3%
88.7%
65.9%
26.4% ( ↓50% )
Table 1: Average per-request rejection rate ( ↓ ) , defined as number of rejected tokens divided by number of draft tokens, for different speculative decoding algorithms on Reflexion agentic workflow.
Figure 2: Execution time comparison for FFN and Attention modules of Qwen-3-8B under various batch size.
Figure 3: Comparison between maximum token budget M(b) and average proposed token number for batch inference of speculative decoding on Reflexion workflow.
Figure 4: Overview of AgentSpec .
Figure 5: Repeated token ratio under different minimum repeated span lengths k . The repeated ratio is defined as the total length of maximal repeated segments with at least k consecutive tokens appearing in historical generations, normalized by the total generation length. Repetitions are categorized by whether they occur under the same or different user queries and within the same or different semantic blocks.
Figure 6: Acceptance ratio ( 1−ρ(b) under different redundancy ratio with different matching pattern length.
Model
Method
Deep Research Agent
Code Generation Agent
GAIA
SWE-Bench
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Qwen-3-8B
Normal
617.41
× 1.00
636.09
× 1.00
501.27
× 1.00
652.44
× 1.00
EAGLE-3
605.14
× 0.98
539.01
× 0.85
468.22
× 0.93
523.12
× 0.80
NGram
509.62
× 0.83
422.58
× 0.66
308.27
× 0.61
408.28
× 0.63
SuffixDecoding
598.74
× 0.97
579.21
× 0.91
498.16
× 0.99
556.64
× 0.85
AgentSpec
661.43 ( ↑9% )
× 1.07
828.10 ( ↑43% )
× 1.30
537.78 ( ↑8% )
× 1.07
854.69 ( ↑42% )
× 1.31
Table 2: Goodput (tokens/sec) of AgentSpec and baselines on four different agentic workloads with three different models. The best performance is marked in bold. The speedup is measured by comparing the goodput with the normal autoregressive decoding. The relative performance gain compared to the best-performing baseline is marked in green inside bracket.
Figure 7: Speedup in terms of Goodput (token/s) for AgentSpec and baselines compared with normal autoregressive decoding on all subsets in USACO dataset with Code Generation Agent implemented by Reflexion agentic workflow on three different models.
Model
Method
Code Gen.(Bronze)
Code Gen.(Silver)
Code Gen.(Gold)
Code Gen.(Platinum)
Code Gen.(All)
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
MiMo-7B
Normal
2768.67
× 1.00
3093.50
× 1.00
2532.30
× 1.00
1141.64
× 1.00
2572.16
× 1.00
NGram
1322.92
× 0.48
1399.76
× 0.45
1383.92
× 0.55
990.87
× 0.87
1306.92
× 0.51
SuffixDecoding
1609.41
× 0.58
1624.98
× 0.53
1599.63
× 0.63
1235.12
× 1.08
1653.26
× 0.64
MTP
1924.46
× 0.70
2001.28
× 0.65
2034.30
× 0.80
1349.10
× 1.18
1875.18
× 0.73
AgentSpec
3324.71 ( ↑73% )
× 1.20
3751.44 ( ↑87% )
× 1.21
2925.40 ( ↑44% )
× 1.16
1527.14 ( ↑13% )
× 1.34
3318.99 ( ↑77% )
× 1.29
Table 3: Goodput (tokens/sec) of AgentSpec and baselines, including MTP, on MiMo-7B. The best performance is marked in bold. The speedup is measured by comparing the goodput with the normal autoregressive decoding. The relative performance gain compared to the best-performing baseline is marked in green inside bracket.
Model
Method
MT Conversation
Question Answering
Summarization
Translation
Math Reasoning
Retrieval Augmented
All
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Tokens/s
Speedup
Qwen-3-8B
Normal
939.50
× 1.00
860.97
× 1.00
1277.50
× 1.00
2013.02
× 1.00
1064.78
× 1.00
191.60
× 1.00
697.42
× 1.00
EAGLE-3
1005.63
× 1.07
895.25
× 1.04
1552.62
× 1.22
2319.01
× 1.15
1045.28
× 0.98
168.21
× 0.88
783.25
× 1.12
NGram
581.26
× 0.62
351.28
× 0.41
1082.57
× 0.85
2166.37
× 1.08
959.38
× 0.90
263.11
× 1.37
545.39
× 0.78
SuffixDecoding
1007.08
× 1.07
873.12
× 1.01
1213.63
× 0.95
2141.79
× 1.06
1121.48
× 1.05
212.19
× 1.10
712.79
× 1.02
AgentSpec
1128.09
× 1.20
929.85
× 1.08
1481.90
× 1.16
2294.12
× 1.14
1075.43
× 1.01
267.14
× 1.40
796.01
× 1.14
Table 4: Goodput (tokens/sec) of AgentSpec and baselines on Spec-Bench on Qwen-3-8B. The best performance is marked in bold. The speedup is measured by comparing the goodput with the normal autoregressive decoding.
Figure 8: Tailed latency analysis for AgentSpec and baselines on Code Gen agentic workflow.
Time (minutes)
EAGLE-3
NGram
SuffixDecoding
AgentSpec
Draft
5.72
0.68
1.41
1.74
Verification
34.24
39.82
33.12
26.11 ( ↓21% )
Overall
39.96
40.50
34.53
27.85 ( ↓19% )
Table 5: Execution breakdown of AgentSpec and baselines on Code Gen agentic Workload. The best performance is marked in bold.
Model
Method
Deep Research Agent
Code Generation Agent
Tokens/s
Speedup
Tokens/s
Speedup
Qwen-3-8B
Normal
617.41
× 1.00
636.09
× 1.00
EAGLE-3
605.14
× 0.98
539.01
× 0.85
NGram
509.62
× 0.83
422.58
× 0.66
SuffixDecoding
598.74
× 0.97
579.21
× 0.91
AgentSpec (S)
647.12 ( ↑9% )
× 1.05
795.54 ( ↑37% )
× 1.25
Table 6: Goodput of variants of AgentSpec and baselines on Deep Research Agent and Code Generation Agent workloads. The best performance is marked in bold. The speedup is measured by comparing the goodput with the normal autoregressive decoding.
Figure 9: Speedup in terms of Goodput (tokens/sec) of AgentSpec and baselines on workload of code generation agent under various maximum batch size and different thinking modes.
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Speedup
CodeGen
DeepResearch
SWE-Bench
GAIA
1 × A100 80G
2.02 ×
1.48 ×
1.69 ×
1.19 ×
1 × H100 80G
2.28 ×
1.67 ×
1.92 ×
1.54 ×
Appendix
Table 7: Speedup of AgentSpec on different GPU platforms on GPT-OSS-20B across agent workloads.