Energy-Based Models for Code Generation under Compilability Constraints
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Builds on 31 of its 49 references that are in the map. First posted on arXiv 9 Jun 2021.
Builds on
31 of 49 references.
References · 31
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,898
- 2019Fine-Tuning Language Models from Human Preferencescited by 2,124
- 2015A Diversity-Promoting Objective Function for Neural Conversation Modelscited by 1,068
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2017Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learningcited by 679
- 2015Sequence Level Training with Recurrent Neural Networkscited by 568
- 2018Texygen: A Benchmarking Platform for Text Generation Modelscited by 484
- 2017A Deep Reinforced Model for Abstractive Summarizationcited by 364
- 2016Deep Reinforcement Learning for Dialogue Generationcited by 286
- 2020Unsupervised Translation of Programming Languagescited by 262
19 more
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
- 2019SPoC: Search-based Pseudocode to Codecited by 176
- 2015Visualizing and Understanding Recurrent Networkscited by 158
- 2016An Actor-Critic Algorithm for Sequence Predictioncited by 158
- 2020A Distributional Approach to Controlled Text Generationcited by 117
- 2020Residual Energy-Based Models for Text Generationcited by 95
- 2015Structured Prediction Energy Networkscited by 59
- 2018Controllable Neural Story Plot Generation via Reward Shapingcited by 49
- 2020Fast and Memory-Efficient Neural Code Completioncited by 38
- 2020ENGINE: Energy-Based Inference Networks for Non-Autoregressive Machine Translationcited by 34
- 2016Globally Normalized Transition-Based Neural Networkscited by 26
- 2021An Empirical Study on the Usage of BERT Models for Code Completioncited by 22
- 2017Reinforced Video Captioning with Entailment Rewardscited by 21
- 2014Structured Generative Models of Natural Source Codecited by 19
- 2019Distributional Reinforcement Learning for Energy-Based Sequential Modelscited by 17
- 2019Global Autoregressive Models for Data-Efficient Sequence Learningcited by 15
- 2020Residual Energy-Based Models for Textcited by 5
- 2020Code Completion using Neural Attention and Byte Pair Encodingcited by 2
Built on by
Citing papers per year: 2021: 1; 2022: 3; 2023: 4; 2024: 1; 2025: 1.
10 papers.
- 2022RL with KL penalties is better viewed as Bayesian inferencecited by 130
- 2023Execution-based Code Generation using Deep Reinforcement Learningcited by 95
- 2022On Reinforcement Learning and Distribution Matching for Fine-Tuning Language Models with no Catastrophic Forgettingcited by 80
- 2022Compilable Neural Code Generation with Compiler Feedbackcited by 46
- 2021Controlling Conditional Language Models without Catastrophic Forgettingcited by 32
- 2023Reinforcement Learning for Generative AI: A Surveycited by 11
- 2023SuperHF: Supervised Iterative Learning from Human Feedbackcited by 10
- 2023disco: a toolkit for Distributional Control of Generative Modelscited by 3
- 2024Aligning language models with human preferencescited by 1
- 2025Incorporating Inductive Biases to Energy-based Generative Modelscited by 1
- 2025Incorporating Inductive Biases to Energy-based Generative Models2 May 2025
- 2024Aligning language models with human preferences18 Apr 2024
- 2023SuperHF: Supervised Iterative Learning from Human Feedback25 Oct 2023
- 2023Reinforcement Learning for Generative AI: A Survey28 Aug 2023
- 2023disco: a toolkit for Distributional Control of Generative Models8 Mar 2023
- 2023Execution-based Code Generation using Deep Reinforcement Learning31 Jan 2023
- 2022On Reinforcement Learning and Distribution Matching for Fine-Tuning Language Models with no Catastrophic Forgetting1 Jun 2022
- 2022RL with KL penalties is better viewed as Bayesian inference23 May 2022
- 2022Compilable Neural Code Generation with Compiler Feedback10 Mar 2022
- 2021Controlling Conditional Language Models without Catastrophic Forgetting1 Dec 2021