TL;DR
CharED (Character-wise Ensemble Decoding) enables inference-time ensembling of heterogeneous Large Language Models (LLMs) with completely different tokenizers and vocabularies. By marginalizing token distributions into next-character probabilities, CharED allows models to be smoothly averaged character-by-character without any additional training or fine-tuning.
What Problem Does This Paper Address?
Ensembling is a classic, effective technique to combine the strengths of different models. However, ensembling modern LLMs at decoding time is surprisingly tricky:
- Tokenizer mismatch: Standard logit fusion methods (like shallow fusion or proxy tuning) require models to share the exact same vocabulary and tokenization scheme.
- Training overhead: Approaches that bypass tokenizer dependencies (such as CALM) require training cross-attention modules.
- Search latency: Methods modifying beam search (like Twist decoding) substantially increase inference latency.
Consequently, practitioners often default to resource-heavy fine-tuning to merge domain capabilities. The authors tackle this by asking: Can we fuse arbitrary LLMs at inference time at a universally shared level of abstraction—the character level?
Methods
CharED converts subword-level LLMs into character-level generators during decoding:
- Marginalization: At each step, candidate next tokens from each model $M_1$ and $M_2$ are converted into prefix strings, and probabilities for their immediate next character are summed to produce marginal distributions $P_1$ and $P_2$.
-
Weighted Mixture: A combined next-character distribution is computed via an arithmetic weighted average: $$J = \alpha P_1 + (1 - \alpha) P_2$$ The next character $z_t$ is chosen via greedy decoding or sampling from $J$.
-
Lookup Filtering & Token Completion: Token strings inconsistent with the chosen character are dropped. Once a model completes its individual token (reaching an End-of-Token / EOT), its context is refreshed with the accumulated text, and its next-token distribution is re-queried.
Theoretical Guarantees
- Decoding Equivalence: When $\alpha = 1$, CharED produces the exact text distribution of the underlying model $M_1$.
- Tokenization Invariance: If a model's tokenizer is swapped for another that induces the same text-level probability distribution, the CharED output distribution remains unchanged.
Datasets
The authors evaluated CharED across three standard benchmarks using full test sets or representative subsets:
- HumanEval: 164 Python coding challenges evaluated using completion prompting.
- GSM8K: 1,319 grade-school math word problems evaluated via 5-shot chain-of-thought prompting.
- ToxiGen: 800 hate speech prompts sampled across 16 minority groups (50 per group). Output toxicity was scored with a
roberta-largeclassifier.
Note: No new datasets were introduced.
Key Insights and Ideas
- Universal Alignment via Characters: Characters act as a natural lowest common denominator across disparate BPE, WordPiece, and SentencePiece tokenizers.
- Confidence-Driven Steering: Because the combination uses linear probability mixtures, the model that is more confident (higher token probability concentrated on a specific character) naturally "steers" the output. For example, WizardMath dictates character choices during arithmetic reasoning, whereas Llama 2 Chat takes over when encountering adversarial prompts requiring safe refusals.
- Pareto Improvements Without Training: Ensembling domain specialists (like code and math) does not merely average their abilities—it can yield synergy where the combined model matches or slightly exceeds single-model performance in its native domain while dramatically lifting out-of-domain performance.
Key Results
The authors paired 7B-parameter models—DeepSeek Coder, WizardMath, and Llama 2 Chat—varying the blending weight $\alpha \in [0, 1]$ in steps of 0.05 using top-$k=100$ token filtering:
- DeepSeek Coder + WizardMath: At $\alpha = 0.5$, the combined model maintained roughly 68% accuracy on both HumanEval and GSM8K, whereas individual models showed steep drops on their out-of-domain task. For certain $\alpha$ values, coding performance even slightly surpassed the standalone DeepSeek Coder.
- DeepSeek Coder + Llama 2 Chat: Setting $\alpha = 0.7$ preserved full HumanEval performance while improving ToxiGen toxicity avoidance by ~10%. At $\alpha = 0.5$, full safety performance on ToxiGen was preserved while boosting HumanEval coding accuracy by 34%.
- Summed Performance Peaks: Optimal task trade-offs were reached at $\alpha = 0.5$ (Code + Math), $\alpha = 0.55$ (Code + Safety), and $\alpha = 0.45$ (Math + Safety).
Limitations and Future Work
- Pairwise Limitation: The experimental evaluation only explores combinations of two models at a time; extending the framework to $N > 2$ models remains open.
- Aggregation Formulation: CharED currently relies on an arithmetic mean; geometric means or hybrid mixtures may yield better probability calibration.
- Inference Overhead: Evaluating models character-by-character and managing asynchronous token completions increases the frequency of model queries, which may introduce latency overhead compared to pure token-level generation.
Summary updated