Towards Verified Code Reasoning by LLMs
On the map: LLM reasoning → Reasoning for agents, planning and code
also in 1 more
Abstract (arXiv)
While LLM-based agents are able to tackle a wide variety of code reasoning questions, the answers are not always correct. This prevents the agent from being useful in situations where high precision is desired: (1) helping a software engineer understand a new code base, (2) helping a software engineer during code review sessions, and (3) ensuring that the code generated by an automated code generation system meets certain requirements (e.g. fixes a bug, improves readability, implements a feature). As a result of this lack of trustworthiness, the agent's answers need to be manually verified before they can be trusted. Manually confirming responses from a code reasoning agent requires human effort and can result in slower developer productivity, which weakens the assistance benefits of the agent. In this paper, we describe a method to automatically validate the answers provided by a code reasoning agent by verifying its reasoning steps. At a very high level, the method consists of extracting a formal representation of the agent's response and, subsequently, using formal verification and program analysis tools to verify the agent's reasoning steps. We applied this approach to a benchmark set of 20 uninitialized variable errors detected by sanitizers and 20 program equivalence queries. For the uninitialized variable errors, the formal verification step was able to validate the agent's reasoning on 13/20 examples, and for the program equivalence queries, the formal verification step successfully caught 6/8 incorrect judgments made by the agent.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 17 of its 35 references that are in the map. First posted on arXiv 30 Sep 2025.
Builds on
17 of 35 references.
Closest ancestors · 5
Same direction, newest first
- 2025Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMs26 Feb
- 2025EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking18 Feb
- 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMs2 Oct
- 2024CRQBench: A Benchmark of Code Reasoning Questions15 Aug
- 2024NExT: Teaching Large Language Models to Reason about Code Execution23 Apr
Other references · 12
- 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,796
- 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
- 2022Draft, Sketch, and Prove: Guiding Formal Theorem Provers with Informal Proofscited by 291
- 2024Don't Trust: Verify -- Grounding LLM Quantitative Reasoning with Autoformalizationcited by 55
- 2025Play Favorites: A Statistical Method to Measure Self-Bias in LLM-as-a-Judgecited by 36
- 2025CLEVER: A Curated Benchmark for Formally Verified Code Generationcited by 29
- 2024Unlocking Reasoning Potential in Large Langauge Models by Scaling Code-form Planningcited by 25
- 2024Autoformalizing Natural Language to First-Order Logic: A Case Study in Logical Fallacy Detectioncited by 18
- 2024miniCodeProps: a Minimal Benchmark for Proving Code Propertiescited by 18
- 2025Logic.py: Bridging the Gap between LLMs and Constraint Solverscited by 9
- 2025Disproving Program Equivalence with LLMscited by 5
Built on by
Citing papers per year: 2026: 4.
4 papers.
Similar, not cited
Close in wording, no citation either way
- 2026Harnessing Code Agents for Automatic Software Verification
- 2026Automating Formal Verification with Agent-Guided Tree Search
- 2026TDD-Agent: Test-Driven Reasoning for Code Generation
- 2025Agentic Verification of Software Systems
- 2025Automated Code Review Using Large Language Models with Symbolic Reasoning
- 2025A Survey on Code Generation with LLM-based Agents
- 2024SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agents
- 2026From Helpful to Trustworthy: LLM Agents for Pair Programming