CodeCircuit: Toward Inferring LLM-Generated Code Correctness via Attribution Graphs

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: He, Yicheng, Zhao, Zheng, Kaiyu, Zhou, Dai, Bryan, Fu, Jie, Yang, Yonghui
Format: Preprint
Publié: 2026
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866917254887636992
author He, Yicheng
Zhao, Zheng
Kaiyu, Zhou
Dai, Bryan
Fu, Jie
Yang, Yonghui
author_facet He, Yicheng
Zhao, Zheng
Kaiyu, Zhou
Dai, Bryan
Fu, Jie
Yang, Yonghui
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2602_07080
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle CodeCircuit: Toward Inferring LLM-Generated Code Correctness via Attribution Graphs
He, Yicheng
Zhao, Zheng
Kaiyu, Zhou
Dai, Bryan
Fu, Jie
Yang, Yonghui
Software Engineering
Artificial Intelligence
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.
title CodeCircuit: Toward Inferring LLM-Generated Code Correctness via Attribution Graphs
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2602.07080