Synchromesh: Reliable code generation from pre-trained language models
Gabriel Poesia, Oleksandr Polozov, Vu Le, Ashish Tiwari, Gustavo, Soares, Christopher Meek, Sumit Gulwani

TL;DR
Synchromesh enhances the reliability of code generation from pre-trained language models by combining semantic example retrieval and constrained decoding, significantly reducing errors and enforcing language rules.
Contribution
It introduces Target Similarity Tuning for semantic example selection and Constrained Semantic Decoding to improve code generation accuracy without retraining models.
Findings
Improved code synthesis accuracy with GPT-3 and Codex
Effective enforcement of syntax, scope, and typing constraints
Significant reduction in run-time errors
Abstract
Large pre-trained language models have been used to generate code,providing a flexible interface for synthesizing programs from natural language specifications. However, they often violate syntactic and semantic rules of their output language, limiting their practical usability. In this paper, we propose Synchromesh: a framework for substantially improving the reliability of pre-trained models for code generation. Synchromesh comprises two components. First, it retrieves few-shot examples from a training bank using Target Similarity Tuning (TST), a novel method for semantic example selection. TST learns to recognize utterances that describe similar target programs despite differences in surface natural language features. Then, Synchromesh feeds the examples to a pre-trained language model and samples programs using Constrained Semantic Decoding (CSD): a general framework for…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
Taxonomy
TopicsSoftware Engineering Research · Topic Modeling · Machine Learning and Data Classification
MethodsMulti-Head Attention · Attention Is All You Need · Linear Layer · Cosine Annealing · Dropout · Refunds@Expedia|||How do I get a full refund from Expedia? · Layer Normalization · Byte Pair Encoding · Weight Decay · Softmax
