TL;DR
Reasoning agents spend a lot of time sitting idle while waiting for slow tools—like test suites, database queries, or web pages—to finish running. Existing speculative execution methods try to predict the exact tool call while the model is still thinking, but early guesses are usually wrong and late guesses arrive too late to save much time. SWAN (Speculate Wide, Answer Narrow) solves this by prefetching a wider region (like an entire test file or a broader database table) and then extracting the exact, narrower answer once the agent makes its final call, hiding 1.5–3.4× more tool latency than prior exact-match methods without changing the agent's output.
What Problem Does This Paper Address?
Modern reasoning agents work in a loop: they think for a bit, issue a tool call, wait for the environment to return an observation, and repeat. Because these steps are sequential, every slow tool call sits directly on the agent's critical path. As model inference gets faster, waiting on tools becomes an increasingly noticeable bottleneck.
To hide this latency, speculative tool execution predicts and runs tool calls in the background while the agent is still generating its chain of thought. The catch is that existing methods (like SPORK) require an exact match between the predicted call and the eventual call. This creates a frustrating trade-off:
- Predict early: You have plenty of time to hide the tool's latency, but the agent hasn't finished thinking, so your guess is likely wrong (on BIRD-Bigscale, first-token predictions match the final SQL query only 22% of the time).
- Predict late: Your accuracy climbs to 95%, but there's barely any thinking time left to overlap with tool execution.
Methods
SWAN breaks the exact-match bottleneck using a simple observation: many slow tools have a natural containment relation. A test file contains its individual tests; a broader SQL query contains a more restrictive one; a full web page contains any window of text on that page. If you prefetch the wider region, you can derive the exact observation for a narrower call without running the tool again.
SWAN's runtime combines four pieces:
- Early Speculation: It forks probes from the agent's partial reasoning at doubling token counts ($k = 0, 200, 400, 800, \dots$) and also generates context specs from recent history (e.g., rerunning previous tests right after a code edit).
- Budget-Aware Region Widening: Each tool defines a "ladder" of wider regions. SWAN picks the widest rung that fits within a cost budget (e.g., measured seconds for tests, or row counts for SQL).
- Cross-Turn Result Pooling: Prefetched results live in a pool across turns until a state-changing write invalidates their "footprint."
- Answer Narrow: When the agent finally issues its call, SWAN finds a valid pooled region that provably covers it and derives the exact serial-equivalent output (e.g., filtering a per-test report or re-executing SQL over pooled relations).
Because it only speculates on read-only or sandboxable actions and verifies containment, SWAN is provably lossless—it produces the exact same observations as serial execution.
Datasets
The authors evaluate SWAN on three benchmarks using Qwen3-8B and Qwen3-4B (run in lockstep with serial execution so every method faces the exact same tool calls):
- SWE-bench Verified: Software engineering tasks where the slow tool is
run_tests. - BIRD-Bigscale: A subset of 240 training questions from BIRD over 13 databases whose largest tables exceed 3 million rows (
execute_sql), chosen because small dev databases run in milliseconds. - GAIA-Text-103: Text-only validation questions on a frozen web (
visitandsearch), where each URL or query's first response is pinned within a task.
Key Insights and Ideas
- Containment rescues early probes: On BIRD-Bigscale, widening a first-token prediction within budget boosts probe acceptance by 2.3× (from 22% under exact match to 51% under containment), turning early, imprecise guesses into usable prefetches.
- Cost gating matters: Simply widening everything isn't free—if a widened prefetch takes too long, it won't finish before the agent needs it. On BIRD-Bigscale, budget-aware cost gating nearly triples the hidden tool time (from 10.5% to 29.5%). On SWE-bench Verified, it cuts pool work by 3.7× while still hiding 85.7% of tool time.
- Containment lifts other methods too: Even if you feed predictions from a history-based speculator (Speculative Actions) into SWAN's widening and containment runtime, hit rates jump from 20.5% to 59.3% on SWE-bench Verified.
Key Results
Across all three benchmarks and both model sizes, SWAN hides 1.5–3.4× as much serial tool time as SPORK:
- SWE-bench Verified (Qwen3-8B): Hides 85.7% of serial test time (vs. 55.2% for SPORK), serving 94.9% of paired test runs and achieving 70% of the attainable end-to-end latency reduction (1.023× speedup).
- GAIA-Text-103 (Qwen3-8B): Hides 67.2% of tool time (vs. 37.5% for SPORK), achieving a 1.060× end-to-end speedup (59% of attainable savings).
- BIRD-Bigscale (Qwen3-8B): Hides 29.5% of query time (vs. 10.8% for SPORK), achieving a 1.010× end-to-end speedup.
Importantly, because self-speculation shares the agent's model weights and KV cache on the GPU, and pool work runs on CPU cores off the critical path, SWAN's GPU time per episode is no higher than serial execution.
Limitations and Future Work
- Bounded by tool share: SWAN only hides time spent waiting for tools. On today's reasoning agents, thinking still dominates the episode (tools account for ~2–11% of wall-clock time on these benchmarks), which caps the current end-to-end speedup. As token decoding accelerates (e.g., via speculative decoding), tool latency will become a larger share of total time, making SWAN's gains more substantial.
- Tool requirements: SWAN only applies to tools whose arguments have a containment order, whose observations are reproducible, and whose speculative execution leaves the agent's state unchanged (read-only or sandboxable). State-modifying actions still run serially.
Summary updated