Synchromesh: Reliable code generation from pre-trained language models
Not on the map. Why?
Abstract (arXiv)
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 constraining the output to a set of valid programs in the target language. CSD leverages constraints on partial outputs to sample complete correct programs, and needs neither re-training nor fine-tuning of the language model. We evaluate our methods by synthesizing code from natural language descriptions using GPT-3 and Codex in three real-world languages: SQL queries, Vega-Lite visualizations and SMCalFlow programs. These domains showcase rich constraints that CSD is able to enforce, including syntax, scope, typing rules, and contextual logic. We observe substantial complementary gains from CSD and TST in prediction accuracy and in effectively preventing run-time errors.
Key facts. Cited by 156 papers in the map (data through 7 Oct 2026). Builds on 20 of its 30 references that are in the map. First posted on arXiv 26 Jan 2022.
Builds on
20 of 30 references.
References · 20
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
- 2020Making Pre-trained Language Models Better Few-shot Learnerscited by 1,255
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2019RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parserscited by 420
8 more
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
- 2021Constrained Language Models Yield Few-Shot Semantic Parserscited by 162
- 2020Task-Oriented Dialogue as Dataflow Synthesiscited by 122
- 2020SmBoP: Semi-autoregressive Bottom-up Semantic Parsingcited by 97
- 2021Provable Limitations of Acquiring Meaning from Ungrounded Form: What Will Future Language Models Understand?cited by 55
- 2021In-IDE Code Generation from Natural Language: Promise and Challengescited by 41
- 2021Collecting and Characterizing Natural Language Utterances for Specifying Data Visualizationscited by 31
- 2016Latent Attention For If-Then Program Synthesiscited by 10
Built on by
Citing papers per year: 2022: 21; 2023: 47; 2024: 28; 2025: 39; 2026: 21.
156 papers.
Sort:
By area:
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 352
- 2022CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learningcited by 342
- 2023Large Language Model Alignment: A Surveycited by 241
- 2023Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Modelscited by 237
- 2023Efficient Guided Generation for Large Language Modelscited by 192
- 2022Language Models of Code are Few-Shot Commonsense Learnerscited by 160
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
- 2023Unified Demonstration Retriever for In-Context Learningcited by 141
- 2022Text and Patterns: For Effective Chain of Thought, It Takes Two to Tangocited by 128
- 2023Rephrase and Respond: Let Large Language Models Ask Better Questions for Themselvescited by 123
- 2022Prompting Is Programming: A Query Language for Large Language Modelscited by 110
38 more
- 2023Learning Performance-Improving Code Editscited by 103
- 2023SatLM: Satisfiability-Aided Language Models Using Declarative Promptingcited by 100
- 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 99
- 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 79
- 2023AutomaTikZ: Text-Guided Synthesis of Scientific Vector Graphics with TikZcited by 74
- 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Modelscited by 73
- 2024In-context Learning with Retrieved Demonstrations for Language Models: A Surveycited by 69
- 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
- 2025JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Modelscited by 66
- 2024Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wiselycited by 65
- 2023Strategic Reasoning with Language Modelscited by 64
- 2022Parsel: Algorithmic Reasoning with Language Models by Composing Decompositionscited by 62
- 2024Generating CAD Code with Vision-Language Models for 3D Designscited by 61
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2022TIARA: Multi-grained Retrieval for Robust Question Answering over Large Knowledge Basescited by 59
- 2023GPT4AIGChip: Towards Next-Generation AI Accelerator Design Automation via Large Language Modelscited by 59
- 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
- 2023NS3D: Neuro-Symbolic Grounding of 3D Objects and Relationscited by 57
- 2023How to Prompt LLMs for Text-to-SQL: A Study in Zero-shot, Single-domain, and Cross-domain Settingscited by 57
- 2023Copiloting the Copilots: Fusing Large Language Models with Completion Engines for Automated Program Repaircited by 55
- 2023How Do In-Context Examples Affect Compositional Generalization?cited by 51
- 2024Automata-based constraints for language model decodingcited by 49
- 2022In-Context Learning for Few-Shot Dialogue State Trackingcited by 47
- 2023Skill-Based Few-Shot Selection for In-Context Learningcited by 46
- 2023LILO: Learning Interpretable Libraries by Compressing and Documenting Codecited by 46
- 2024Learning Formal Mathematics From Intrinsic Motivationcited by 45
- 2025Syntactic and Semantic Control of Large Language Models via Sequential Monte Carlocited by 45
- 2025Flexible and Efficient Grammar-Constrained Decodingcited by 42
- 2023Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inferencecited by 40
- 2023March in Chat: Interactive Prompting for Remote Embodied Referring Expressioncited by 34
- 2024PURPLE: Making a Large Language Model a Better SQL Writercited by 34
- 2022XRICL: Cross-lingual Retrieval-Augmented In-Context Learning for Cross-lingual Text-to-SQL Semantic Parsingcited by 32
- 2023Data Formulator: AI-powered Concept-driven Visualization Authoringcited by 31
- 2024On the Challenges and Opportunities in Generative AIcited by 31
- 2022Repairing Bugs in Python Assignments Using Large Language Modelscited by 28
- 2024IterGen: Iterative Semantic-aware Structured LLM Generation with Backtrackingcited by 28
- 2024From Language Models over Tokens to Language Models over Characterscited by 28
- 2025Learning to Generate Structured Output with Schema Reinforcement Learningcited by 27
50 most cited of 156 All 156 (JSON)
- 2026JevSpawn: Adaptive Agentic Inference through Compositional Action Spaces30 Sep 2026
- 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learning30 Sep 2026
- 2026TemplateCraft: Agentic Visual Template Generation25 Sep 2026
- 2026Meta-Ctrl: Guaranteed Plan Generation by Decoupling Syntactic and Semantic Constraints23 Aug 2026
- 2026From Dependency to Compositionality: A Neurosymbolic Lifting of LLM Outputs via Combinatory Categorial Grammar21 Jul 2026
- 2026PEARL: Auditable Repair for Scientific Reasoning Graph Extraction20 Jul 2026
- 2026Constrained Decoding for Diffusion Language Models via Efficient Inference over Finite Automata8 Jul 2026
- 2026Cycle-Consistent Neural Explanation of Formal Verification Certificates23 Jun 2026
- 2026Text2DSL: LLM-Based Code Generation for Domain-Specific Languages21 Jun 2026
- 2026Context-Aware Distillation and Ablation for Text2DSL21 Jun 2026
- 2026Quantum-Inspired Trace-Augmented Evidence Selection for Reasoning over Structured Hypothesis Spaces5 Jun 2026
- 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposals1 Jun 2026
38 more
- 2026CourseBlueprint: A Structured Pipeline for Adaptive Pedagogical Video Generation Grounded in Course Corpora22 May 2026
- 2026Verifier-Guided Code Translation via Meta-Step Decoding17 May 2026
- 2026Cross-Dialect Generalization Without Retraining: Benchmarks and Evaluation of Schema-Derived Constrained Decoding for MLIR14 May 2026
- 2026NCO: A Versatile Plug-in for Handling Negative Constraints in Decoding11 May 2026
- 2026To Know is to Construct: Schema-Constrained Generation for Agent Memory22 Apr 2026
- 2026HYVE: Hybrid Views for LLM Context Engineering over Machine Data7 Apr 2026
- 2026Vectorizing the Trie: Efficient Constrained Decoding for LLM-based Generative Retrieval on Accelerators26 Feb 2026
- 2026On the Power of (Approximate) Reward Models for Inference-Time Scaling1 Feb 2026
- 2026XGrammar-2: Dynamic and Efficient Structured Generation Engine for Agentic LLMs7 Jan 2026
- 2025Anka: A Domain-Specific Language for Reliable LLM Code Generation29 Dec 2025
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025Bootstrapping Fuzzers for Compilers of Low-Resource Language Dialects Using Language Models5 Dec 2025
- 2025RL-Struct: A Lightweight Reinforcement Learning Framework for Reliable Structured Output in LLMs29 Nov 2025
- 2025TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code Generation27 Nov 2025
- 2025SemanticForge: Repository-Level Code Generation through Semantic Knowledge Graphs and Constraint Satisfaction10 Nov 2025
- 2025UTF-8 Plumbing: Byte-level Tokenizers Unavoidably Enable LLMs to Generate Ill-formed UTF-85 Nov 2025
- 2025ORANGE: An Online Reflection ANd GEneration framework with Domain Knowledge for Text-to-SQL2 Nov 2025
- 2025Metamodel-Guided Model Generation with Layered Constraints29 Oct 2025
- 2025ECO: Enhanced Code Optimization via Performance-Aware Prompting for Code-LLMs12 Oct 2025
- 2025RefineStat: Efficient Exploration for Probabilistic Program Synthesis1 Sep 2025
- 2025Analysis of Error Sources in LLM-based Hypothesis Search for Few-Shot Rule Induction31 Aug 2025
- 2025Type-Compliant Adaptation Cascades: Adapting Programmatic LM Workflows to Data25 Aug 2025
- 2025Correctness-Guaranteed Code Generation via Constrained Decoding20 Aug 2025
- 2025Constrained Decoding of Diffusion LLMs with Context-Free Grammars13 Aug 2025
- 2025Automated Code Review Using Large Language Models with Symbolic Reasoning24 Jul 2025
- 2025Making Logic a First-Class Citizen in Generative ML for Networking30 Jun 2025
- 2025Earley-Driven Dynamic Pruning for Efficient Structured Decoding1 Jun 2025
- 2025DINGO: Constrained Inference for Diffusion LLMs29 May 2025
- 2025Citation Parsing and Analysis with Language Models21 May 2025
- 2025Multi-Level Aware Preference Learning: Enhancing RLHF for Complex Multi-Instruction Tasks19 May 2025
- 2025Guiding LLM-based Smart Contract Generation with Finite State Machine13 May 2025
- 2025Assessing and Enhancing the Robustness of LLM-based Multi-Agent Systems Through Chaos Engineering6 May 2025
- 2025Semantic Probabilistic Control of Language Models4 May 2025
- 2025Syntactic and Semantic Control of Large Language Models via Sequential Monte Carlo17 Apr 2025
- 2025HELIOS: Adaptive Model And Early-Exit Selection for Efficient LLM Inference Serving14 Apr 2025
- 2025Self-Steering Language Models9 Apr 2025
- 2025Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Sampling7 Apr 2025
- 2025AdaCoder: An Adaptive Planning and Multi-Agent Framework for Function-Level Code Generation5 Apr 2025
50 newest of 156 All 156 (JSON)
- 2022Language Models of Code are Few-Shot Commonsense Learnerscited by 160
- 2022Text and Patterns: For Effective Chain of Thought, It Takes Two to Tangocited by 128
- 2023SatLM: Satisfiability-Aided Language Models Using Declarative Promptingcited by 100
- 2023Strategic Reasoning with Language Modelscited by 64
- 2022Parsel: Algorithmic Reasoning with Language Models by Composing Decompositionscited by 62
- 2023How Do In-Context Examples Affect Compositional Generalization?cited by 51
- 2025Self-Steering Language Modelscited by 13
- 2023Certified Deductive Reasoning with Language Modelscited by 8
- 2024RuAG: Learned-rule-augmented Generation for Large Language Modelscited by 4
- 2026On the Power of (Approximate) Reward Models for Inference-Time Scalingcited by 4
- 2026Verifier-Guided Code Translation via Meta-Step Decodingcited by 1
- 2025Automated Code Review Using Large Language Models with Symbolic Reasoningcited by 0
12 most cited of 15 All 15 (JSON)
- 2026JevSpawn: Adaptive Agentic Inference through Compositional Action Spaces30 Sep 2026
- 2026PEARL: Auditable Repair for Scientific Reasoning Graph Extraction20 Jul 2026
- 2026Quantum-Inspired Trace-Augmented Evidence Selection for Reasoning over Structured Hypothesis Spaces5 Jun 2026
- 2026Verifier-Guided Code Translation via Meta-Step Decoding17 May 2026
- 2026On the Power of (Approximate) Reward Models for Inference-Time Scaling1 Feb 2026
- 2025Automated Code Review Using Large Language Models with Symbolic Reasoning24 Jul 2025
- 2025Self-Steering Language Models9 Apr 2025
- 2024RuAG: Learned-rule-augmented Generation for Large Language Models4 Nov 2024
- 2023Certified Deductive Reasoning with Language Models6 Jun 2023
- 2023Strategic Reasoning with Language Models30 May 2023
- 2023SatLM: Satisfiability-Aided Language Models Using Declarative Prompting16 May 2023
- 2023How Do In-Context Examples Affect Compositional Generalization?8 May 2023
12 newest of 15 All 15 (JSON)
- 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Modelscited by 73
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2025AdaCoder: An Adaptive Planning and Multi-Agent Framework for Function-Level Code Generationcited by 8
- 2025Assessing and Enhancing the Robustness of LLM-based Multi-Agent Systems Through Chaos Engineeringcited by 6
- 2026XGrammar-2: Dynamic and Efficient Structured Generation Engine for Agentic LLMscited by 6
- 2025EICopilot: Search and Explore Enterprise Information over Large-scale Knowledge Graphs with LLM-driven Agentscited by 2
- 2026To Know is to Construct: Schema-Constrained Generation for Agent Memorycited by 1
- 2026TemplateCraft: Agentic Visual Template Generationcited by 0
- 2026TemplateCraft: Agentic Visual Template Generation25 Sep 2026
- 2026To Know is to Construct: Schema-Constrained Generation for Agent Memory22 Apr 2026
- 2026XGrammar-2: Dynamic and Efficient Structured Generation Engine for Agentic LLMs7 Jan 2026
- 2025Assessing and Enhancing the Robustness of LLM-based Multi-Agent Systems Through Chaos Engineering6 May 2025
- 2025AdaCoder: An Adaptive Planning and Multi-Agent Framework for Function-Level Code Generation5 Apr 2025
- 2025EICopilot: Search and Explore Enterprise Information over Large-scale Knowledge Graphs with LLM-driven Agents23 Jan 2025
- 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Models22 Nov 2024
- 2024Agents in Software Engineering: Survey, Landscape, and Vision13 Sep 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 352
- 2024Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wiselycited by 65
- 2022XRICL: Cross-lingual Retrieval-Augmented In-Context Learning for Cross-lingual Text-to-SQL Semantic Parsingcited by 32
- 2025LLM Program Optimization via Retrieval Augmented Searchcited by 4
- 2025LLM Program Optimization via Retrieval Augmented Search31 Jan 2025
- 2024Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wisely23 Sep 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Survey29 Feb 2024
- 2022XRICL: Cross-lingual Retrieval-Augmented In-Context Learning for Cross-lingual Text-to-SQL Semantic Parsing25 Oct 2022
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
- 2022CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learningcited by 342
- 2023Efficient Guided Generation for Large Language Modelscited by 192
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
- 2023Unified Demonstration Retriever for In-Context Learningcited by 141
- 2023Rephrase and Respond: Let Large Language Models Ask Better Questions for Themselvescited by 123
- 2022Prompting Is Programming: A Query Language for Large Language Modelscited by 110
- 2023Learning Performance-Improving Code Editscited by 103
- 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 99
- 2023Sequential Monte Carlo Steering of Large Language Models using Probabilistic Programscited by 79
- 2023AutomaTikZ: Text-Guided Synthesis of Scientific Vector Graphics with TikZcited by 74
- 2024In-context Learning with Retrieved Demonstrations for Language Models: A Surveycited by 69
12 most cited of 121 All 121 (JSON)
- 2026GrammarRL: Effective Grammar-Constrained Decoding via Reinforcement Learning30 Sep 2026
- 2026Meta-Ctrl: Guaranteed Plan Generation by Decoupling Syntactic and Semantic Constraints23 Aug 2026
- 2026From Dependency to Compositionality: A Neurosymbolic Lifting of LLM Outputs via Combinatory Categorial Grammar21 Jul 2026
- 2026Cycle-Consistent Neural Explanation of Formal Verification Certificates23 Jun 2026
- 2026Text2DSL: LLM-Based Code Generation for Domain-Specific Languages21 Jun 2026
- 2026Context-Aware Distillation and Ablation for Text2DSL21 Jun 2026
- 2026Mitigating Bias in Locally Constrained Decoding via Tractable Proposals1 Jun 2026
- 2026CourseBlueprint: A Structured Pipeline for Adaptive Pedagogical Video Generation Grounded in Course Corpora22 May 2026
- 2026Cross-Dialect Generalization Without Retraining: Benchmarks and Evaluation of Schema-Derived Constrained Decoding for MLIR14 May 2026
- 2026NCO: A Versatile Plug-in for Handling Negative Constraints in Decoding11 May 2026
- 2026HYVE: Hybrid Views for LLM Context Engineering over Machine Data7 Apr 2026
- 2026Vectorizing the Trie: Efficient Constrained Decoding for LLM-based Generative Retrieval on Accelerators26 Feb 2026
12 newest of 121 All 121 (JSON)