Code-Optimise: Self-Generated Preference Data for Correctness and Efficiency

Leonidas Gee, Milan Gritta, Gerasimos Lampouras, Ignacio Iacobacci
6/18/2024
cs.CL

Official code: huawei-noah/HEBO (2,776 stars, last commit 2026-01-31).

Abstract

Code Language Models have been trained to generate accurate solutions, typically with no regard for runtime. On the other hand, previous works that explored execution optimisation have observed corresponding drops in functional correctness. To that end, we introduce Code-Optimise, a framework that incorporates both correctness (passed, failed) and runtime (quick, slow) as learning signals via self-generated preference data. Our framework is both lightweight and robust as it dynamically selects solutions to reduce overfitting while avoiding a reliance on larger models for learning signals. Code-Optimise achieves significant improvements in pass@k while decreasing the competitive baseline runtimes by an additional 6% for in-domain data and up to 3% for out-of-domain data. As a by-product, the average length of the generated solutions is reduced by up to 48% on MBPP and 23% on HumanEval, resulting in faster and cheaper inference. The generated data and codebase is open-sourced at https://github.com/huawei-noah/HEBO/tree/Code_Optimise.

View on arXivView PDF

Code Implementations(1)

huawei-noah/HEBOOfficial100%

Bayesian optimisation & Reinforcement Learning library developed by Huawei Noah's Ark Lab

2,776471C++, TclSep 10, 20218 months ago

Similar Papers

Cite this paper

@article{gee2024codeoptimise,
  title  = {Code-Optimise: Self-Generated Preference Data for Correctness and Efficiency},
  author = {Leonidas Gee and Milan Gritta and Gerasimos Lampouras and Ignacio Iacobacci},
  year   = {2024},
  eprint = {2406.12502},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.12502v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.12502.svg)](https://codeofpaper.com/paper/2406.12502)

Discussion