ECCO: Can We Improve Model-Generated Code Efficiency Without Sacrificing Functional Correctness?

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Waghjale, Siddhant, Veerendranath, Vishruth, Wang, Zora Zhiruo, Fried, Daniel
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909343936413696
author Waghjale, Siddhant
Veerendranath, Vishruth
Wang, Zora Zhiruo
Fried, Daniel
author_facet Waghjale, Siddhant
Veerendranath, Vishruth
Wang, Zora Zhiruo
Fried, Daniel
contents Although large language models (LLMs) have been largely successful in generating functionally correct programs, conditioning models to produce efficient solutions while ensuring correctness remains a challenge. Further, unreliability in benchmarking code efficiency is a hurdle across varying hardware specifications for popular interpreted languages such as Python. In this paper, we present ECCO, a reproducible benchmark for evaluating program efficiency via two paradigms: natural language (NL) based code generation and history-based code editing. On ECCO, we adapt and thoroughly investigate the three most promising existing LLM-based approaches: in-context learning, iterative refinement with execution or NL feedback, and fine-tuning conditioned on execution and editing history. While most methods degrade functional correctness and moderately increase program efficiency, we find that adding execution information often helps maintain functional correctness, and NL feedback enhances more on efficiency. We release our benchmark to support future work on LLM-based generation of efficient code.
format Preprint
id arxiv_https___arxiv_org_abs_2407_14044
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle ECCO: Can We Improve Model-Generated Code Efficiency Without Sacrificing Functional Correctness?
Waghjale, Siddhant
Veerendranath, Vishruth
Wang, Zora Zhiruo
Fried, Daniel
Computation and Language
Artificial Intelligence
Although large language models (LLMs) have been largely successful in generating functionally correct programs, conditioning models to produce efficient solutions while ensuring correctness remains a challenge. Further, unreliability in benchmarking code efficiency is a hurdle across varying hardware specifications for popular interpreted languages such as Python. In this paper, we present ECCO, a reproducible benchmark for evaluating program efficiency via two paradigms: natural language (NL) based code generation and history-based code editing. On ECCO, we adapt and thoroughly investigate the three most promising existing LLM-based approaches: in-context learning, iterative refinement with execution or NL feedback, and fine-tuning conditioned on execution and editing history. While most methods degrade functional correctness and moderately increase program efficiency, we find that adding execution information often helps maintain functional correctness, and NL feedback enhances more on efficiency. We release our benchmark to support future work on LLM-based generation of efficient code.
title ECCO: Can We Improve Model-Generated Code Efficiency Without Sacrificing Functional Correctness?
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2407.14044