arXiv(opens in a new tab)cs.CLAug 2026Cited by 3 papers on PaperVantage

Manuscript Offprint

arXiv:2608.24004

AgentSpec: Speculative Decoding for Batch Inference of LLM Agents

Xin Wang, Ziming Miao, Yi Zhu, Hui Shen, Zhongwei Wan, Fan Yang, Mi Zhang

Abstract

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, existing speculative decoding algorithms exhibit substantial speed degradation as batch sizes grow, limiting their practicality 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. Motivated by these findings, 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-art.

1 Introduction

Large language model (LLM)-based agent applications have emerged as a powerful paradigm for solving complex tasks that require multi-step reasoning, tool invocation, and environment interaction (Li, 2025; Luo et al., 2025). However, in practical deployments, serving LLM agents often incurs high inference cost due to its long and multi-round generation (Wan et al., 2024; Wang et al., 2024; Luo et al., 2025; Wang et al., 2025), motivating the need for efficient methods for LLM agents.

Speculative decoding is a promising technique to reduce response time for LLM agents without impacting the generation quality (Xia et al., 2024). Previous works have shown notable speedups under small batch sizes (Li et al., 2025; Saxena, 2023; Oliaro et al., 2025; Miao et al., 2023; Huang et al., 2026). However, modern LLM serving systems (Kwon et al., 2023; Zheng et al., 2024) typically operate with large batch sizes to maximize hardware utilization, where state-of-the-art speculative decoding algorithms suffer substantial speed degradation, limiting their effectiveness for real-world agent applications.

To further understand such limitation, we conduct a systematic analysis of speculative decoding for LLM agents and conclude two dominant efficiency bottlenecks: ① High rejection rate of speculative tokens: Existing speculative decoding algorithms (Li et al., 2025; Saxena, 2023; Oliaro et al., 2025) incur a high rejection rate when applied to LLM agent workloads, resulting in substantial verification overhead for rejected tokens. As batch size increases, such overhead grows rapidly and can quickly outweigh the time saved by accepted tokens, leading to severe speedup degradation. ② Under-utilization of dynamic token budgets: The amount of token budget that can be used for speculation varies dynamically across requests and batches. However, existing approaches allocate speculative budgets either uniformly (Miao et al., 2023; Wu et al., 2025; Sadhukhan et al., 2025) or in a coarse-grained manner (Huang et al., 2026), leading to inefficient use of available token budgets and limited speedup for agentic workloads.

In this paper, we propose AgentSpec, a new speculative decoding algorithm that addresses the limitations of existing methods for LLM agents from prior approaches in two key aspects. ① Structure-isolated drafting: AgentSpec constrains speculation to semantically coherent segments of the agent workflow. By avoiding speculation across heterogeneous execution stages, AgentSpec reduces the generation of irrelevant speculative paths and achieves a substantially lower rejection rate. ② Redundancy-aware budget allocation: AgentSpec introduces a redundancy metric to guide the allocation of dynamically available token budgets across requests, improving overall inference efficiency for LLM agents under various batch sizes.

We implement AgentSpec in vLLM and compare it with four speculative decoding methods, including

∗^{*}Work was done during internship at Microsoft Research.

NGram, EAGLE-3, SuffixDecoding as well as state-of-the-art method MTP. To demonstrate the generability of AgentSpec, we conduct our evaluation on 4 models from four different LLM families (Qwen, DeepSeek, GPT-OSS, and MiMo) and on 4 different agentic workloads, including 2 workflow-based (Code Generation and Deep Research) and 2 model-based (SWE-Bench and GAIA). We highlight five of our findings: (1) AgentSpec consistently outperforms EAGLE-3, NGram and SuffixDecoding across all 4 agentic benchmarks and 4 different LLM families. (2) All existing speculative decoding algorithms suffer from severe speedup degradation for batch inference on agent workload and even become slower than normal autoregressive decoding. However, AgentSpec consistently achieves faster generation than autoregressive decoding, with at most 2.02×2.02 \times speedup. (3) AgentSpec is also able to accelerate the batch inference on non-agentic workloads. Specifically, AgentSpec achieves 1.14×1.14 \times speedup on Spec-Bench dataset with at most 1.40×1.40 \times speed acceleration on its subset. (4) Moreover, AgentSpec even achieves a higher speedup compared with Multi-Token Prediction (MTP) on MiMo-7B. (5) Lastly, AgentSpec ensures a robust efficiency under various maximum batch size and even achieves a better speedup with none thinking mode.

References (13)