AI
Researchers Guide AI Through Code Translation with Real-Time Verification Checks
A new decoding strategy uses structural verification at generation time to help language models produce correct code translations more efficiently.
A team of researchers has developed a method that interleaves verification checks during the code generation process itself, rather than waiting until a model finishes writing and then checking the result. This approach, called Decoding Time Verification (DTV), treats code structure as a series of checkpoints where the model can verify its work mid-stream.
The Problem with Traditional Verification#
Current approaches to improving language model output typically work in two stages: generate the entire output first, then test it against compilers, type checkers, or other validators. This creates a critical inefficiency—once an error appears early in the generated text, it pollutes everything that comes after, and the autoregressive model rarely recovers from these mistakes. Traditional post-hoc verification can't fix errors embedded in the middle of generated code.
How DTV Works#
Rather than accept this limitation, the new framework integrates verification into the generation loop itself. DTV identifies structural boundaries in code (like function definitions or block endings) as natural points to pause and verify what's been generated so far. A state-machine controller manages this process, committing verified portions of code that have passed checks and rolling back to try alternative paths when errors are detected.
This structure-aware approach prevents error propagation while minimizing wasted computation—verified sections aren't regenerated unnecessarily.
Real-World Results#
Testing across two translation tasks showed substantial improvements:
- C-to-Rust translation: Pass rates jumped from 72.3% to 82.0% using the same token budget as baseline approaches
- JavaScript-to-TypeScript translation: Success rates rose from 33.3% to 46.0%
The method achieved these gains while actually using fewer tokens per translation attempt than comparison methods. Results held reasonably consistent across different model sizes (Qwen3 and Gemma variants tested).
Implications for Inference Efficiency#
The research demonstrates that strategically spending inference compute on verification and guided decoding during generation, rather than after-the-fact testing and resampling, offers better returns on computational investment. For tasks with clear verifiable outputs—like code translation—this represents a more efficient way to scale language model capabilities at test time.

