Research map / Probabilistic and scientific modeling / Variational and generative sampling
Syntactic and Semantic Control of Large Language Models via Sequential Monte Carlo
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes an SMC framework for controlled LM generation that incrementally applies grammar constraints, weight corrections, expensive potentials, and resampling, letting small LMs beat larger and fine-tuned models on code, SQL, goal inference, and molecule tasks.
Problem
Controlled generation from LMs under syntactic or semantic constraints requires sampling from a posterior (global product of experts) that is intractable; locally constrained decoding is greedy and sample-rerank wastes compute because constraints are applied only after full sequences are generated.
Approach
Frame constrained generation as sampling from a global product of experts over an LM prior and potentials, and approximate it with sequential Monte Carlo: extend particles with a locally constrained proposal over cheap potentials, reweight with weight corrections and expensive potentials at each step, and resample adaptively, implemented in the LM probabilistic programming language (genlm-control)
Key results
- Full SMC with Llama 3.1 8B reaches 0.577 on molecular synthesis versus 0.132 for the base LM and 0.404 for Full IS, and 0.419 on goal inference versus 0.063 for the base LM.
- With 10 particles, Full SMC outperforms Full IS with 50 particles in goal inference (0.419 vs 0.393) and matches or beats it in data science and molecular synthesis.
- Small Llama 3.2 1B with Full SMC reaches 0.517 on molecular synthesis, and Llama 3.1 8B SMC reaches 0.285 on data science versus 0.213 for the 70B base LM.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| add a grammar constraint (ablation) | Base LM · Planetarium goal inference | accuracy: 0.063 -> 0.086 | Helped |
| add a grammar constraint (ablation) | Base LM · GDB-17 molecular synthesis | QED: 0.132 -> 0.189 | Helped |
| add a grammar constraint (ablation) | Base LM · Spider development | execution accuracy: 0.531 -> 0.559 | Helped |
| add an expensive potential (ablation) | Grammar-only SMC · Planetarium goal inference | accuracy: 0.401 -> 0.419 | Helped |
| add an expensive potential (ablation) | Grammar-only SMC · GDB-17 molecular synthesis | QED: 0.205 -> 0.577 | Helped |
| add an expensive potential (ablation) | Full SMC · DS-1000 data science | accuracy | Helped |
| add an expensive potential (ablation) | Grammar-only IS · Spider development | execution accuracy: 0.597 -> 0.618 | Helped |
| add weight correction (ablation) | Locally constrained decoding · Spider development | execution accuracy: 0.559 -> 0.597 | Helped |
| add weight correction (ablation) | Sample-Rerank · Planetarium goal inference | accuracy | No clear effect |
| add weight correction (ablation) | Sample-Rerank · GDB-17 molecular synthesis | QED | No clear effect |
| add resampling (ablation) | Full IS · Planetarium goal inference | accuracy: 0.257 -> 0.419 | Helped |
| add resampling (ablation) | Full IS · GDB-17 molecular synthesis | QED: 0.404 -> 0.577 | Helped |
Surprising findings
- Weight corrections gave only modest gains in these semantic parsing domains, and in goal inference did not significantly change performance.
- Grammar-only SMC was worse than Grammar-only IS on molecular synthesis (0.205 vs 0.228).
Limitations
- Resampling without replacement (SMC Steering) comparison was limited to one domain due to compute constraints.
- Expensive potentials can add per-token latency, up to about 30ms or more in Text-to-SQL and goal inference.
- Improvements from weight corrections are modest relative to other components.
Experimental setup
Datasets: Planetarium Blocksworld DS-1000 Spider development split GDB-17
Benchmarks: Planetarium DS-1000 Spider GDB-17
Metrics: accuracy execution accuracy QED posterior-weighted accuracy KL divergence estimate Pearson correlation between weight and score
Baselines: Base LM Locally constrained decoding Grammar-only IS Sample-Rerank Full IS SMC Steering
Builds on: LLaMPPL sequential Monte Carlo locally constrained decoding importance sampling
Closest papers by meaning
- Ensembling Language Models with Sequential Monte Carlo (NeurIPS 2026 · similarity 0.89)
- Guaranteed Generation from Large Language Models (ICLR 2025 · similarity 0.89)
- TRACE Back from the Future: A Probabilistic Reasoning Approach to Controllable Language Generation (ICML 2025 · similarity 0.88)
- Constrained Sampling for Language Models Should Be Easy: An MCMC Perspective (NeurIPS 2025 · similarity 0.88)
- Probabilistic Inference in Language Models via Twisted Sequential Monte Carlo (ICML 2024 · similarity 0.88)
- Adaptable Logical Control for Large Language Models (NeurIPS 2024 · similarity 0.88)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
