Natural Language to Code Translation with Execution

By Freda Shi, Daniel Fried, Marjan Ghazvininejad, Luke S. Zettlemoyer, Sida I. Wang. 2022

181 citations recorded by the source corpus.

Generative models of code, pretrained on large corpora of programs, have shown great success in translating natural language to code (Chen et al., 2021; Austin et al., 2021; Li et al., 2022, inter alia). While these models do not explicitly incorporate program semantics (i.e., execution results) during training, they are able to generate correct solutions for many problems. However, choosing a single correct program from a generated set for each problem remains challenging. In this work, we introduce execution result–based minimum Bayes risk decoding (MBR-EXEC) for program selection and show that it improves the few-shot performance of pretrained code models on natural-language-to-code tasks. We select output programs from a generated candidate set by marginalizing over program implementations that share the same semantics. Because exact equivalence is intractable, we execute each program on a small number of test inputs to approximate semantic equivalence. Across datasets, execution or simulated execution significantly outperforms the methods that do not involve program semantics. We find that MBR-EXEC consistently improves over all execution-unaware selection methods, suggesting it as an effective approach for natural language to code translation.

Subfields: Artificial Intelligence, Information Systems, Software, Natural Language Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Graham Neubig
  2. Luke S. Zettlemoyer
  3. Mohit Bansal
  4. Percy Liang
  5. Jianfeng Gao
  6. Caiming Xiong
  7. Noah A. Smith
  8. Quoc V. Le

In Information Systems

  1. Xi Victoria Lin
  2. Wen-tau Yih
  3. Graham Neubig
  4. Dragomir R. Radev
  5. Zhi Jin
  6. Ge Li
  7. Xinyun Chen
  8. Tao Yu

In Software

  1. Xi Victoria Lin
  2. Denny Zhou
  3. Ge Li
  4. Zhi Jin
  5. Graham Neubig
  6. Armando Solar-Lezama
  7. Xinyun Chen
  8. Dipanjan Das

In Natural Language Processing

  1. Graham Neubig
  2. Luke S. Zettlemoyer
  3. Caiming Xiong
  4. Jianfeng Gao
  5. Mohit Bansal
  6. Percy Liang
  7. Richard Socher
  8. Wen-tau Yih

Citations in the corpus