JS²: Joint Scheduling and Speculative Decoding Deliver 2.10x Faster Agent Inference

JS² jointly optimizes scheduling and speculative decoding, using a remaining-steps-first policy to create effective windows for SD, achieving up to 2.10x speedup in average JCT.
LLM agents complete tasks through interleaved LLM calls and tool executions, making end-to-end job completion time a core metric. But the agent inference bottleneck drifts with concurrency: low concurrency is dominated by decoding latency, high concurrency by queueing delay; speculative decoding, which many had high hopes for, can actually slow performance under heavy load. Existing adaptive speculative decoding suffers from high switching overhead and lacks external control from the upper-layer scheduler, while agent-level scheduling treats SD's load dependence as a black box. JS² proposes a bottleneck-aware serving system that jointly optimizes scheduling and speculative decoding. Its core insight is to prioritize tasks with fewer remaining LLM requests, which both reduces queueing delay and shortens high-batch-size periods, creating more effective windows for SD. The system uses separate CUDA Graphs to achieve iteration-level, externally controllable switching, and fuses explicit plans, prompt-derived state, and hierarchical matching against historical trajectories to estimate remaining steps. Implemented on vLLM and SGLang and evaluated across three LLMs, four workloads, and two GPU platforms, it achieves up to 2.10x speedup in average JCT with comparable tail latency and throughput.
LLM agents complete tasks through interleaved LLM calls and tool executions, making end-to-end job completion time (JCT) a core service metric. However, a system-level study from academia points out that the bottleneck of agent inference drifts dynamically with concurrency: at low concurrency, decoding latency dominates; at high concurrency, queueing delay takes over. More vexingly, speculative decoding (SD), which many had high hopes for, can actually slow things down under heavy load.
To address this contradiction, the research team proposes JS² (Joint Scheduling and Speculative Decoding), a bottleneck-aware LLM serving system that jointly optimizes speculative decoding and agent-level scheduling. Implemented on vLLM and SGLang and evaluated across multiple dimensions, JS² achieves up to 2.10x speedup in average JCT over the best baseline while maintaining comparable tail latency and throughput.

Background: The "Double-Edged Sword" Effect of SD Under Heavy Load
Speculative decoding accelerates decoding by drafting with a small model and verifying with the target model, and is highly effective in single-request scenarios. But agent serving workloads are characterized by dynamic arrivals plus intermittent tool execution, causing online batch sizes to fluctuate continuously. Measurements reveal that SD's benefit depends heavily on current load: when the batch is already large and GPU compute is near saturation, the extra drafting and verification overhead erodes the gains and can even degrade performance below the non-SD baseline.
Existing adaptive speculative decoding (ASD) schemes attempt to toggle speculation on and off via reactive feedback, but suffer from two shortcomings: first, there remains non-negligible switching overhead when disabling speculation; second, the upper-layer scheduler lacks external control over the SD path. On the other hand, agent-level scheduling can alleviate queueing delay but treats SD's load dependence as a black box—the two operate in isolation.
Online batch size refers to the number of requests an inference system is simultaneously processing (or batching) at a given moment, and it typically changes dynamically: new requests keep arriving while old ones complete or get preempted, causing the batch size to fluctuate continuously. In LLM serving, batch size directly affects GPU compute utilization and memory footprint: a small batch means the GPU sits idle and decoding latency dominates; a large batch improves throughput but pushes the GPU toward saturation, where the additional drafting and verification computation competes for resources. The "dynamic arrivals plus intermittent tool execution" pattern of agent workloads makes batch size fluctuate more violently than in traditional chat services, so online batch size becomes a key contextual signal for judging whether SD pays off, and is the direct basis for JS²'s load estimation and path selection.
Adaptive Speculative Decoding (ASD) is a class of engineering solutions that dynamically enable or disable speculative decoding based on runtime feedback. A typical approach monitors metrics such as acceptance rate, batch size, or latency, switching back to regular decoding when speculative gains turn negative and re-enabling it otherwise. ASD's advantage is that it requires no changes to upper-layer business logic, but its adjustment is reactive: it often reacts only after performance has already degraded; moreover, switching paths itself requires rebuilding state (e.g., releasing draft-model-related resources, clearing KV caches, or rebuilding computation graphs), incurring non-negligible switching overhead. In addition, ASD is usually encapsulated inside the inference engine, so the upper-layer scheduler cannot intervene in its decisions from outside—exactly the gap JS² aims to fill through externally controllable switching and joint scheduling.
Core Insight: Scheduling "Creates Opportunities" for Speculation
JS²'s key insight is quite clever: prioritizing tasks with fewer remaining LLM requests not only directly reduces queueing delay but also shortens the periods during which the system operates at high batch sizes, thereby freeing up more usable windows for speculative decoding. In other words, the scheduling policy no longer passively adapts to SD but actively creates the conditions for SD to be effective.
This approach turns the "planfulness" of agent workflows into a scheduling asset. Agent tasks often have explicit execution plans, and remaining steps are not entirely unknown, providing an informational basis for prediction.
System Design: Controllable Switching and Remaining-Step Estimation
In terms of engineering implementation, JS² uses separate CUDA Graphs to enable iteration-level switching between the native SD path and the non-SD path, with switching controlled by the external scheduler. This minimizes the overhead of disabling SD while maintaining compatibility with existing ASD schemes—an "enhance rather than replace" design orientation.
Remaining-step estimation fuses three types of signals: explicit plans, execution state derived from the prompt, and hierarchical matching against historical trajectories. Combined, the system can dynamically correct its estimate of the remaining request count during task execution.
Coordination between scheduling and SD selection relies on offline performance profiling and recent load estimation: offline profiling characterizes SD's benefit curve under different loads, while near-future load estimation determines which path to take in the next phase.
CUDA Graphs is a mechanism provided by NVIDIA CUDA that records a series of GPU kernel launches and memory operations into a static computation graph, which is then replayed as a single graph launch, thereby eliminating substantial host-side launch overhead and scheduling jitter. In LLM inference, the decoding phase launches many small kernels at each step, and CUDA Graphs can significantly reduce this overhead. But graphs are static: different execution paths (e.g., with speculative decoding enabled vs. disabled) each require their own captured graph. JS² maintains separate CUDA Graphs for the native SD path and the non-SD path, so switching requires no re-capture or graph rebuilding—only selecting which graph to replay at iteration boundaries—thereby minimizing the overhead of disabling SD and achieving iteration-level, externally controllable switching.
Offline profiling refers to systematically measuring the speedup and overhead curves of speculative decoding under different load conditions (e.g., different batch sizes, different request-length distributions) for the target model and hardware before deployment or when the system is idle, forming a queryable benefit table. At runtime, JS² combines recent load estimation with table lookups to decide whether to use the SD or non-SD path in the next phase. This division of labor—"offline profiling + online estimation"—avoids the performance jitter of online trial-and-error and makes scheduling decisions interpretable: the profile provides the prior of "under what load SD pays off," while load estimation answers "which load regime we are in now and in the near future." Together they form the basis for coordinated scheduling and SD-selection decisions.
Evaluation Results and Significance
The experiments cover three LLMs, four workloads, three workflows, two GPU platforms, and two real serving traces—a fairly comprehensive evaluation scope for this line of work. Results show that JS² achieves up to 2.10x speedup in average JCT over the best baseline, with tail latency and throughput remaining comparable—meaning the speedup does not come at the expense of service stability.
The code is open-sourced on GitHub (Wenz0101/JS2), offering direct reference value for teams building agent inference infrastructure. This work also suggests a broader design principle: in the agent serving stack, the scheduling layer and the inference optimization layer should not be separated by layered abstractions—load-aware joint optimization often goes further than point optimizations.
One-line Summary
JS² jointly optimizes scheduling and speculative decoding, using a remaining-steps-first policy to create effective windows for SD, achieving up to 2.10x speedup in average JCT.
Paragraph Summary
LLM agents complete tasks through interleaved LLM calls and tool executions, making end-to-end job completion time a core metric. But the agent inference bottleneck drifts with concurrency: at low concurrency, decoding latency dominates; at high concurrency, queueing delay takes over; and speculative decoding, which many had high hopes for, can actually slow performance under heavy load. Existing adaptive speculative decoding suffers from high switching overhead and lacks external control from the upper-layer scheduler, while agent-level scheduling treats SD's load dependence as a black box. JS² proposes a bottleneck-aware serving system that jointly optimizes scheduling and speculative decoding. Its core insight is to prioritize tasks with fewer remaining LLM requests, which both reduces queueing delay and shortens high-batch-size periods, creating more effective windows for SD. The system uses separate CUDA Graphs to achieve iteration-level, externally controllable switching, and fuses explicit plans, prompt-derived state, and hierarchical matching against historical trajectories to estimate remaining steps. Implemented on vLLM and SGLang and evaluated across three LLMs, four workloads, and two GPU platforms, it achieves up to 2.10x speedup in average JCT with comparable tail latency and throughput.
Related articles

Four AI Coding Tools Face the Same Challenge: One Project Reveals the Strongest
A fair AI coding tool challenge: Clawed Code, Codex, Copilot Agent, and Cursor Agent compete on the same project and prompt, with basic functionality and exception handling tests revealing which tool is more robust.

AI Vulnerability Discovery for Beginners: From Environment Setup to Real-World SRC Practice
Based on Bilibili Teacher Xingkong's AI vulnerability discovery course intro: code auditing bottlenecks, three AI security modes, a five-step Node.js/Claude Code/CC Switch/Skill/MCP setup path, and authorized testing red lines.

Cursor Rebrands as GrokBuild: Editor Unchanged, Subscription Model Overhauled
Cursor rebranded as GrokBuild on November 30. Desktop app becomes GrokBuild Desktop; terminal Grok runs Cursor agent harness. Old Pro plans remain; new users pay via X subscription; Claude and Gemini require extra API payment.