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

ACL ARR 2024 June Submission3369 Authors

16 Jun 2024 (modified: 07 Aug 2024)ACL ARR 2024 June SubmissionEveryoneRevisionsBibTeXCC BY 4.0
Abstract: 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.
Paper Type: Long
Research Area: NLP Applications
Research Area Keywords: Code Generation, Evaluation, Program Optimization, Program Efficiency, Large Language Models
Contribution Types: Model analysis & interpretability, NLP engineering experiment, Data resources
Languages Studied: Python Programming Language, English
Submission Number: 3369
Loading