about
Energy-Based Models for Code Generation Under Compilability Constraints (arxiv.org)
1 point by Schiphol on Jul 1, 2021 | hide | past | pdf | discuss on HN

In plain words: They treat compilability as a hard rule on top of a code-writing model trained to predict the next token, then retrain it to follow that rule. The result: more generated code compiles, while outputs stay just as varied and complex.

Abstract · Energy-Based Models for Code Generation under Compilability Constraints

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.

Tomasz Korbak, Hady Elsahar, Marc Dymetman, Germán Kruszewski
arXiv:2106.04985 · cs.LG, cs.CL, cs.NE, cs.SE · submitted Jun 9, 2021
abstract · pdf · html · Accepted for the First Workshop on Natural Language Processing for Programming, ACL 2021

add comment on HN