Generating Pragmatic Examples to Train Neural Program Synthesizers
Abstract
Programming-by-example is the task of synthesizing a program that is consistent with a set of user-provided input-output examples. As examples are often an under-specification of one's intent, a good synthesizer must choose the intended program from the many that are consistent with the given set of examples. Prior work frames program synthesis as a cooperative game between a listener (that synthesizes programs) and a speaker (a user choosing examples), and shows that models of computational pragmatic inference are effective in choosing the user intended programs. However, these models require counterfactual reasoning over a large set of programs and examples, which is infeasible in realistic program spaces. In this paper, we propose PraX, a novel way to amortize this search with neural networks. We sample pairs of programs and examples via self-play between listener and speaker models, and use pragmatic inference to choose informative training examples from this sample. We then use the informative dataset to train models to improve the synthesizer's ability to disambiguate user-provided examples without human supervision. We validate PraX on the challenging task of synthesizing regular expressions from example strings, and find that our method (1) outperforms models trained without choosing pragmatic examples by 23% (a 51% relative increase) (2) matches the performance of supervised learning on a dataset of pragmatic examples provided by humans, despite using no human data in training.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
4 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- LACIE: Listener-Aware Finetuning for Calibration in Large Language Models cites Multi-agent Communication meets Natural Language: Synergies between Functional and Structural Language Learning
- Identifying & Interactively Refining Ambiguous User Goals for Data Visualization Code Generation cites Program Synthesis with Pragmatic Communication
- Identifying & Interactively Refining Ambiguous User Goals for Data Visualization Code Generation cites Amortizing Pragmatic Program Synthesis with Rankings
- Amortizing Pragmatic Program Synthesis with Rankings cites Program Synthesis with Pragmatic Communication
Cited by top-tier papers4
- Pragmatics in the Era of Large Language Models: A Survey on Datasets, Evaluation, Opportunities and ChallengesBolei Ma, Yuting Li, Wei Zhou, Ziwei Gong et al.ACL 2025 · 28 citations
- LACIE: Listener-Aware Finetuning for Calibration in Large Language ModelsElias Stengel-Eskin, Peter Hase, Mohit BansalNeurIPS 2024 · 26 citations
- Amortizing Pragmatic Program Synthesis with RankingsYewen Pu, Saujas Vaduguru, Priyan Vaithilingam, Elena L. Glassman et al.ICML 2024 · 5 citations
- Identifying & Interactively Refining Ambiguous User Goals for Data Visualization Code GenerationMert Inan, Anthony Sicilia, Alex Xie, Saujas Vaduguru et al.EMNLP 2025
Builds on6
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
- DreamCoder: bootstrapping inductive program synthesis with wake-sleep library learningKevin Ellis, Catherine Wong, Maxwell I. Nye, Mathias Sablé-Meyer et al.PLDI 2021 · 97 citations
- Program Synthesis with Pragmatic CommunicationYewen Pu, Kevin Ellis, Marta Kryven, Josh Tenenbaum et al.NeurIPS 2020 · 26 citations
- Benchmarking Multimodal Regex Synthesis with Complex StructuresXi Ye, Qiaochu Chen, Isil Dillig, Greg DurrettACL 2020 · 13 citations
- Multi-agent Communication meets Natural Language: Synergies between Functional and Structural Language LearningAngeliki Lazaridou, Anna Potapenko, Olivier TielemanACL 2020 · 11 citations
Related papers
- Interactive Program Synthesis by Augmented ExamplesTianyi Zhang, London Lowmanstone, Xinyu Wang, Elena L. GlassmanUIST 2020 · 57 citations
- Multi-modal synthesis of regular expressionsQiaochu Chen, Xinyu Wang, Xi Ye, Greg Durrett et al.PLDI 2020 · 81 citations
- Grammar Filtering for Syntax-Guided SynthesisKairo Morton, William T. Hallahan, Elven Shum, Ruzica Piskac et al.AAAI 2020 · 12 citations
- Fast and Reliable Program Synthesis via User InteractionYanju Chen, Chenglong Wang, Xinyu Wang, Osbert Bastani et al.ASE 2023 · 5 citations
- SynGuar: guaranteeing generalization in programming by exampleBo Wang, Teodora Baluta, Aashish Kolluri, Prateek SaxenaFSE 2021
