This paper introduces a more robust way to aggregate probabilistic models generated by Large Language Models (LLMs). By moving from standard Bayesian weighting to a "stacking" approach—supported by a novel variational objective—the authors show how to build model ensembles that better represent uncertainty without losing predictive power.
TL;DR
Large Language Bayes (LLB) uses LLMs to automatically write probabilistic programs, but its standard weighting scheme often collapses onto a single, potentially flawed model. This paper introduces a stacking-based approach that optimizes weights for predictive performance using a novel variational bound to handle complex latent variables, resulting in a more robust ensemble that better captures uncertainty.
What Problem Does This Paper Address?
The emerging field of Large Language Bayes (LLB) allows users to describe a statistical problem in natural language. An LLM then generates a suite of candidate probabilistic programs to solve it. Traditionally, these models are combined using Bayesian Model Averaging (BMA), where weights are proportional to how well each model fits the observed data (marginal likelihood).
However, BMA relies on the "M-closed" assumption—the idea that the "true" data-generating process is actually one of the models in your set. In reality, LLM-generated models are almost always "misspecified" (the M-open setting). In these cases, BMA tends to behave like model selection rather than averaging: it puts all its weight on a single "best" model, even if that model is still quite wrong. This leads to a "collapse" of the ensemble, where the system ignores the diversity of the generated models and under-represents the true uncertainty of the problem.
Methods
The authors propose replacing BMA with Stacking. Instead of treating weights as posterior probabilities, stacking treats them as parameters to be optimized to maximize out-of-sample predictive performance.
The key technical hurdle is that stacking typically requires "leave-one-out" (LOO) predictive quantities, which are mathematically intractable for the types of latent-variable models LLB produces. To solve this, the authors:
- Derived an ELBO-based Stacking Objective: They created a tractable variational lower bound (the Evidence Lower Bound, or ELBO) that serves as a surrogate for the LOO predictive density.
- Regularized Weighting: They added a Kullback–Leibler (KL) divergence term to the objective function. This anchors the learned weights near the original BMA weights, preserving the "inductive bias" of the LLM while allowing the data to redistribute mass where it improves prediction.
The full pipeline, as seen in Figure 1, involves using an LLM (specifically Qwen2.5 Coder 32B) to generate NumPyro programs, fitting them with MCMC (NUTS), and then optimizing the weights using their new variational objective.
Datasets
The researchers evaluated their method on three real-world probabilistic inference tasks derived from the FEMA National Risk Index:
- Hurricane Losses
- Inland Flooding Losses
- Wildfire Losses
Each task involved predicting county-level expected annual economic losses (in millions of USD). These datasets are challenging because the losses are strictly positive and exhibit heavy-tailed variability.
Key Insights and Ideas
- Predictive vs. Evidence-Based Weighting: In misspecified settings, it is better to ask "Which combination of models predicts best?" rather than "Which model is most likely to be true?"
- Variational Surrogates Work: You don't need exact leave-one-out calculations to get the benefits of stacking. A variational approximation is stable, converges quickly (usually within 15 iterations), and provides a reliable signal for weight optimization.
- Preventing Model Collapse: Stacking naturally encourages "model combination." If two models make different types of errors, stacking can give them both weight to cancel those errors out, whereas BMA would likely pick just one.
Key Results
The authors compared their stacking method against the standard LLB (BMA) baseline.
- Weight Dispersion: Stacking significantly increased the Effective Sample Size (ESS) of the weights. While BMA almost always collapsed to an ESS of 1.0 (a single model), stacking maintained a more distributed allocation (see Figure 2).
- Predictive Accuracy: Despite distributing weight across more models, stacking matched or slightly exceeded the predictive performance of BMA across all tasks, measured by Expected Log Predictive Density (ELPD).
As shown in Table 2, the predictive scores are nearly identical, proving that you can gain a better representation of uncertainty without a "performance tax."
Limitations and Future Work
The authors acknowledge that while stacking improves weight distribution, the final ensemble is still limited by the quality and diversity of the models the LLM generates. If the LLM only produces poor models, stacking can only do so much.
Future directions include:
- Testing the approach on a wider variety of complex modeling tasks.
- Exploring input-dependent stacking, where the weights assigned to models can change depending on the specific features of a new data point.
- Investigating different regularization strategies to further refine how the LLM's prior knowledge is balanced against the observed data.
Summary updated