Token-level Ensembling of Models with Different Vocabularies

Rachel Wicks, Kartik Ravisankar, Xinchen Yang, Philipp Koehn, Matt PostarXiv 2025 · DOI

Abstract

Ensembling multiple machine learning models typically requires them to share a common vocabulary. This constraint limits the ability to combine diverse architectures or models trained with different tokenization strategies. We present Agreement-Based Ensembling (ABE), an inference-time algorithm that enables ensembling across disparate vocabularies by coordinating token selection based on the final surface form of the text. ABE utilizes cube pruning for efficient search and a "stalled step" mechanism to synchronize models with different subword segmentations. Our results in machine translation demonstrate significant performance gains and increased robustness against hallucinations.

Introduction: The Vocabulary Barrier

In natural language processing, ensembling is a well-established technique for improving model robustness and accuracy by averaging predictions from multiple models. However, a significant limitation of traditional ensembling is the requirement for a shared vocabulary. Modern Large Language Models (LLMs) and specialized translation models often utilize distinct tokenizers, resulting in different subword segmentations for the same text. For instance, the word "tokenization" might be split into _token + ization by one model and _tok + en + iz + ation by another. This mismatch prevents direct probability distribution averaging.

Conceptual overview of Agreement-Based Ensembling (ABE) where models with different tokenizations reach a consensus on the output text.

Agreement-Based Ensembling (ABE) overcomes this barrier by shifting the focus from vocabulary indices to the "surface form" of the generated text. By forcing models to agree on the detokenized string, researchers can leverage the strengths of diverse architectures without the need for expensive retraining or complex mapping layers.

Methodology: Agreement-Based Ensembling (ABE)

ABE operates purely at inference time, requiring no additional training or architectural modifications. The algorithm is built on three core components:

1. The Global Hypothesis and Agreement

The algorithm maintains a "global hypothesis"—the detokenized string generated so far. At each decoding step, models must select tokens that, when appended to their local history, form a prefix of a valid global string. This ensures that despite different internal representations, the models are working toward a shared textual output.

2. Stalled Steps for Synchronization

A key challenge in cross-vocabulary ensembling is that models may generate subwords of varying lengths. ABE introduces "stalled steps" to handle this. If Model A generates a long subword (e.g., _problem) while Model B generates a shorter prefix (e.g., _prob), Model A enters a stalled state. It waits for Model B to generate subsequent tokens (e.g., lem) until both models reach the same point in the surface text.

The ABE mechanism showing the shared global state and a stalled step where model $m_1$ waits for $m_2$ to complete a corresponding subword sequence.

3. Efficient Search via Cube Pruning

Exhaustively searching the cross-product of two large vocabularies (e.g., 32k x 128k) is computationally prohibitive. ABE employs a variant of cube pruning to efficiently explore the most probable token combinations that satisfy the agreement constraint.

Experimental Setup

The researchers evaluated ABE primarily on Machine Translation (MT) tasks, specifically English-to-German (en-de), and extended the evaluation to Czech, Spanish, and Ukrainian. The study utilized:

  • Custom Models: Transformer-base models trained on 600M lines of English-German data with varying vocabulary sizes (8k to 64k).
  • Public Models: A diverse set of architectures including M2M, NLLB (encoder-decoder), and Tower/Llama 3.x (decoder-only LLMs).

Key Results and Insights

ABE consistently outperformed traditional interpolation-based ensembling (where applicable) and individual models.

  • Performance Gains: On English-German translation, ensembling a bilingual model with Llama 3 8B yielded a +2.7 BLEU point increase. ABE outperformed matching-vocabulary interpolation by a margin of +1.07 BLEU vs +0.16 BLEU.
  • Hallucination Filtering: ABE acts as a natural "sanity check." Because models with different architectures and training data are unlikely to hallucinate in the exact same way, the agreement constraint effectively filters out erroneous outputs like character repetitions or nonsensical translations.
  • Cross-Architecture Synergy: The results demonstrate that ensembling specialized, smaller MT models with general-purpose LLMs leverages the structural constraints of the former and the broad knowledge of the latter.

Discussion and Limitations

While ABE provides a robust framework for cross-vocabulary ensembling, it has limitations. The algorithm is most effective in tasks with a narrow "correct" output space, such as translation. In open-ended tasks like creative writing, legitimate disagreements between models might hinder the search for consensus. Additionally, the current implementation faces challenges with stochastic sampling due to tokenizer-specific handling of whitespaces. While cube pruning is efficient, the computational overhead remains higher than running a single model.

Conclusion

Agreement-Based Ensembling breaks the vocabulary barrier, allowing for the combination of diverse models at inference time. By prioritizing consensus on the final text string rather than internal token indices, ABE enables a new class of ensembles that are more accurate, robust, and architecture-agnostic.

Reference: Wicks, R., Ravisankar, K., Yang, X., Koehn, P., & Post, M. (2025). Token-level Ensembling of Models with Different Vocabularies. arXiv:2502.21265v1.

Summary updated

BibTeX
@misc{wicks2025token,
  author = {Rachel Wicks and Kartik Ravisankar and Xinchen Yang and Philipp Koehn and Matt Post},
  title = {{Token-level Ensembling of Models with Different Vocabularies}},
  year = {2025},
  eprint = {2502.21265},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.21265},
}
Figure