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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Huang, Dong, Zeng, Guangtao, Dai, Jianbo, Luo, Meng, Weng, Han, Qing, Yuhao, Cui, Heming, Guo, Zhijiang, Zhang, Jie M.
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911006832197632
author Huang, Dong
Zeng, Guangtao
Dai, Jianbo
Luo, Meng
Weng, Han
Qing, Yuhao
Cui, Heming
Guo, Zhijiang
Zhang, Jie M.
author_facet Huang, Dong
Zeng, Guangtao
Dai, Jianbo
Luo, Meng
Weng, Han
Qing, Yuhao
Cui, Heming
Guo, Zhijiang
Zhang, Jie M.
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2410_10209
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuning
Huang, Dong
Zeng, Guangtao
Dai, Jianbo
Luo, Meng
Weng, Han
Qing, Yuhao
Cui, Heming
Guo, Zhijiang
Zhang, Jie M.
Computation and Language
Software Engineering
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.
title EffiCoder: Enhancing Code Generation in Large Language Models through Efficiency-Aware Fine-tuning
topic Computation and Language
Software Engineering
url https://arxiv.org/abs/2410.10209