LEVER: Learning to Verify Language-to-Code Generation with Execution

Ansong Ni, Srini Iyer, Dragomir Radev, Ves Stoyanov, Wen-tau Yih +2 more
2/16/2023
cs.LGcs.CLcs.PL

No official code found. Best implementation: niansong1996/lever (90 stars, MIT, last commit 2023-07-05).

Abstract

The advent of large language models trained on code (code LLMs) has led to significant progress in language-to-code generation. State-of-the-art approaches in this area combine LLM decoding with sample pruning and reranking using test cases or heuristics based on the execution results. However, it is challenging to obtain test cases for many real-world language-to-code applications, and heuristics cannot well capture the semantic features of the execution results, such as data type and value range, which often indicates the correctness of the program. In this work, we propose LEVER, a simple approach to improve language-to-code generation by learning to verify the generated programs with their execution results. Specifically, we train verifiers to determine whether a program sampled from the LLMs is correct or not based on the natural language input, the program itself and its execution results. The sampled programs are reranked by combining the verification score with the LLM generation probability, and marginalizing over programs with the same execution results. On four datasets across the domains of table QA, math QA and basic Python programming, LEVER consistently improves over the base code LLMs(4.6% to 10.9% with code-davinci-002) and achieves new state-of-the-art results on all of them.

View on arXivView PDF

Code Implementations(1)

niansong1996/leverCommunity100%
MIT

Code for paper "LEVER: Learning to Verifiy Language-to-Code Generation with Execution" (ICML'23)

908PythonFeb 16, 20233 years agoMIT

Similar Papers

Cite this paper

@article{ni2023lever,
  title  = {LEVER: Learning to Verify Language-to-Code Generation with Execution},
  author = {Ansong Ni and Srini Iyer and Dragomir Radev and Ves Stoyanov and Wen-tau Yih and Sida I. Wang and Xi Victoria Lin},
  year   = {2023},
  eprint = {2302.08468},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2302.08468v3},
  journal = {ICML 2023 2023}
}

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

Discussion