CodeCircuit: Toward Inferring LLM-Generated Code Correctness via Attribution Graphs
Yicheng He, Zheng Zhao, Zhou Kaiyu, Bryan Dai, Jie Fu, Yonghui Yang

TL;DR
This paper explores whether an LLM's internal neural dynamics can be used to assess the correctness of generated code without external testing, by analyzing internal attribution graphs across multiple programming languages.
Contribution
It introduces a novel approach to code verification by mapping LLMs' internal algorithmic trajectories into attribution graphs, enabling internal correctness assessment.
Findings
Internal signals reliably predict code correctness across languages
Topological features outperform surface heuristics in correctness prediction
Internal graph analysis enables targeted causal interventions
Abstract
Current paradigms for code verification rely heavily on external mechanisms-such as execution-based unit tests or auxiliary LLM judges-which are often labor-intensive or limited by the judging model's own capabilities. This raises a fundamental, yet unexplored question: Can an LLM's functional correctness be assessed purely from its internal computational structure? Our primary objective is to investigate whether the model's neural dynamics encode internally decodable signals that are predictive of logical validity during code generation. Inspired by mechanistic interpretability, we propose to treat code verification as a mechanistic diagnostic task, mapping the model's explicit algorithmic trajectory into line-level attribution graphs. By decomposing complex residual flows, we aim to identify the structural signatures that distinguish sound reasoning from logical failure within the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Formal Methods in Verification
