Large Language Models (LLMs) have achieved remarkable progress in code-related tasks. Despite their advancement, empirical evidence reveals that they still struggle with \emph{deductive code reasoning}, the ability to reason about the program execution process. While prior studies have recognized this limitation, the underlying causes remain largely underexplored. In this paper, we begin by presenting a comprehensive empirical study that reveals three key challenges undermining deductive code reasoning: (1) an intrinsic gap between generation and reasoning abilities, (2) a consistent bias towards code sources, and (3) weak zero-shot generalization on complex benchmarks. In light of these challenges, we propose \texttt{ReMind}, a multi-agent framework composed of \texttt{Mutator}, \texttt{Executor}, and \texttt{Inspector}. The \texttt{Mutator} generates code variants to mitigate bias towards code sources, the \texttt{Executor} traces variable states step-by-step to expose inconsistency, and the \texttt{Inspector} identifies problematic reasoning steps and provides control-flow refinement to bridge the intrinsic reasoning gap. Through their coordinated collaboration, \texttt{ReMind} systematically identifies and refines reasoning flaws, achieving outstanding performance and enabling robust zero-shot generalization. Extensive experiments on two benchmarks with five LLMs demonstrate the superior advantages of \texttt{ReMind} compared to baseline approaches in deductive code reasoning.


翻译:大语言模型(LLMs)在代码相关任务中取得了显著进展。然而,实证证据表明,它们在演绎式代码推理——即对程序执行过程进行推理的能力——方面仍存在困难。尽管先前研究已认识到这一局限性,但其根本原因尚未得到充分探索。本文首先通过一项全面的实证研究,揭示了削弱演绎式代码推理的三个关键挑战:(1)生成能力与推理能力之间的内在差距;(2)对代码来源的持续偏好偏差;(3)在复杂基准测试上较弱的零样本泛化能力。针对这些挑战,我们提出了ReMind,一个由Mutator、Executor和Inspector组成的多智能体框架。Mutator生成代码变体以减轻对代码来源的偏好偏差;Executor逐步追踪变量状态以暴露不一致性;Inspector识别有问题的推理步骤,并提供控制流优化以弥合内在推理差距。通过三者的协同合作,ReMind系统性地识别并修正推理缺陷,实现了卓越的性能,并支持稳健的零样本泛化。在包含五个LLM的两个基准测试上进行的大量实验表明,ReMind在演绎式代码推理方面相较于基线方法具有显著优势。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
144页ppt《扩散模型》,Google DeepMind Sander Dieleman
专知会员服务
50+阅读 · 2025年11月21日
LLM4SR:关于大规模语言模型在科学研究中的应用综述
专知会员服务
42+阅读 · 2025年1月9日
【ICML2024】TIMEX++: 通过信息瓶颈学习时间序列解释
专知会员服务
17+阅读 · 2024年5月16日
【CVPR2024】医学基础模型的低秩知识分解
专知会员服务
35+阅读 · 2024年4月29日
【ICML2023】SEGA:结构熵引导的图对比学习锚视图
专知会员服务
24+阅读 · 2023年5月10日
UTC: 用于视觉对话的任务间对比学习的统一Transformer
专知会员服务
14+阅读 · 2022年5月4日
AAAI 2022 | ProtGNN:自解释图神经网络
专知
10+阅读 · 2022年2月28日
[CVPR 2021] 序列到序列对比学习的文本识别
专知
10+阅读 · 2021年4月14日
【CVPR 2020 Oral】小样本类增量学习
专知
20+阅读 · 2020年6月26日
误差反向传播——CNN
统计学习与视觉计算组
31+阅读 · 2018年7月12日
语义分割中的深度学习方法全解:从FCN、SegNet到DeepLab
炼数成金订阅号
26+阅读 · 2017年7月10日
NLP自然语言处理(二)——基础文本分析
乐享数据DataScientists
12+阅读 · 2017年2月7日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
18+阅读 · 2024年12月27日
Arxiv
175+阅读 · 2023年4月20日
A Survey of Large Language Models
Arxiv
499+阅读 · 2023年3月31日
Arxiv
83+阅读 · 2023年3月26日
Arxiv
27+阅读 · 2023年3月17日
VIP会员
相关VIP内容
144页ppt《扩散模型》,Google DeepMind Sander Dieleman
专知会员服务
50+阅读 · 2025年11月21日
LLM4SR:关于大规模语言模型在科学研究中的应用综述
专知会员服务
42+阅读 · 2025年1月9日
【ICML2024】TIMEX++: 通过信息瓶颈学习时间序列解释
专知会员服务
17+阅读 · 2024年5月16日
【CVPR2024】医学基础模型的低秩知识分解
专知会员服务
35+阅读 · 2024年4月29日
【ICML2023】SEGA:结构熵引导的图对比学习锚视图
专知会员服务
24+阅读 · 2023年5月10日
UTC: 用于视觉对话的任务间对比学习的统一Transformer
专知会员服务
14+阅读 · 2022年5月4日
相关资讯
AAAI 2022 | ProtGNN:自解释图神经网络
专知
10+阅读 · 2022年2月28日
[CVPR 2021] 序列到序列对比学习的文本识别
专知
10+阅读 · 2021年4月14日
【CVPR 2020 Oral】小样本类增量学习
专知
20+阅读 · 2020年6月26日
误差反向传播——CNN
统计学习与视觉计算组
31+阅读 · 2018年7月12日
语义分割中的深度学习方法全解:从FCN、SegNet到DeepLab
炼数成金订阅号
26+阅读 · 2017年7月10日
NLP自然语言处理(二)——基础文本分析
乐享数据DataScientists
12+阅读 · 2017年2月7日
相关基金
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员