CodeLutra: Boosting LLM Code Generation via Preference-Guided Refinement

Leitian Tao, Xiang Chen, Tong Yu, Tung Mai, Ryan Rossi +2 more
11/7/2024
cs.CL

No confident code implementation found for this paper.

Abstract

Large Language Models (LLMs) have revolutionized code generation but require significant resources and often over-generalize, limiting their task-specific efficiency. Fine-tuning smaller, open-source LLMs provides a cost-effective alternative. However, standard supervised approaches rely only on correct examples, missing valuable insights from failures. We introduce CodeLutra, a framework that leverages both correct and incorrect code attempts. Instead of using only correct solutions, CodeLutra applies iterative preference-based refinement, comparing successful and failed outputs to better approximate desired results. This approach narrows the performance gap with state-of-the-art larger models without requiring massive datasets or auxiliary models. For instance, on a challenging data science coding task, using only 500 samples improved Llama-3-8B's accuracy from 28.2% to 48.6%, approaching GPT-4's level. By learning from both successes and mistakes, CodeLutra provides a scalable and efficient path to high-quality code generation, making smaller open-source models more competitive with leading closed-source alternatives.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tao2024codelutra,
  title  = {CodeLutra: Boosting LLM Code Generation via Preference-Guided Refinement},
  author = {Leitian Tao and Xiang Chen and Tong Yu and Tung Mai and Ryan Rossi and Yixuan Li and Saayan Mitra},
  year   = {2024},
  eprint = {2411.05199},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.05199v3}
}

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/2411.05199.svg)](https://codeofpaper.com/paper/2411.05199)

Discussion