arXiv:2603.09951cs.LGcs.AI2026-03被引 1

让大模型像真实调试器一样互动式执行代码,支持断点和单步操作。

Towards a Neural Debugger for Python

  • 用大模型模拟传统调试器,支持断点、步入、步过等操作。
  • 在CruxEval上实现输出与输入的精准预测,验证条件执行建模能力。
  • 适合构建智能编程助手或自动化调试系统,推动代码生成发展。

将大语言模型(LLMs)训练于Python执行轨迹,使其具备逐行执行预测能力,可视为神经解释器(FAIR CodeGen团队,2025)。然而开发者通常不全程执行,而是通过调试器在关键位置暂停、检查变量并选择性执行。现有神经解释器缺乏这种交互控制。为此,我们提出神经调试器:能够模拟传统调试器行为的语言模型,支持函数步入、步过、步出及在特定源码行设置断点。通过微调大模型或从零预训练小模型,我们证明神经调试器能可靠建模正向执行(预测未来状态与输出)与逆向执行(基于调试动作推断前序状态或输入)。在CruxEval上的评估显示,模型在输出与输入预测任务中表现优异,验证了其条件执行建模能力。本工作为未来代理式编程系统奠定基础,使神经调试器作为模拟调试环境的世界模型,提供执行反馈或与真实调试工具交互,助力更强大的代码生成、程序理解与自动化调试。

原文摘要 · Abstract (English)

Training large language models (LLMs) on Python execution traces grounds them in code execution and enables the line-by-line execution prediction of whole Python programs, effectively turning them into neural interpreters (FAIR CodeGen Team et al., 2025). However, developers rarely execute programs step by step; instead, they use debuggers to stop execution at certain breakpoints and step through relevant portions only while inspecting or modifying program variables. Existing neural interpreter approaches lack such interactive control. To address this limitation, we introduce neural debuggers: language models that emulate traditional debuggers, supporting operations such as stepping into, over, or out of functions, as well as setting breakpoints at specific source lines. We show that neural debuggers -- obtained via fine-tuning large LLMs or pre-training smaller models from scratch -- can reliably model both forward execution (predicting future states and outputs) and inverse execution (inferring prior states or inputs) conditioned on debugger actions. Evaluated on CruxEval, our models achieve strong performance on both output and input prediction tasks, demonstrating robust conditional execution modeling. Our work takes first steps towards future agentic coding systems in which neural debuggers serve as a world model for simulated debugging environments, providing execution feedback or enabling agents to interact with real debugging tools. This capability lays the foundation for more powerful code generation, program understanding, and automated debugging.

神经调试器代码生成大模型应用智能编程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。