Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

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

About

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.

Ansong Ni, Srini Iyer, Dragomir Radev, Ves Stoyanov, Wen-tau Yih, Sida I. Wang, Xi Victoria Lin• 2023

Related benchmarks

TaskDatasetResultRank
Code GenerationMBPP (test)--
276
Text-to-SQLSpider (dev)--
100
Table Question AnsweringWikiTQ (test)
Accuracy65.8
92
Table Question AnsweringWikiTQ (dev)--
18
Math Word Problem Solution GenerationGSM8K (test)
ACC-op84.5
17
Language-to-Code GenerationWikiTQ official (test)
Execution Accuracy62.9
12
Table-based Question AnsweringWikiTableQuestions 17 (test)
Accuracy65.8
12
Language-to-Code GenerationWikiTQ official (dev)
Execution Accuracy61.1
11
Table Question AnsweringWikiTableQuestions (WTQ) complete (test)
Accuracy65.8
11
Language-to-Code GenerationGSM8k (dev)
Execution Accuracy84.1
4
Showing 10 of 11 rows

Other info

Code

Follow for update