A new benchmark says AI coding models write better code when they're allowed to admit they're unsure and rewind.
Researchers tested seven code-generating LLMs across five benchmarks and eight uncertainty signals, using a decoding method called uncertainty-aware rollback. Instead of retraining anything, the system watches token-level confidence signals like entropy and negative log-likelihood while the model writes code, and when confidence drops it discards the shaky portion and restarts from the last reliable point. Compared to a plain restart-from-scratch baseline with the same computational budget, the rollback approach improved pass@1 scores by as much as 0.26 and average test pass rates by up to 0.35 on standard benchmarks, plus a 6.4 percentage point gain in a safety-focused metric called Patch-Aligned Safe Rate on a benchmark called Dsec-Python. An ablation study found the bulk of the improvement came from feedback-guided rollback itself, with pinpointing exactly where the uncertainty spiked adding only a modest extra boost.
This lands at a moment when code-generation tools are being pushed into more autonomous, multi-step workflows where a single bad token can cascade into a broken function or, worse, an insecure one. Rather than needing a bigger or fine-tuned model, uncertainty-aware rollback squeezes more reliability out of existing weights purely at inference time - the kind of cheap, bolt-on improvement that's easier to ship than a retraining run. It's also a data point in the broader argument that whether a model knows when it doesn't know is a more useful question than raw benchmark accuracy.
The catch is that entropy and negative log-likelihood, the signals doing most of the work here, are blunt instruments - they flag where a model hesitates, not where it's actually wrong, so this is confidence-tracking, not fact-checking.