Top Pass: Improve Code Generation by Pass@k-Maximized Code Ranking

Zhi-Cun Lyu, Xin-Ye Li, Zheng Xie, Ming Li
8/11/2024
cs.AIcs.SE

No confident code implementation found for this paper.

Abstract

Code generation has been greatly enhanced by the profound advancements in Large Language Models (LLMs) recently. Nevertheless, such LLM-based code generation approaches still struggle to generate error-free code in a few tries when faced with complex problems. To address this, the prevailing strategy is to sample a huge number of candidate programs, with the hope of any one in them could work. However, users of code generation systems usually expect to find a correct program by reviewing or testing only a small number of code candidates. Otherwise, the system would be unhelpful. In this paper, we propose Top Pass, a code ranking approach that identifies potential correct solutions from a large number of candidates. Top Pass directly optimizes the pass@k loss function, enhancing the quality at the top of the candidate list. This enables the user to find the correct solution within as few tries as possible. Experimental results on four benchmarks indicate that our Top Pass method enhances the usability of code generation models by producing better ranking results, particularly achieving a 32.9\% relative improvement in pass@1 on CodeContests when compared to the state-of-the-art ranking method.

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{lyu2024pass,
  title  = {Top Pass: Improve Code Generation by Pass@k-Maximized Code Ranking},
  author = {Zhi-Cun Lyu and Xin-Ye Li and Zheng Xie and Ming Li},
  year   = {2024},
  eprint = {2408.05715},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.05715v1}
}

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

Discussion