Diffusion language models show internal signs of code correctness
The Editor Has Read-Only Access: Correctness Signals in Diffusion Language Models
Software Engineering
Summary
This paper explores whether language models that generate code by gradually filling in blanks can internally recognize when the code is correct or not. The authors found that certain parts inside these models do show signals that distinguish passing code from failing code, especially in later layers. However, trying to use these signals to directly improve code generation did not reliably help. The study sets clear boundaries on what the models' internal signals can and cannot achieve in steering code correctness.
What this means in practice
- •For software developers: Identify internal signals in code generation models that correlate with code correctness to inform debugging and model analysis.
- •For ai system engineers: Use activation-based probes to monitor code correctness signals during model inference for model diagnostics or interpretability tools.
Authors
Angad Miglani, Samrath Singh Chadha, Kevin Li, Manas Venkata Sai Ravulapalli
Abstract
Diffusion language models generate code by repeatedly updating a partially masked sequence. We ask whether their internal activations encode code correctness and whether that information can improve generation. Across six diffusion models, linear probes distinguish passing from failing attempts, with the strongest reads generally appearing beyond the early layers. Controls using small semantic mutations support a connection to correctness rather than surface style alone. In comparisons with model confidence, probe point estimates offer no consistent advantage. Adding a probe-derived direction to the residual stream does not yield a dependable improvement in the tested steering settings, while the opposite direction degrades performance. We distinguish these observations from claims about statistical significance or a general inability to steer. Supplementary methods, archived results, and code document the tested interventions and the limits of their statistical calibration and reproducibility.