Agentic Code Reasoning
Shubham Ugare, Satish Chandra

TL;DR
This paper introduces semi-formal reasoning, a structured prompting method for LLM agents to analyze code semantics without execution, significantly improving accuracy in code verification, fault localization, and question answering tasks.
Contribution
The paper proposes semi-formal reasoning as a novel structured prompting approach that enhances code understanding capabilities of LLM agents without executing code.
Findings
Accuracy on patch equivalence verification improved from 78% to 88%.
Semi-formal reasoning achieved 87% accuracy on RubberDuckBench.
Top-5 fault localization accuracy increased by 5 percentage points.
Abstract
Can LLM agents explore codebases and reason about code semantics without executing the code? We study this capability, which we call agentic code reasoning, and introduce semi-formal reasoning: a structured prompting methodology that requires agents to construct explicit premises, trace execution paths, and derive formal conclusions. Unlike unstructured chain-of-thought, semi-formal reasoning acts as a certificate: the agent cannot skip cases or make unsupported claims. We evaluate across three tasks (patch equivalence verification, fault localization, and code question answering) and show that semi-formal reasoning consistently improves accuracy on all of them. For patch equivalence, accuracy improves from 78% to 88% on curated examples and reaches 93% on real-world agent-generated patches, approaching the reliability needed for execution-free RL reward signals. For code question…
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 · Logic, programming, and type systems
