Skip to main content
QUICK REVIEW

[论文解读] A Survey of Learning-based Automated Program Repair

Quanjun Zhang, Chunrong Fang|arXiv (Cornell University)|Jan 9, 2023
Software Engineering Research被引用 5
一句话总结

本综述全面概述了基于学习的自动化程序修复(APR)技术,这些技术利用深度学习将APR任务视为神经机器翻译问题,自动生成代码补丁。该综述系统分析了关键组件——错误定位、补丁生成、排序、验证和正确性检查,同时突出了数据集、评估指标和实际挑战,为可解释性和特征增强型APR系统未来的研究提供了切实可行的指导建议。

ABSTRACT

Automated program repair (APR) aims to fix software bugs automatically and plays a crucial role in software development and maintenance. With the recent advances in deep learning (DL), an increasing number of APR techniques have been proposed to leverage neural networks to learn bug-fixing patterns from massive open-source code repositories. Such learning-based techniques usually treat APR as a neural machine translation (NMT) task, where buggy code snippets (i.e., source language) are translated into fixed code snippets (i.e., target language) automatically. Benefiting from the powerful capability of DL to learn hidden relationships from previous bug-fixing datasets, learning-based APR techniques have achieved remarkable performance. In this paper, we provide a systematic survey to summarize the current state-of-the-art research in the learning-based APR community. We illustrate the general workflow of learning-based APR techniques and detail the crucial components, including fault localization, patch generation, patch ranking, patch validation, and patch correctness phases. We then discuss the widely-adopted datasets and evaluation metrics and outline existing empirical studies. We discuss several critical aspects of learning-based APR techniques, such as repair domains, industrial deployment, and the open science issue. We highlight several practical guidelines on applying DL techniques for future APR studies, such as exploring explainable patch generation and utilizing code features. Overall, our paper can help researchers gain a comprehensive understanding about the achievements of the existing learning-based APR techniques and promote the practical application of these techniques. Our artifacts are publicly available at \url{https://github.com/QuanjunZhang/AwesomeLearningAPR}.

研究动机与目标

  • 提供基于学习的自动化程序修复(APR)技术的系统性且最新的综述,这些技术由深度学习驱动。
  • 分析基于学习的APR流程的核心组件:错误定位、补丁生成、排序、验证和正确性检查。
  • 评估并比较APR社区中广泛使用数据集和基准评估指标。
  • 讨论关键挑战,如修复领域泛化、工业适用性以及开放科学实践。
  • 为未来APR研究提供实用指导,包括可解释的补丁生成和有效利用代码特征。

提出的方法

  • 将APR建模为神经机器翻译(NMT)任务,其中含错代码作为源序列,修复后的代码作为目标序列。
  • 利用预训练模型(如CodeBERT、GraphCodeBERT和T5)通过基于Transformer的架构来编码和生成代码补丁。
  • 采用带有注意力机制的序列到序列(Seq2Seq)模型,学习从含错代码到正确代码片段的映射。
  • 集成错误定位技术(如基于谱的或基于深度学习的方法),在补丁生成前识别可能出错的代码区域。
  • 通过静态分析、动态测试或基于大语言模型(LLM)的验证,应用生成后验证和排序模块,以过滤错误补丁。
  • 利用大规模开源代码仓库(如defects4j、CodeForces、Java-100k)对模型进行预训练和微调。

实验结果

研究问题

  • RQ1最先进的基于学习的APR系统中,关键的架构和方法学组件是什么?
  • RQ2不同深度学习模型在各类错误类型和编程语言上的表现如何?
  • RQ3基于学习的APR研究中最广泛使用哪些数据集和评估指标?
  • RQ4在工业环境中部署基于学习的APR面临的主要挑战是什么?
  • RQ5如何通过可解释性和代码特定特征提升学习补丁的可靠性和可解释性?

主要发现

  • 基于学习的APR技术相较于传统基于模式的方法取得了显著进步,尤其在处理多样且未见过的错误模式方面表现突出。
  • 在defects4j和Java-100k等大规模代码仓库上微调的模型,展现出更高的补丁生成准确率和更广泛的编程语言支持。
  • 使用预训练代码模型(如CodeBERT、GraphCodeBERT)显著提升了错误定位和补丁生成的性能。
  • 补丁验证和排序模块对于减少误报至关重要,其中动态测试和基于大语言模型的验证能有效提高修复正确率。
  • 尽管已有进展,但模型在未见过的错误类型和工业规模系统上的泛化能力仍是主要挑战。
  • 本综述识别出可解释补丁生成方面的研究空白,并呼吁更深入整合代码特定特征,以提升模型的透明度和可靠性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。