Speculate Wide, Answer Narrow: Lossless Speculative Tool Execution for Reasoning Agents

Zihe Song, Wenting Zhao, Ye Liu, Yuanjie Zhu, Weizhi Zhang, Liangwei Yang, Henry Peng Zou, Yibo Wang, Yuqing Liu, Ke Xu, Shanghao Li, Philip S. YuarXiv 2026

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.
Figure 1: One agent turn under three tool-execution strategies. Serial execution waits until the agent issues its call at. Exact-match speculation executes predicted calls during reasoning, but only identical calls can reuse their results. SWAN starts from early predictions and prefetches wider regions that contain possible calls. When at is issued, SWAN derives its exact observation from a covering result, hiding tool latency even when the original prediction differs from at. Right: a prediction of one test is widened to its file, allowing the result to serve other tests in that file.

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:

  1. 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).
  2. 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).
  3. Cross-Turn Result Pooling: Prefetched results live in a pool across turns until a state-changing write invalidates their "footprint."
  4. 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.

Figure 3: SWAN serves a call its probe did not predict. A turn-start probe forks at k=0 and predicts ::test_join. It is sure of the file but not of the test (1). The width rule picks the whole file w1, the widest rung within budget B (2). Its prefetch finishes under the thinking (3). The agent then runs three contained tests, and SWAN derives ot from w1, exact as serial output (4). Steps 1–3 speculate wide and step 4 answers narrow.

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 (visit and search), 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.
Figure 2: Containment makes early speculation more effective. Earlier probes have more time to hide tool latency but are less likely to predict the exact call. On 76 BIRD-Bigscale query turns, containment increases first-token probe acceptance 2.3×, enabling earlier tool execution.

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

BibTeX
@misc{song2026speculate,
  author = {Zihe Song and Wenting Zhao and Ye Liu and Yuanjie Zhu and Weizhi Zhang and Liangwei Yang and Henry Peng Zou and Yibo Wang and Yuqing Liu and Ke Xu and Shanghao Li and Philip S. Yu},
  title = {{Speculate Wide, Answer Narrow: Lossless Speculative Tool Execution for Reasoning Agents}},
  year = {2026},
  eprint = {2612.00940},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.00940},
}
Figure