arXiv:2601.08545cs.AIcs.CL2026-01AAAI被引 1

针对编程初学者的错误,自动修复代码并解释原因。

Learner-Tailored Program Repair: A Solution Generator with Iterative Edit-Driven Retrieval Enhancement

  • 通过编辑驱动检索获取修复方案,引导大模型定位问题。
  • 修复代码的同时生成错误原因说明,提升理解效果。
  • 迭代优化检索方向,适合教学系统与编程辅导场景。

随着大语言模型在编程领域的应用发展,智能编程辅导系统受到广泛关注。然而,现有研究多聚焦于修复初学者的错误代码,却未揭示错误成因。为此,本文提出新任务LRP(学习者定制化程序修复),并设计有效框架LSGEN(学习者定制化解决方案生成器)。第一阶段利用修复方案检索框架构建数据库,并采用编辑驱动的代码检索方法,为大模型提供有价值的修复参考。第二阶段提出基于方案引导的修复方法,实现代码修正与原因解释。此外,引入迭代检索增强机制,根据生成代码的评估结果优化检索方向,探索更优修复策略。实验表明,该方法显著优于多个基线,在实际编程辅导场景中表现优异,验证了框架对新任务的有效性。

原文摘要 · Abstract (English)

With the development of large language models (LLMs) in the field of programming, intelligent programming coaching systems have gained widespread attention. However, most research focuses on repairing the buggy code of programming learners without providing the underlying causes of the bugs. To address this gap, we introduce a novel task, namely LRP (Learner-Tailored Program Repair). We then propose a novel and effective framework, LSGEN (Learner-Tailored Solution Generator), to enhance program repair while offering the bug descriptions for the buggy code. In the first stage, we utilize a repair solution retrieval framework to construct a solution retrieval database and then employ an edit-driven code retrieval approach to retrieve valuable solutions, guiding LLMs in identifying and fixing the bugs in buggy code. In the second stage, we propose a solution-guided program repair method, which fixes the code and provides explanations under the guidance of retrieval solutions. Moreover, we propose an Iterative Retrieval Enhancement method that utilizes evaluation results of the generated code to iteratively optimize the retrieval direction and explore more suitable repair strategies, improving performance in practical programming coaching scenarios. The experimental results show that our approach outperforms a set of baselines by a large margin, validating the effectiveness of our framework for the newly proposed LPR task.

程序修复大模型教育AI代码生成

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