New to ShortSpan? We distil the AI-security research that matters into practitioner takeaways — edited by Ben Williams (NCC Group).Get the weekly email
// Analysis
Draft model veto cuts agent coding failures
Published: Mon, 07 Sep 2026 • By Clara Nyx
Agents
Speculative Uncertainty uses a small draft model to score an agent’s already-written tokens and predict failures before code runs. Splitting reasoning and action text boosts AUROC by 5–6 points; overall AUROC is ~0.77 versus a 0.82 white-box ceiling. A pre-execution veto cut execution errors by 6–8 points and token cost by 14–19%.
Agentic Large Language Models (LLMs) are very good at being confidently wrong, and you usually find out only after you’ve paid to run the code. This paper offers something refreshingly practical: a cheap, black-box check that can say “don’t run that” before you burn cycles and budget.
How it works
The method, Speculative Uncertainty (SU), flips speculative decoding on its head. A small open-weight draft model takes the agent’s already-generated tokens and, in a single forward pass, scores how plausible each token was under its own distribution. From those cross-likelihoods it extracts simple features such as surprisal and entropy. Crucially, it doesn’t mix everything together: it splits Trajectory" target="_blank" rel="noopener" class="term-link">trajectories into “reasoning” text and the “action” span, then summarises features over a short lookback window for each phase. A sparse linear calibrator maps roughly fifty such features to a failure likelihood for the next action. No Logit" target="_blank" rel="noopener" class="term-link">logits or weights from the agent. No repeated sampling.
The numbers are not world-beating, but they are actionable. Phase-aware features improve AUROC by about 5–6 points over pooled features. Overall, SU reaches around 0.77 AUROC using only output tokens, compared with a 0.82 white-box upper bound. Wired into a pre-execution veto gate, SU trimmed execution error rates by 6–8 percentage points and cut average token cost by 14–19% in deployment-style tests. It worked across an open-weight Qwen3-Coder-480B agent and a closed-source Claude 3.5 Sonnet agent, transferred to out-of-distribution benchmarks without retraining, and a distilled 4B draft was enough. Training the draft on one agent’s traces improved performance on others.
Why this matters: most “uncertainty for agents” tricks either need internals access or expensive resampling. SU is one pass over tokens you already have. It produces a scalar that can drive policy: route to human, replan cheaply, or veto execution. Not glamorous, but exactly the sort of plumbing you can ship.
What could go wrong
The attack surface is obvious. If an adversary can shape prompts or the agent’s tokens, they can try to spoof the signal, nudging it toward false confidence or false alarms. The draft model itself is a supply-chain risk: poison or swap it and the gate degrades or misfires. Calibration attacks on the gating policy could force costly retries or suppress detection.
Limitations also bite. All evidence here targets a single, verifiable objective: code running without exceptions. Results are single-run point estimates with residual miscalibration. SU assumes short-window, phase-identifiable traces and a draft pass that is cheap relative to the agent. Outside those bounds, expect drift. Still, for black-box agent coding, this is a solid, unfussy step toward failing fast and cheaply.
Additional analysis of the original ArXiv paper
📋Original Paper Title and Abstract
How to Speculate about Uncertainty in Agentic Coding? A Draft-Model Gate Method
Authors: Konstantin Grotov and Valentin Malykh
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.
🔍ShortSpan Analysis of the Paper
Problem
The paper studies how to predict costly failures of agentic large language models used for software engineering before those agents execute actions. In production, agents often emit confident but incorrect code or tool calls whose failure only becomes apparent after execution, causing wasted API calls, retries and latency. Practical constraints in deployed settings include black-box access to the agent (no logits, weights or activations) and prohibitive cost of repeated sampling, which rule out many standard uncertainty estimation methods.
Approach
The authors introduce Speculative Uncertainty (SU), a black-box method that uses a small open-weight draft model to score an agent's already-generated trajectory in a single teacher-forced forward pass. The draft computes token-level speculative surprisal, gap and entropy by evaluating its next-token distribution at each token the agent emitted. Trajectories are split into reasoning and action spans and features are summarised separately over a short lookback window. A sparse linear calibrator maps 50 phase-aware features to a failure-likelihood score for the next action against a verifiable binary objective; in this study the objective is code-execution success (no exceptions). The paper evaluates a pre-execution veto gate policy that blocks an action when predicted success probability falls below a threshold and triggers a cheaper replan instead of executing and retrying.
Key Findings
The phase split matters: separating reasoning and action spans improves prediction by about 5–6 AUROC points compared with pooled features.
SU recovers most of the white-box ceiling using only output tokens: distilled drafts yield AUROC around 0.77 versus 0.82 for a white-box upper bound method.
Applied as a veto gate on two agents (an open-weight Qwen3-Coder-480B and closed-source Claude 3.5 Sonnet), SU reduced per-call execution error rates by 6–8 percentage points and cut average token cost per task by 14–19% in deployment-style evaluations.
The draft model need not be large or trained with an elaborate objective: a distilled 4B draft was effective, and training on trajectories from one agent transfers to other agents, including closed-source models, improving AUROC substantially over an untrained baseline.
Gains transfer zero-shot to out-of-distribution benchmarks without retraining the calibrator.
Limitations
Results are derived solely from code-execution as the verifiable objective; no quantitative evidence is provided for other domains. Reported numbers are single-run point estimates without seed variance or confidence intervals. SU assumes short-window, phase-identifiable trajectories and that the draft forward pass is inexpensive relative to agent cost, which may not hold for all workloads. The linear calibrator shows residual miscalibration; the veto gate relies on ranking more than absolute probabilities.
Implications
Offensive security implications centre on the ability to influence or spoof the veto signal and the draft model. An attacker who can manipulate prompts or the agent's output tokens could induce false confidence or false alarms. Reliance on a draft model creates a supply-chain and integrity risk: if the draft or its training data are poisoned or replaced, the speculative signal can be degraded or exploited. Because SU enables pre-execution intervention, adversaries may target the gating policy or attempt calibration attacks to force costly retries or suppress detection of failing actions. These risks warrant threat modelling, careful governance and integrity controls for draft models and gating logic in deployed systems.
- It highlights a realistic threat: a malicious tool can behave plausibly during exploration to gain trust, then cause harm when the final action is e...
- It shows that the biggest fragility in long-running AI agents comes from steps that change the environment, not from their internal planning, highli...
- Why it may be relevant: It targets preventing harmful AI actions at the planning stage by using synthetic data to model risky plans, and it proposes...
- It shows you can detect doomed multi-step agent runs early by looking at internal signals, and abort them before wasted compute piles up.
- The pro...
- The paper tests whether using speculative decoding to speed up model inference could allow draft-side behavior to affect safety decisions, a key ris...
- It builds a trajectory-level uncertainty score for multi-turn, tool-using AI interactions, aiming to surface risky or failing episodes (like loops o...
- It presents a way to use untrusted AI components safely and quickly: a trusted verifier blocks unsafe steps while most of the work is offloaded to f...
- It analyzes safety gates for LLM actions and shows that human reviewers aren’t perfect and fatigue under workload can flip safety from strong to wea...
Get the weekly digest
The few AI-security papers that matter, with the practitioner takeaway. No spam.