LLM agents deployed for software engineering fail expensively: they act confidently wrong, and bad actions are recognized only after costly execution and retry. We present Speculative Uncertainty (SU), a method that recovers a predictive failure signal for a black-box agent from its output tokens alone, with no access to logits, weights, activations, or repeated sampling. Inverting speculative decoding, a small open-weight draft model scores the agent's already-generated trajectory in a single forward pass. From these speculative cross-likelihoods we extract phase-aware features by separating the reasoning and action spans, and calibrate them against a verifiable objective. SU produces a failure-likelihood score that any downstream policy, such as routing, human intervention, or extra test-time compute, can consume directly. To show the signal is actionable, we instantiate one such policy, a pre-execution veto gate, on software engineering agents Qwen3-Coder-480B and closed-source Claude 3.5 Sonnet, cutting execution error rate by 6-8 percentage points and token cost by 14-19% in deployment, transferring to out-of-distribution benchmarks without retraining, and generalizing across agent models.
Figures & tables
Figure 1: The Speculative Uncertainty pipeline. A black-box agent generates a trajectory of alternating reasoning and action spans, exposing only its output tokens. A small open-weight draft model scores these tokens in a single forward pass, producing per-token uncertainty signals. Features are extracted separately from the reasoning and action spans, and a lightweight calibrator maps them to a calibrated success probability. Before execution, a threshold gate forwards confident actions or triggers a cheaper replan.
SWE-rebench †
SWE-Bench Ver.
DA-Code
Method
AUC
P@R80
AUC
P@R80
AUC
P@R80
Verbalized Conf.
.58
.50
.57
.49
.59
.51
Last-TP
.70
.61
.68
.59
.69
.60
Global-TP
.67
.57
.65
.55
.66
.56
HTC (Agent)
.85
.77
.82
.74
.83
.75
SU, no train
.63
.54
.61
.52
.63
.54
Table 1: Code-execution failure prediction (agent: Qwen3-Coder-480B; SU uses Qwen3-4B draft). † In-distribution held-out split; SWE-Bench Verified shares the agent and scaffold and differs only in task distribution; DA-Code additionally changes domain and tool interface.
SWE-Bench Verified
DA-Code
No-veto error rate
21%
14%
SU-gated error rate
15%
6%
Δ error
− 6 pp
− 8 pp
Token savings / task
− 14%
− 19%
No-veto task success
49%
64%
SU-gated task success
44%
63%
Table 2: Deployment impact of the SU veto gate (Qwen3-Coder-480B agent, Qwen3-4B draft). SWE-Bench Verified and DA-Code are evaluated without additional fine-tuning.
Method
ECE ↓
MCE ↓
Brier ↓
NLL ↓
BSS ↑
Constant (base rate)
.008
.008
.129
.426
.000
SU, no train
.015
.054
.127
.422
.019
SU, SFT
.024
.060
.101
.364
.215
Table 3: Calibration and proper-scoring metrics on the held-out SWE-rebench split (agent: Qwen3-Coder-480B, Qwen3-4B draft). The constant reference always predicts the base rate, it is trivially reliable and carries no information.
Train corpus
Qwen3-480B
Claude 3.5 Sonnet
—
.61 / .52
.60 / .52
Qwen (TF)
.77 / .68
.69 / .61
Qwen (SFT)
.76 / .67
.69 / .60
Claude (SFT)
.69 / .61
.76 / .67
Mixed (SFT)
.76 / .67
.75 / .66
Table 4: Cross-agent transfer on SWE-Bench Verified (AUROC / P@R80; Qwen3-4B draft). Claude 3.5 Sonnet is fully black-box (no logits).
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 2: Speculative entropy of agentic generations. Left: mean entropy aggregated over all steps—the per-step reasoning-to-action entropy drop is washed out and not visible. Right: entropy along a normalized step (reasoning x<0.5 , action x>0.5 ) for successful (navy) vs. failing (red) actions, revealing the sharp collapse at the transition. The failure signal appears in both phases with opposite sign, failures are more uncertain during reasoning, less so in the action span, which is why phase-aware features help. Bands show ±1σ over 500 training trajectories.
Dataset
#Traj.
#Calls
Succ. %
SWE-rebench (train)
10,000
327,098
84.7
SWE-rebench (held-out)
1,000
32,585
84.7
Appendix
Table 5: Dataset splits and base tool-call success rate (Qwen3-Coder-480B): the fraction of action steps whose tool call executes without error (exit code 0). Its complement is the base per-call execution-error rate.
Hyperparameter
Value
Base model
Qwen3-4B
Optimizer
AdamW ( β1=0.9,β2=0.95 )
Learning rate
1e-5 (cosine, 5% warmup)
Weight decay
0.1
Gradient clipping
1.0
Epochs
2
Appendix
Table 6: Draft-model fine-tuning hyperparameters, held fixed across sizes.
Stage
Hardware
Cost
Draft SFT/TF (4B)
4 × A100
∼ 50 GPU-h
Calibrator fit
64 × CPU
< 1 min
Draft scoring (per step, 4B)
1 × A100
≈ 100 ms
Appendix
Table 7: Compute budget by pipeline stage. Per-step latency is the only overhead on the agent’s critical path.
Large language model (LLM) agent reliability concerns dependable, safe, and verifiable behavior across tools, multi-step tasks, and changing environments.
As Large Language Model (LLM) agents are increasingly deployed in open-ended domains like software engineering, they frequently encounter underspecified instructions that lack crucial context. While human developers naturally resolve underspecification by asking clarifying questions, current agents are largely optimized for autonomous execution. In this work, we systematically evaluate the clarification-seeking abilities of LLM agents on an underspecified variant of SWE-bench Verified. We propose an uncertainty-aware multi-agent scaffold that decouples underspecification detection from code execution. Across both proprietary and open-weight frontier LLMs, our scaffold achieves a 69.40% task resolve rate, significantly outperforming a standard single-agent setup and closing the performance gap with agents operating on fully specified instructions. Furthermore, we find that the multi-agent system exhibits well-calibrated information-seeking behavior, conserving queries on simple tasks while proactively seeking information on more complex issues. These findings indicate that current models can be turned into proactive collaborators, where agents independently recognize when to ask questions to elicit missing information in real-world, underspecified tasks.
Nicholas Edwards, Sebastian Schuster
Faculty of Computer Science, University of Vienna, Vienna, Austria · UniVie Doctoral School Computer Science, University of Vienna, Vienna, Austria
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.
Xin Wang, Ziming Miao, Yi Zhu +4
The Ohio State University · Microsoft Research · University of Michigan
Speculative execution accelerates LLM agents by using a smaller, cheaper model to predict and pre-launch the next step while the environment is idle. However, existing speculators are stateless and discard all information between tasks, preventing prediction quality from improving with experience. We equip the speculator with three online memory systems that learn from past agent trajectories: a contrastive transition table tracking action-sequence statistics, an episodic memory retrieving contextually similar segments, and a confusion tracker suppressing recurring errors. We evaluate this approach on six benchmarks spanning three speculation types: action prediction, observation prediction, and chained prediction. Memory-augmented speculation yields a 19--39% relative accuracy improvement on action prediction and up to a 2.5× increase on observation prediction tasks with repetitive action spaces. These gains grow continuously as memory accumulates and generalize across speculator models of varying cost. All speculation is lossless because it runs during idle time at zero added wall-clock cost, and the actor's trajectory is identical to non-speculative execution.