Energy-Based Models for Code Generation under Compilability Constraints

06/09/2021
by   Tomasz Korbak, et al.
0

Neural language models can be successfully trained on source code, leading to applications such as code completion. However, their versatile autoregressive self-supervision objective overlooks important global sequence-level features that are present in the data such as syntactic correctness or compilability. In this work, we pose the problem of learning to generate compilable code as constraint satisfaction. We define an Energy-Based Model (EBM) representing a pre-trained generative model with an imposed constraint of generating only compilable sequences. We then use the KL-Adaptive Distributional Policy Gradient algorithm (Khalifa et al., 2021) to train a generative model approximating the EBM. We conduct experiments showing that our proposed approach is able to improve compilability rates without sacrificing diversity and complexity of the generated samples.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/21/2020

A Distributional Approach to Controlled Text Generation

We propose a Distributional Approach to address Controlled Text Generati...
research
12/18/2019

Distributional Reinforcement Learning for Energy-Based Sequential Models

Global Autoregressive Models (GAMs) are a recent proposal [Parshakova et...
research
09/25/2019

Improve Language Modelling for Code Completion through Statement Level Language Model based on Statement Embedding Generated by BiLSTM

Language models such as RNN, LSTM or other variants have been widely use...
research
06/04/2021

Exposing the Implicit Energy Networks behind Masked Language Models via Metropolis–Hastings

While recent work has shown that scores from models trained by the ubiqu...
research
06/18/2021

Learning to Generate Code Sketches

Traditional generative models are limited to predicting sequences of ter...
research
12/01/2021

Controlling Conditional Language Models with Distributional Policy Gradients

Machine learning is shifting towards general-purpose pretrained generati...

Please sign up or login with your details

Forgot password? Click here to reset