Ensembling Language Models with Sequential Monte Carlo

Robin Chan, Tianyu Liu, Samuel Kiegeland, Clemente Pasti, Jacob Hoover Vigly, Timothy J. O'Donnell, Ryan Cotterell, Tim VieiraNeurIPS 2026

TL;DR

When you ask two language models to collaborate, standard methods simply average their guesses word-by-word—a greedy shortcut that mathematically caps the ensemble's accuracy below its best single model. This paper recasts language model ensembling as a global inference problem over complete strings, using Sequential Monte Carlo (SMC) in a shared byte space to combine models with completely different vocabularies. By trading simple averaging for "consensus-seeking" math, these ensembles actually achieve true synergy, consistently outperforming their strongest individual members.

What Problem Does This Paper Address?

Ensembling—combining weak predictors to make a strong one—is machine learning royalty. Naturally, we want to ensemble Large Language Models (LLMs), either by combining different model families (like Llama and Qwen) or giving different prompts to the same model.

Here is the catch: LLMs don't just predict single labels; they define probability distributions over entire strings of text. True ensembling requires aggregating predictions over all possible complete strings, an intractable sum over a countably infinite space. To dodge this, almost all prior work resorts to local ensembling: combining next-token probabilities on the fly at each step.

The authors demonstrate a fatal flaw in this greedy shortcut. Suppose you prompt GPT-2 with "My favorite physicist is" and "My favorite author is", multiplying probabilities to find physicist-authors. Local token-by-token ensembling gets distracted by generic, high-probability words early on (like "a"), happily generating "a great guy." instead of "Carl Sagan." Meanwhile, global string-level ensembling strongly correlates ($\rho = 0.958$) with the true intersection "My favorite physicist and author is", whereas local ensembling completely misses the mark ($\rho = 0.090$). Furthermore, different LLMs use different tokenizers, making even naive token-level combination a headache of vocabulary alignment heuristics.

Figure 1: Prompt intersection on GPT-2. We generate 200 strings from the normalized token-level product of “My favorite physicist is” and “My favorite author is” prompts, then score each under the local ensemble pens,local (string probabilities emerging from locally normalized token-level product ensembling) and global ensemble pens,global (normalized product of string probabilities). Left: scatter plot of log probabilities with color indicating the generated strings’ global probability relative to their local ones. We also plot completions from the author prompt ( ) and the physicist prompt ( ) that don’t overlap with the ensemble’s completions ( ). Right: Correlation with the explicitly formulated intersection constraint probability p(· | “My favorite physicist and author is”).

Methods

Instead of inventing another vocabulary-alignment heuristic, the authors treat sampling from a global string ensemble as an approximate probabilistic inference problem. Their framework has two main pillars:

  1. $f$-Ensembles via Generalized Means (Novel Framework): They unify ensemble strategies using an aggregation function $f$ parameterized by a single knob, $\tau$ (generalized means). They prove this family naturally arises from minimizing weighted sums of $\alpha$-divergences to the base models. Tuning $\tau$ shifts the ensemble's philosophy: $\tau > 0$ (like standard probability averaging at $\tau=1$, or max) is coverage-seeking (spreading probability across the union of models), while $\tau \le 0$ (like product of experts at $\tau \to 0$, or min at $\tau \to -\infty$) is consensus-seeking (concentrating mass strictly where models agree).
  2. Byte-Level Sequential Monte Carlo (Novel Application): Because we cannot normalize over infinite strings directly, the authors deploy SMC—a standard particle-filtering algorithm—to sample from $f$-ensembles. The algorithm maintains $M$ parallel candidate sequences ("particles"), extending them step-by-step using a tractable "shaping function" (applying $f$ to prefix probabilities) and periodically resampling to kill off dead-end strings and duplicate globally promising ones. Crucially, when models have different tokenizers, they project every model down to a shared byte space, allowing exact, apples-to-apples ensembling across any model families.

Datasets

The authors evaluate on five existing text-generation benchmarks (no new datasets are introduced):

  • Text-to-SQL (Spider): Translating natural language into executable SQL queries.
  • GSM8K: Multi-step grade-school math word problems.
  • Big-Bench Hard (BBH): Specifically, the alphabetical word-sorting subtask.
  • MMLU: Multiple-choice questions across 57 academic subjects.
  • JSON (JSONSchemaBench / GlaiveAI): Generating documents that strictly obey a target JSON schema.

Key Insights and Ideas

  • Probability averaging is mathematically doomed when models are unequal: Standard token-averaging ensembles ($\tau=1$) are bounded by the weighted average of the base models' accuracies. With equal weights, mixing a 70%-accurate model and a 50%-accurate model caps your expected accuracy at 60%! This neatly explains why prior ensembling baselines mysteriously degrade when base models have a performance gap.
  • Consensus beats coverage: Because consensus-seeking functions ($\tau \le 0$, like min and product) act like a logical AND gate—suppressing outputs unless all experts assign them reasonable probability—they filter out individual model hallucinations and break past the best-base-model ceiling.
  • Better inference actually buys higher accuracy (for consensus): As you add more SMC particles, your approximation gets closer to the true global string distribution. For consensus-seeking ensembles, better posterior approximations directly correlate with higher task accuracy. For averaging ensembles, better inference actually correlates slightly negatively with accuracy, dragging performance down toward the theoretical average ceiling.

Key Results

Evaluating across Llama-3.1-8B, Qwen2.5-7B, and Phi-4 (14B) using just $M=10$ SMC particles:

  • True Synergy: Both within-model (two prompts) and cross-model ensembles consistently beat the best individual model across tasks (except MMLU). For example, within-model min ensembling on Llama boosts BBH accuracy by +6.1%, Text-to-SQL by +5.5%, and JSON generation by +3.6% over the best single prompt.
  • Crushing Token-Averaging Baselines: In cross-model settings (byte-level SMC), consensus $f$-ensembles substantially outperform recent token-alignment averaging baselines like UniTE and GaC, which remain trapped below the average base-model accuracy line.
  • Inference Quality Matters: On Llama BBH, approximation quality (estimated $\log Z$) correlates positively with expected accuracy for min ($\rho = 0.311$) and product ($\rho = 0.278$), while correlating negatively for sum ($\rho = -0.154$).
Figure 2: Two-prompt within-model ensemble vs. base model performance across tasks and models with 95% CIs across 5 seeds.

Limitations and Future Work

In the provided main text (pages 1–10), a formal "Limitations and Future Work" section is not included (likely residing in the appendices). However, two practical boundaries surface in the experiments:

  • Task Complementarity: Ensembling shows no gains on MMLU. The authors note that ensembling helps when experts perform moderately and complementarily on examples; when one model already aces a question (or both fail), concentrating on their intersection offers little upside, such as in constrained multiple-choice settings.
  • Compute Overhead: Running $M$ particles across $K$ models requires more compute than single-model greedy decoding, and byte-level cross-model SMC relies on a beam-based approximation to marginalize token sequences into bytes.

Summary updated

Abstract

Combining the predictions of multiple models is one of the most effective strategies in machine learning. Thus, it is only natural to investigate the ensembling of language models (LMs). However, because LMs define distributions over strings, a proper ensemble requires aggregating predictions at the string level, which requires a computation that is generally intractable. In this work, we cast LM ensembling as an inference problem and propose the deployment of sequential Monte Carlo (SMC), an appropriate approximate inference scheme. Concretely, we introduce a unified framework for composing multiple LMs into ensemble distributions parameterized by a broad family of aggregation functions. To sample from these distributions, we introduce an SMC algorithm that operates in a shared byte space, enabling ensembles of models with mismatching vocabularies and consistent sampling in the limit. We evaluate a range of ensembles across prompt and model combinations for various text generation tasks, finding that consensus-seeking strategies such as the product consistently outperform probability averaging, and that better posterior approximations can yield better ensemble performance.
BibTeX
@inproceedings{chan2026ensembling,
  author = {Robin Chan and Tianyu Liu and Samuel Kiegeland and Clemente Pasti and Jacob Hoover Vigly and Timothy J. O'Donnell and Ryan Cotterell and Tim Vieira},
  title = {{Ensembling Language Models with Sequential Monte Carlo}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=zWigIoVsHo},
}

Loading related content...

Figure