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 answering on RubberDuckBench Mohammad et al. (2026), semi-formal reasoning achieves 87% accuracy. For fault localization on Defects4J Just et al. (2014), semi-formal reasoning improves Top-5 accuracy by 5 percentage points over standard reasoning. These results demonstrate that structured agentic reasoning enables meaningful semantic code analysis without execution, opening practical applications in RL training pipelines, code review, and static program analysis.


翻译:大型语言模型(LLM)智能体能否在不执行代码的情况下探索代码库并推理代码语义?我们研究了这种能力,称之为智能代码推理,并引入半形式化推理:一种结构化提示方法,要求智能体构建显式前提、追踪执行路径并推导形式化结论。与非结构化的思维链不同,半形式化推理充当了一种证明:智能体无法跳过案例或提出无依据的主张。我们在三项任务(补丁等价性验证、故障定位和代码问答)上进行了评估,结果表明半形式化推理在所有任务上均持续提升了准确性。在补丁等价性任务中,准确率在精选示例上从78%提升至88%,在真实世界智能体生成的补丁上达到93%,接近无需执行的强化学习奖励信号所需的可靠性水平。在RubberDuckBench(Mohammad等人,2026)的代码问答任务中,半形式化推理实现了87%的准确率。在Defects4J(Just等人,2014)的故障定位任务中,半形式化推理将Top-5准确率较标准推理提升了5个百分点。这些结果表明,结构化智能推理能够在不执行代码的情况下实现有意义的语义代码分析,为强化学习训练流程、代码审查和静态程序分析开辟了实际应用前景。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
大语言模型的智能体化推理
专知会员服务
35+阅读 · 1月21日
AI Agent,大模型时代重要落地方向, 42页ppt
专知会员服务
290+阅读 · 2023年10月12日
【机器推理可解释性】Machine Reasoning Explainability
专知会员服务
35+阅读 · 2020年9月3日
「因果推理」概述论文,13页pdf
专知
16+阅读 · 2021年3月20日
通过集成 XNNPACK 实现推理速度飞跃
TensorFlow
26+阅读 · 2020年7月30日
理解人类推理的深度学习
论智
19+阅读 · 2018年11月7日
论文浅尝 | 基于神经网络的知识推理
开放知识图谱
15+阅读 · 2018年3月12日
【强化学习】强化学习+深度学习=人工智能
产业智能官
55+阅读 · 2017年8月11日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
国家自然科学基金
18+阅读 · 2009年12月31日
VIP会员
最新内容
2025年大语言模型进展报告
专知会员服务
1+阅读 · 今天13:30
多智能体协作机制
专知会员服务
1+阅读 · 今天13:26
非对称优势:美海军开发低成本反无人机技术
专知会员服务
4+阅读 · 今天4:39
《美战争部小企业创新研究(SBIR)计划》
专知会员服务
6+阅读 · 今天2:48
《军事模拟:将军事条令与目标融入AI智能体》
专知会员服务
9+阅读 · 今天2:43
【NTU博士论文】3D人体动作生成
专知会员服务
7+阅读 · 4月24日
以色列军事技术对美国军力发展的持续性赋能
专知会员服务
8+阅读 · 4月24日
《深度强化学习在兵棋推演中的应用》40页报告
专知会员服务
14+阅读 · 4月24日
《多域作战面临复杂现实》
专知会员服务
10+阅读 · 4月24日
《印度的多域作战:条令与能力发展》报告
专知会员服务
5+阅读 · 4月24日
相关基金
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
国家自然科学基金
18+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员