基于零样本学习和MaxSAT故障定位的反例引导程序修复
Counterexample Guided Program Repair Using Zero-Shot Learning and MaxSAT-based Fault Localization
AI总结:
针对入门编程作业自动化程序修复的局限,提出结合MaxSAT故障定位与大语言模型零样本学习的反例引导方法,提升修复能力且实现更小修复,优于现有工具。
摘要:
针对入门编程作业(IPAs)的自动化程序修复(APR)受到每年大量学生选修编程课程的推动。由于为IPAs提供反馈需要教师投入大量时间和精力,个性化反馈通常包括为学生程序建议修复方案。基于形式化方法(FM)的语义修复方法通过测试套件或参考解决方案检查程序执行,虽有效但存在局限:这些工具擅长识别错误部分,但仅当正确实现与错误实现共享相同控制流图时才能修复程序。相反,大语言模型(LLMs)用于APR却常进行大量而非最小化重写,导致修复更具侵入性,使学生更难从错误中学习。本文提出一种结合FM故障定位与LLMs零样本学习的新方法:利用MaxSAT故障定位识别程序错误部分,向LLM呈现去除这些错误语句的程序草图,通过反例引导归纳综合(CEGIS)循环迭代优化程序——让LLM合成缺失部分,再用测试套件检查,若程序错误则将反例反馈给LLM。实验显示,该方法显著提升6个评估LLMs的修复能力,能修复更多程序且修复更小,优于其他配置和最先进的符号程序修复工具。
英文摘要:
Automated Program Repair (APR) for introductory programming assignments (IPAs) is motivated by the large number of student enrollments in programming courses each year. Since providing feedback on IPAs requires substantial time and effort from faculty, personalized feedback often involves suggesting fixes to students' programs. Formal Methods (FM)-based semantic repair approaches, check a program's execution against a test suite or reference solution, are effective but limited. These tools excel at identifying buggy parts but can only fix programs if the correct implementation and the faulty one share the same control flow graph. Conversely, Large Language Models (LLMs) are used for APR but often make extensive instead of minimal rewrites. This leads to more invasive fixes, making it harder for students to learn from their mistakes. In summary, LLMs excel at completing strings, while FM-based fault localization excel at identifying buggy parts of a program. In this paper, we propose a novel approach that combines the strengths of both FM-based fault localization and LLMs, via zero-shot learning, to enhance APR for IPAs. Our method uses MaxSAT-based fault localization to identify buggy parts of a program, then presents the LLM with a program sketch devoid of these buggy statements. This hybrid approach follows a CEGIS loop to iteratively refine the program. We ask the LLM to synthesize the missing parts, which are then checked against a test suite. If the suggested program is incorrect, a counterexample from the test suite is fed back to the LLM. Our experiments show that our counterexample guided approach, using MaxSAT-based bug-free program sketches, significantly improves the repair capabilities of all six evaluated LLMs. This method allows LLMs to repair more programs with smaller fixes, outperforming other configurations and state-of-the-art symbolic program repair tools.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。