RefineStat: Efficient Exploration for Probabilistic Program Synthesis
Madhav Kanda, Shubham Ugare, Sasa Misailovic
Abstract
Probabilistic programming offers a powerful framework for modeling uncertainty, yet statistical model discovery in this domain entails navigating an immense search space under strict domain-specific constraints. When small language models are tasked with generating probabilistic programs, they frequently produce outputs that suffer from both syntactic, and semantic errors, such as flawed inference constructs. Motivated by probabilistic programmers' domain expertise and debugging strategies, we introduce REFINESTAT, a language model-driven framework that enforces semantic constraints ensuring synthesized programs contain valid distributions, well-formed parameters, and then applies diagnostic-aware refinement by resampling prior or likelihood components whenever reliability checks fail. We evaluate REFINESTAT on multiple probabilistic-programming code-generation tasks using smaller language models (SLMs) and find that it produces programs that are both syntactically sound and statistically reliable, often matching or surpassing those from closed-source large language models (e.g., OpenAI o3). Our code is available at https://github.com/structuredllm/RefineStat .
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.
Lineage
- Generalization or Memorization: Data Contamination and Trustworthy Evaluation for Large Language Models cites Time Travel in LLMs: Tracing Data Contamination in Large Language Models
- Type-Constrained Code Generation with Language Models cites Synchromesh: Reliable Code Generation from Pre-trained Language Models
Builds on9
- Synchromesh: Reliable Code Generation from Pre-trained Language ModelsGabriel Poesia, Alex Polozov, Vu Le, Ashish Tiwari et al.ICLR 2022 · 200 citations
- Time Travel in LLMs: Tracing Data Contamination in Large Language ModelsShahriar Golchin, Mihai SurdeanuICLR 2024 · 165 citations
- Generalization or Memorization: Data Contamination and Trustworthy Evaluation for Large Language ModelsYihong Dong, Xue Jiang, Huanyu Liu, Zhi Jin et al.ACL Findings 2024 · 52 citations
- Automated Statistical Model Discovery with Language ModelsMichael Y. Li, Emily B. Fox, Noah D. GoodmanICML 2024 · 36 citations
- Type-Constrained Code Generation with Language ModelsNiels Mündler, Jingxuan He, Hao Wang, Koushik Sen et al.PLDI 2025 · 10 citations
Related papers
- Online and Interactive Bayesian Inference DebuggingNathanael Nussbaumer, Markus Böck, Jürgen CitoICSE 2026
- Syntactic and Semantic Control of Large Language Models via Sequential Monte CarloJoão Loula, Benjamin LeBrun, Li Du, Ben Lipkin et al.ICLR 2025
- Trace types and denotational semantics for sound programmable inference in probabilistic languagesAlexander K. Lew, Marco F. Cusumano-Towner, Benjamin Sherman, Michael Carbin et al.POPL 2020 · 30 citations
- ChopChop: A Programmable Framework for Semantically Constraining the Output of Language ModelsShaan Nagy, Timothy Zhou, Nadia Polikarpova, Loris D'AntoniPOPL 2026 · 1 citation
- Deterministic stream-sampling for probabilistic programming: semantics and verificationFredrik Dahlqvist, Alexandra Silva, William SmithLICS 2023 · 4 citations
