Retrieval-Based Neural Code Generation

08/29/2018
by   Shirley Anugrah Hayati, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/01/2021

Modular Tree Network for Source Code Representation Learning

Learning representation for source code is a foundation of many program ...
research
07/27/2021

Yet Another Combination of IR- and Neural-based Comment Generation

Code comment generation techniques aim to generate natural language desc...
research
06/26/2019

Program Synthesis and Semantic Parsing with Learned Code Idioms

Program synthesis of general-purpose source code from natural language s...
research
02/14/2022

CodeGen-Test: An Automatic Code Generation Model Integrating Program Test Information

Automatic code generation is to generate the program code according to t...
research
08/22/2022

Antecedent Predictions Are More Important Than You Think: An Effective Method for Tree-Based Code Generation

Code generation focuses on the automatic conversion of natural language ...
research
03/25/2023

Combining Contexts from Multiple Sources for Documentation-Specific Code Example Generation

Code example is a crucial part of good documentation. It helps the devel...
research
11/05/2021

DeSkew-LSH based Code-to-Code Recommendation Engine

Machine learning on source code (MLOnCode) is a popular research field t...

Please sign up or login with your details

Forgot password? Click here to reset