ChatPaper.aiChatPaper

CodeCircuit: 帰属グラフによるLLM生成コードの正当性推論に向けて

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

February 6, 2026
著者: Yicheng He, Zheng Zhao, Zhou Kaiyu, Bryan Dai, Jie Fu, Yonghui Yang
cs.AI

要旨

現在のコード検証のパラダイムは、実行ベースの単体テストや補助的LLM評価など、外部メカニズムに大きく依存している。これらは労力を要するか、評価モデル自身の能力に制限されることが多い。この状況は、基本的でありながら未探査の疑問を提起する:LLMの機能的正しさを、その内部計算構造のみから評価することは可能か?本研究の主目的は、コード生成時にモデルの神経ダイナミクスが、論理的正当性を予測可能な内部復号可能な信号を符号化しているかどうかを調査することである。機械論的解釈可能性に着想を得て、我々はコード検証を機械論的診断タスクと見なし、モデルの明示的アルゴリズム軌跡を行単位の帰属グラフにマッピングすることを提案する。複雑な残留フローを分解することで、モデル内部回路において、健全な推論と論理的失敗を区別する構造的シグネチャの同定を目指す。Python、C++、Javaにわたる分析により、内在的正しさの信号が多様な構文にわたって頑健であることを確認した。これらの内部グラフから得られる位相的特徴は、表面的ヒューリスティックスよりも信頼性高く正しさを予測し、誤った論理を修正するための標的型因果介入を可能にする。これらの発見は、生成コードを検証するための手段として、内部内省が復号可能な特性であることを立証する。コードはhttps://github.com/bruno686/CodeCircuitにある。
English
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.
PDF62February 11, 2026