TL;DR
Ensembling language models by naively averaging token probabilities at each step is mathematically biased and struggles when models use different tokenizers. This paper introduces $f$-ensembles, a unified framework for global, string-level ensembling, and uses a byte-level Sequential Monte Carlo (SMC) algorithm to sample from it consistently. The results show that consensus-seeking ensembling strategies (like products) significantly outperform traditional probability averaging.
What Problem Does This Paper Address?
Ensembling is a classic machine learning technique to boost performance by combining multiple models. However, applying it to autoregressive language models (LMs) during decoding introduces two major challenges:
- The Vocabulary Alignment Problem: Different LMs use different tokenizers. Combining their next-token distributions directly is like mixing apples and oranges because their token spaces do not align.
- Local vs. Global Normalization Bias: Standard approaches aggregate probabilities at each individual token step (locally). This creates a systematic bias. For example, a local product rewards tokens that are individually popular early on (e.g., generic phrases like "a great guy"), rather than full sequences that are globally probable under both models (e.g., "Carl Sagan").
The authors address how to rigorously define and sample from a true global ensemble distribution over full strings, even when combining models with completely different vocabularies.
Methods
The authors propose a two-part solution:
- $f$-Ensembles Framework: They formalize model combination using a family of generalized means (including minimum, product, sum, and maximum operators). This allows them to analyze "consensus-seeking" behaviors (which focus on the intersection of what models agree on) versus "coverage-seeking" behaviors (which cover the union of model outputs).
- Byte-Level Sequential Monte Carlo (SMC): To solve vocabulary mismatch, they map tokenized LMs into a shared character/byte space. To sample from the intractable global string distribution, they use an SMC algorithm. SMC tracks multiple sequence hypotheses (particles) through time, using a local ensemble as a "shaping function" to guide the particles, and dynamically reallocates computation via resampling to focus on globally promising paths.
Datasets
The framework was evaluated on three exact-match structured text generation tasks:
- JSON Schema Conformance: Generating valid JSON matching a schema using the GlaiveAI function-calling dataset from JSONSchemaBench.
- Big-Bench Hard (BBH): The word sorting subtask (sorting a list of words alphabetically).
- Text-to-SQL: Generating SQL queries from natural language questions using the SPIDER dataset.
Key Insights and Ideas
- Local Ensembling $\neq$ Global Ensembling: As shown in Figure 1, naively multiplying token probabilities step-by-step leads to a severe mismatch with the true global intersection, often favoring generic text over correct, specific answers.
- Consensus Beats Coverage: For ensembling complementary models or prompts, consensus-seeking operators (like
minandproduct) consistently outperform coverage-seeking ones (likesumandmax). - The Hard Limit of Probability Averaging: Traditional probability averaging (
sum) is mathematically bounded by the performance of the single best base model. If one model is significantly worse, standard averaging drags the ensemble down. Consensus operators don't suffer from this bound. - Better Approximations = Better Accuracy: For consensus-seeking ensembles, improving the quality of the posterior approximation (by using more SMC particles) directly correlates with higher task accuracy.
Key Results
- Performance Gains: Token-wise SMC with consensus operators achieved significant improvements over the best single-prompt baselines across all tasks (e.g., +3.9% on JSON for Phi, +3.7% on BBH for Llama).
- Cross-Model Synergy: Ensembling different model families (e.g., Qwen, Phi, Llama) yielded even stronger results than prompt ensembling. For instance, on the SPIDER (Text-to-SQL) task, a cross-model ensemble of Qwen and Llama reached 55.5% accuracy, outperforming the best single-model baseline of 53.6%.
Limitations and Future Work
- Computational Overhead: SMC requires running multiple forward passes (particles) and managing resampling, which increases inference time. This is exacerbated at the byte level because sequences are longer and require marginalizing over tokenizations to compute byte-level probabilities.
- Scale of Experts: The empirical evaluation was limited to pairs of models ($K=2$). The dynamics of scaling to many models ($K > 2$) remain unexplored.
- Task Constraints: The approach was only tested on structured text generation tasks with objective, binary correctness criteria. Evaluating this framework on open-ended generation tasks (like creative writing or dialogue) is an open challenge.
Summary updated