HyperAIHyperAI

Command Palette

Search for a command to run...

3 months ago

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

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

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

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.

Code Repositories

niansong1996/lever
Official
pytorch
Mentioned in GitHub

Benchmarks

BenchmarkMethodologyMetrics
arithmetic-reasoning-on-gsm8kcode-davinci-002 175B (LEVER, 8-shot)
Accuracy: 84.5
Parameters (Billion): 175
code-generation-on-mbppcode-davinci-002 175B + LEVER
Accuracy: 68.9
semantic-parsing-on-spidercode-davinci-002 175B (LEVER)
Accuracy: 81.9
semantic-parsing-on-wikitablequestionsLEVER
Accuracy (Dev): 64.6
Accuracy (Test): 65.8
text-to-sql-on-spidercode-davinci-002 175B (LEVER)
Execution Accuracy (Dev): 81.9

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp
LEVER: Learning to Verify Language-to-Code Generation with Execution | Papers | HyperAI