Retrieval-Based Neural Code Generation

By Shirley Anugrah Hayati, R. Olivier, Pravalika Avvaru, Pengcheng Yin, Anthony Tomasic, Graham Neubig. 2018

122 citations recorded by the source corpus.

In models to generate program source code from natural language, representing this code in a tree structure has been a common approach. However, existing methods often fail to generate complex code correctly due to a lack of ability to memorize large and complex structures. We introduce RECODE, a method based on subtree retrieval that makes it possible to explicitly reference existing code examples within a neural code generation model. First, we retrieve sentences that are similar to input sentences using a dynamic-programming-based sentence similarity scoring method. Next, we extract n-grams of action sequences that build the associated abstract syntax tree. Finally, we increase the probability of actions that cause the retrieved n-gram action subtree to be in the predicted code. We show that our approach improves the performance on two code generation tasks by up to +2.6 BLEU.

Subfields: Artificial Intelligence, Information Systems, 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. Percy Liang
  4. Mohit Bansal
  5. Caiming Xiong
  6. Jianfeng Gao
  7. Yejin Choi
  8. Richard Socher

In Information Systems

  1. Graham Neubig
  2. Xi Victoria Lin
  3. Percy Liang
  4. Luke S. Zettlemoyer
  5. Dragomir R. Radev
  6. Tao Yu
  7. Caiming Xiong
  8. Luyu Gao

In Natural Language Processing

  1. Graham Neubig
  2. Percy Liang
  3. Luke S. Zettlemoyer
  4. Mohit Bansal
  5. Caiming Xiong
  6. Jonathan Berant
  7. Richard Socher
  8. Mirella Lapata

Citations in the corpus