arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.04114cs.CLcs.AI

面向大语言模型代码生成的多编程语言集成方法

Multi-Programming Language Ensemble for Code Generation in Large Language Model

NinjaTech AI(忍者科技人工智能)

Tengfei Xue, Xuefeng Li, Tahir Azim, Roman Smirnov, Jianhui Yu, Arash Sadrieh, Babak Pahlavan

AI总结:

提出MPLE多编程语言集成框架,将各语言代码生成视为弱专家并融合输出,可结合反思与MCTS,在HumanEval等基准上最高提升17.92%。

摘要:

大语言模型(LLM)已显著提升代码生成水平,尤其是在一次通过式代码生成方面。然而,现有多数方法仅关注生成单一编程语言的代码,忽视了利用LLM多语言能力的潜力。LLM在不同语言中会表现出不同的错误模式,这表明可以利用这些多语言输出来构建更鲁棒的方法。本研究提出多编程语言集成(Multi-Programming Language Ensemble,MPLE),这是一种新颖的基于集成的方法,利用跨多种编程语言的代码生成来提升整体性能。通过将每种语言特定的代码生成过程视为一个独立的“弱专家”,并有效整合其输出,该方法缓解了语言特定的错误和偏差。这种多语言集成策略利用不同编程语言的互补优势,使模型能够生成更准确、更鲁棒的代码。该方法还可与反思算法和蒙特卡洛树搜索等常用技术无缝结合,以进一步提升代码生成质量。实验结果表明,在现有基准(HumanEval和HumanEval-plus)上,该框架将基线性能持续提升最高达17.92%,并在HumanEval基准上取得96.25%准确率的突出结果,在多种LLM模型上均达到新的最优水平。代码将发布于https://github.com/NinjaTech-AI/MPLE。

英文摘要:

Large language models (LLMs) have significantly improved code generation, particularly in one-pass code generation. However, most existing approaches focus solely on generating code in a single programming language, overlooking the potential of leveraging the multi-language capabilities of LLMs. LLMs have varying patterns of errors across different languages, suggesting that a more robust approach could be developed by leveraging these multi-language outputs. In this study, we propose Multi-Programming Language Ensemble (MPLE), a novel ensemble-based method that utilizes code generation across multiple programming languages to enhance overall performance. By treating each language-specific code generation process as an individual "weak expert" and effectively integrating their outputs, our method mitigates language-specific errors and biases. This multi-language ensemble strategy leverages the complementary strengths of different programming languages, enabling the model to produce more accurate and robust code. Our approach can be seamlessly integrated with commonly used techniques such as the reflection algorithm and Monte Carlo tree search to improve code generation quality further. Experimental results show that our framework consistently enhances baseline performance by up to 17.92% on existing benchmarks (HumanEval and HumanEval-plus), with a standout result of 96.25% accuracy on the HumanEval benchmark, achieving new state-of-the-art results across various LLM models. The code will be released at https://github.com/NinjaTech-AI/MPLE

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑