arXivDaily arXiv每日学术速递 周一至周五更新
​通知:联邦节假日调休:哥伦布日 / 原住民日(Columbus Day / Indigenous Peoples' Day),今日(13日)无更新。
arXiv 2410.10209cs.CLcs.SE

EffiCoder:通过效率感知微调增强大语言模型的代码生成能力

EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuning

University of Hong Kong(香港大学);Singapore University of Technology(新加坡科技设计大学);University of Edinburgh(爱丁堡大学);National University of Singapore(新加坡国立大学);Beijing University of Posts(北京邮电大学);University of Cambridge(剑桥大学);King’s College London(伦敦国王学院)

Dong Huang, Guangtao Zeng, Jianbo Dai, Meng Luo, Han Weng, Yuhao Qing, Heming Cui, Zhijiang Guo, Jie M. Zhang

AI总结:

针对现有代码生成方法重正确性轻效率的问题,该研究提出EffiCoder框架,通过多模型生成候选、本地执行筛选最优高效样本构建数据集微调LLM,显著提升了代码生成的正确率与运行效率。

摘要:

随着大语言模型(LLM)在代码生成领域发挥着日益重要的作用,同时提升代码的正确性与效率已变得至关重要。当前方法主要聚焦于正确性,往往忽略了效率问题。为填补这一空白,我们提出EffiCoder,通过在包含正确且高效代码样本的高质量数据集上微调LLM,同时改善这两方面的表现。我们的方法包括利用多个LLM为不同编程语言的各类任务生成多样化的候选代码解决方案,随后通过本地执行测量这些方案的运行时间和内存占用进行评估,为每个任务选择运行时间最短、内存消耗最低的代码方案作为最终输出。实验结果表明,使用Effi-Instruct进行微调后性能显著提升:例如Qwen2.5-Coder-7B-Instruct的pass@1指标从44.8%提升至57.7%,同时正确任务的平均运行时间降低了48.4%。EffiCoder为推进AI驱动的代码生成提供了可扩展且有效的解决方案,惠及软件开发与计算问题求解领域。Effi-Code的源代码已发布于https://github.com/huangd1999/EffiCoder。

英文摘要:

As large language models (LLMs) play an increasingly important role in code generation, enhancing both correctness and efficiency has become crucial. Current methods primarily focus on correctness, often overlooking efficiency. To address this gap, we introduce EffiCoder to improve both aspects by fine-tuning LLMs on a high-quality dataset comprising correct and efficient code samples. Our methodology involves leveraging multiple LLMs to generate diverse candidate code solutions for various tasks across different programming languages. We then evaluate these solutions by measuring their execution time and memory usage through local execution. The code solution with the lowest execution time and memory consumption is selected as the final output for each task. Experimental results demonstrate significant improvements when fine-tuning with Effi-Instruct. For instance, Qwen2.5-Coder-7B-Instruct's pass@1 score increases from 44.8\% to 57.7\%, while the average execution time for correct tasks decreases by 48.4\%. EffiCoder offers a scalable and effective solution for advancing AI-driven code generation, benefiting software development and computational problem-solving. The source code of Effi-Code was released at https://github.com/huangd1999/EffiCoder.

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

↑