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.
翻译:近期利用大语言模型进行自动程序修复的研究在修复软件缺陷方面展现出卓越能力。然而,当前基于大语言模型的方法主要集中于Java和Python等主流编程语言,由于训练资源昂贵、数据集有限及社区支持不足,往往忽视Rust等使用率较低但正在兴起的语言。这种局限性在编程语言谱系中造成了显著的修复能力断层,使得大语言模型在多语言程序修复领域的完整潜力尚未得到充分探索。为突破此限制,我们提出一种创新的跨语言程序修复方法LANTERN,该方法通过多智能体迭代修复范式,巧妙利用大语言模型在不同语言间的差异化修复能力。我们的技术策略性地将缺陷代码从大语言模型修复能力较弱的语言,翻译至其表现更强的语言,且无需额外训练。本方法的核心创新在于基于大语言模型的决策系统,该系统能根据缺陷特征动态选择最优目标语言,并持续整合先前修复尝试的反馈信息。我们在涵盖11种编程语言、包含5,068个缺陷的多语言基准测试集xCodeEval上评估了该方法。实验结果表明修复效能得到显著提升,尤其在代表性不足的语言中表现突出,其中Rust语言的Pass@10指标提升了22.09%。本研究首次提供实证证据,表明跨语言翻译能显著扩展大语言模型的修复能力,有效弥合不同流行度编程语言间的性能差距,为真正实现语言无关的自动程序修复开辟了新路径。