CodeCircuit: Toward Inferring LLM-Generated Code Correctness via Attribution Graphs
Not on the map. Why?
Abstract (arXiv)
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 model's internal circuits. Analysis across Python, C++, and Java confirms that intrinsic correctness signals are robust across diverse syntaxes. Topological features from these internal graphs predict correctness more reliably than surface heuristics and enable targeted causal interventions to fix erroneous logic. These findings establish internal introspection as a decodable property for verifying generated code. Our code is at https:// github.com/bruno686/CodeCircuit.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 41 of its 55 references that are in the map. First posted on arXiv 6 Feb 2026.
Builds on
41 of 55 references.
References · 41
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2022Locating and Editing Factual Associations in GPTcited by 2,609
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,928
- 2023Sparse Autoencoders Find Highly Interpretable Features in Language Modelscited by 1,359
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2020Energy-based Out-of-distribution Detectioncited by 1,296
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
29 more
- 2024Qwen2.5-Coder Technical Reportcited by 1,151
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2022Mass-Editing Memory in a Transformercited by 976
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
- 2023StarCoder: may the source be with you!cited by 790
- 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 700
- 2024Gemma Scope: Open Sparse Autoencoders Everywhere All At Once on Gemma 2cited by 381
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
- 2024Transcoders Find Interpretable LLM Feature Circuitscited by 186
- 2025Open Problems in Mechanistic Interpretabilitycited by 173
- 2023Self-planning Code Generation with Large Language Modelscited by 121
- 2024A Practical Review of Mechanistic Interpretability for Transformer-Based Language Modelscited by 113
- 2022Execution-Based Evaluation for Open-Domain Code Generationcited by 89
- 2024Evaluating Language Models for Efficient Code Generationcited by 69
- 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 66
- 2024Latent Space Chain-of-Embedding Enables Output-free LLM Self-Evaluationcited by 56
- 2025CoT-Kinetics: A Theoretical Modeling Assessing LRM Reasoning Processcited by 50
- 2023xCodeEval: A Large Scale Multilingual Multitask Benchmark for Code Understanding, Generation, Translation and Retrievalcited by 46
- 2025VisPlay: Self-Evolving Vision-Language Models from Imagescited by 42
- 2025Weight-sparse transformers have interpretable circuitscited by 40
- 2025CodeJudgeBench: Benchmarking LLM-as-a-Judge for Coding Taskscited by 32
- 2025Verifying Chain-of-Thought Reasoning via Its Computational Graphcited by 20
- 2024Opening the AI black box: program synthesis via mechanistic interpretabilitycited by 19
- 2023Long Horizon Temperature Scalingcited by 18
- 2025Correctness Assessment of Code Generated by Large Language Models Using Internal Representationscited by 17
- 2025Finite State Automata Inside Transformers with Chain-of-Thought: A Mechanistic Study on State Trackingcited by 17
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
Built on by
Citing papers per year: 2026: 3.
3 papers.