Recent advances in leveraging LLMs for APR have demonstrated impressive capabilities in fixing software defects. However, current LLM-based approaches predominantly focus on mainstream programming languages like Java and Python, neglecting less prevalent but emerging languages such as Rust due to expensive training resources, limited datasets, and insufficient community support. This narrow focus creates a significant gap in repair capabilities across the programming language spectrum, where the full potential of LLMs for comprehensive multilingual program repair remains largely unexplored. To address this limitation, we introduce a novel cross-language program repair approach LANTERN that leverages LLMs' differential proficiency across languages through a multi-agent iterative repair paradigm. Our technique strategically translates defective code from languages where LLMs exhibit weaker repair capabilities to languages where they demonstrate stronger performance, without requiring additional training. A key innovation of our approach is an LLM-based decision-making system that dynamically selects optimal target languages based on bug characteristics and continuously incorporates feedback from previous repair attempts. We evaluate our method on xCodeEval, a comprehensive multilingual benchmark comprising 5,068 bugs across 11 programming languages. Results demonstrate significant enhancement in repair effectiveness, particularly for underrepresented languages, with Rust showing a 22.09% improvement in Pass@10 metrics. Our research provides the first empirical evidence that cross-language translation significantly expands the repair capabilities of LLMs and effectively bridges the performance gap between programming languages with different levels of popularity, opening new avenues for truly language-agnostic automated program repair.
翻译:近年来,利用LLM进行自动程序修复取得了显著进展,在修复软件缺陷方面展现出强大能力。然而,当前的LLM修复方法主要集中于Java和Python等主流编程语言,由于训练资源昂贵、数据集有限及社区支持不足,往往忽视了Rust等使用率较低但正在兴起的语言。这种局限性在编程语言谱系中造成了显著的修复能力差距,LLM在多语言程序修复方面的全部潜力仍未被充分发掘。为突破这一限制,我们提出了一种新颖的跨语言程序修复方法LANTERN,该方法通过多智能体迭代修复范式,有效利用LLM在不同语言间的差异化修复能力。我们的技术核心在于:将有缺陷的代码从LLM修复能力较弱的语言,策略性地翻译至其表现更强的语言,且无需额外训练。本方法的一个关键创新在于基于LLM的决策系统,该系统能根据缺陷特征动态选择最优目标语言,并持续整合先前修复尝试的反馈信息。我们在xCodeEval基准上评估了该方法,该基准包含11种编程语言的5,068个缺陷,是一个全面的多语言测试集。实验结果表明,该方法显著提升了修复效果,尤其在代表性不足的语言上表现突出,其中Rust在Pass@10指标上实现了22.09%的提升。我们的研究首次提供了实证证据,表明跨语言翻译能显著扩展LLM的修复能力,并有效弥合不同流行度编程语言间的性能差距,为真正实现语言无关的自动程序修复开辟了新途径。