How to Speculate about Uncertainty in Agentic Coding? A Draft-Model Gate Method

Konstantin Grotov, Valentin Malykh


Abstract
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.
Anthology ID:
2026.emnlp-industry.206
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing: Industry Track
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Pepa Atanasova, Gholamreza Haffari, Minghan Wang
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
3455–3465
Language:
URL:
https://aclanthology.org/2026.emnlp-industry.206/
DOI:
Bibkey:
Cite (ACL):
Konstantin Grotov and Valentin Malykh. 2026. How to Speculate about Uncertainty in Agentic Coding? A Draft-Model Gate Method. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing: Industry Track, pages 3455–3465, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
How to Speculate about Uncertainty in Agentic Coding? A Draft-Model Gate Method (Grotov & Malykh, EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-industry.206.pdf