---
title: Byte-level Sequential Monte Carlo
url: https://www.emergentmind.com/topics/byte-level-sequential-monte-carlo-smc
type: topic
---

# Byte-level Sequential Monte Carlo

Searching arXiv for the cited paper and closely related context.
Byte-level Sequential Monte Carlo (SMC) is a decoding-time inference method for sampling from a language-model ensemble defined over complete strings rather than local next-token decisions. In "Ensembling Language Models with Sequential Monte Carlo" [2603.05432], the method is introduced as part of a unified framework for composing $K$ language models into $f$-ensemble distributions for a wide range of functions $f\colon\mathbb{R}_{\geq 0}^{K}\to\mathbb{R}_{\geq 0}$. Its distinguishing feature is that it operates in a shared character space, specifically a shared byte alphabet, which enables ensembles of models with mismatching vocabularies and consistent sampling in the limit [2603.05432]. The method addresses a central problem in language-model ensembling: naïvely averaging next-token probabilities yields samples from a locally normalized, biased approximation of the generally intractable ensemble distribution over strings.

## 1. Global string ensembles and the failure of local normalization

The motivating claim is that naïvely averaging next-token probabilities is not the same as sampling from the true ensemble distribution over complete strings [2603.05432]. If each model $p_k$ defines a distribution over strings $x \in \mathcal X^*$, then a common decoding-time heuristic is to combine next-token probabilities at each step, for example by averaging or multiplying them locally. But this yields a distribution over prefix decisions that is only a locally normalized approximation to the desired ensemble over full strings.

The key issue is that if the ensemble over complete strings is defined first and the corresponding next-token conditionals are derived afterward, the correct next-token probability depends on the future mass of all completions. A token that looks good locally may lead to poor completions globally, and vice versa. Thus, decoding by local token averaging is a biased approximation to the intended global distribution over strings [2603.05432].

The paper illustrates this distinction with a prompt-intersection example built from “My favorite physicist is” and “My favorite author is.” Locally normalized token-by-token product ensembling tends to favor generic early completions that are individually likely under both prompts, even when the resulting full string is not globally likely under the intended intersection target. In the paper’s formulation, local scoring can over-reward prefixes like “a …” that are easy early on, rather than strings that are jointly good end-to-end.

A common misconception is that local agreement at each step is equivalent to global agreement over complete outputs. The paper directly rejects this equivalence. Byte-level SMC is designed precisely for the setting in which the intended target is the ensemble distribution over full strings rather than a heuristic over successive local decisions.

## 2. The unified $f$-ensemble framework

The method is defined within a general ensemble family parameterized by an aggregation function
\[
f:\mathbb{R}_{\ge 0}^{K}\to \mathbb{R}_{\ge 0}.
\]
Given $K$ language-model potentials $p_1,\dots,p_K$ over strings, the unnormalized ensemble score of a string $x$ is
\[
\tilde p_f(x) = f\big(p_1(x),\dots,p_K(x)\big).
\]
The normalized $f$-ensemble distribution is
\[
p_f(x) = \frac{f\big(p_1(x),\dots,p_K(x)\big)}{Z},
\qquad Z = \sum_{x' \in \mathcal X^*} f\big(p_1(x'),\dots,p_K(x')\big),
\]
assuming $0<Z<\infty$ [2603.05432].

The role of $f$ is explicit. Consensus-seeking aggregators emphasize overlap among models, whereas coverage-seeking aggregators spread mass across regions supported by any model. The paper particularly studies the generalized mean family,
\[
p^*(x)=\frac{1}{Z}\left(\sum_{k=1}^K w_k\, p_k(x)^\tau\right)^{1/\tau},
\]
with the special or limit cases $\tau\to -\infty$ for minimum, $\tau=0$ for product of experts, $\tau=1$ for mixture or sum, $\tau\to +\infty$ for maximum, $\tau=-1$ for the harmonic mean, and $\tau=2$ for the quadratic mean [2603.05432].

The paper also states a variational characterization: the generalized mean is the unique minimizer of a weighted sum of $\alpha$-divergences, with
\[
D_\alpha(p\|q) = \frac{1}{\alpha(1-\alpha)} \left( 1 - \sum_{x} p(x)^\alpha q(x)^{1-\alpha} \right),
\]
and $\tau = 1-\alpha$ [2603.05432].

This framework places byte-level SMC within a broader family of global ensemble objectives. A plausible implication is that the algorithm is not tied to a single notion of model combination; rather, it is an inference procedure for a class of string-level targets induced by $f$.

## 3. Shared byte space and tokenizer mismatch

A major practical problem in language-model ensembling is tokenizer mismatch: different models may use incompatible vocabularies, so token-level probabilities cannot be directly aligned [2603.05432]. The paper’s solution is to move to a shared character or byte space, where every model can be interpreted as a distribution over byte strings. This sidesteps vocabulary alignment entirely.

If a model is originally defined over token sequences, it is induced into a distribution over byte strings $x$ by summing over all tokenizations that decode to $x$:
\[
p_{\text{byte}}(x) = \sum_{y:\,\text{decode}(y)=x} p_{\text{tok}}(y).
\]
This is crucial because many token sequences can map to the same byte string, different models can then be compared in the same output space, and the ensemble target is well-defined over strings rather than tokenizations [2603.05432].

In practice, the paper mentions a character-to-byte mapping $\mathcal B^*$ with $\mathcal B=\{0,\dots,255\}$, so generation happens in a shared byte alphabet. The significance of this representation is operational rather than merely notational: every model can be mapped to the same byte alphabet, ensemble scoring is done on shared strings, no union-vocabulary heuristic is needed, and exact string identity, not token identity, is the unit of comparison [2603.05432].

The same section of the paper also notes the cost of this choice. Byte-level generation typically requires more steps, and computing byte probabilities from tokenized models requires marginalizing over tokenizations, so it is more expensive than token-level SMC.

## 4. Sequential importance sampling and the byte-level SMC procedure

The algorithmic objective is to sample strings from
\[
p_f(x) \propto f\big(p_1(x),\dots,p_K(x)\big),
\]
without needing to enumerate all strings [2603.05432]. Because language models are autoregressive, any string probability can be factorized into prefix conditionals. The paper defines prefix probabilities and conditional prefix probabilities for strings $x$ and prefixes $x_{<t}$, and SMC operates on partial strings while using a proposal to extend them one symbol at a time.

The importance-sampling view begins with complete strings. Proposal samples are drawn as $x^{(m)}\sim q(x)$ with importance weights
\[
w^{(m)} = \frac{\tilde p_f(x^{(m)})}{q(x^{(m)})}.
\]
Then
\[
\widehat Z = \frac1M \sum_{m=1}^M w^{(m)}
\]
is an unbiased estimator of $Z$, and the self-normalized estimate of the ensemble distribution is consistent as $M\to\infty$ [2603.05432].

Because strings are generated incrementally, the paper uses sequential importance sampling (SIS). To do this efficiently, it introduces a shaping function $s(\cdot)$ that is tractable at prefixes and guides the proposal. A standard choice is
\[
s(x)=\big(p_1(x),\dots,p_K(x)\big),
\]
but this is not itself the target distribution; it is a surrogate used to define proposal dynamics. The prefix-shaped conditional is defined as
\[
s(y\mid x) = \begin{cases} \frac{s(x)}{s(\epsilon)} & \text{if } y=\epsilon,\\[4pt] \frac{s(xy)}{s(x)} & \text{otherwise}. \end{cases}
\]
The locally optimal proposal minimizing per-step weight variance is proportional to the shaping conditional:
\[
q^*(y\mid x)\propto s(y\mid x)
\]
[2603.05432].

The concrete SMC procedure maintains $M$ particles, each a partial byte string with a weight. Initialization is
\[
(x^{(m)}, w^{(m)}, a^{(m)}) \leftarrow (\epsilon,\, 1,\, \text{alive}),
\]
where $\epsilon$ is the empty string. While some particles are unfinished, the algorithm samples the next byte
\[
y' \sim q(\cdot \mid x^{(m)}),
\]
marks the particle complete if $y'=\text{EOS}$, otherwise appends it,
\[
x^{(m)} \leftarrow x^{(m)} \circ y',
\]
and updates the weight by
\[
w^{(m)} \leftarrow w^{(m)} \cdot \frac{s(y' \mid x^{(m)}_{\text{old}})}{q(y' \mid x^{(m)}_{\text{old}})}.
\]
After each step, the effective sample size is computed as
\[
\mathrm{ESS} = \frac{\left(\sum_{m=1}^M w^{(m)}\right)^2}{\sum_{m=1}^M (w^{(m)})^2}.
\]
If $\mathrm{ESS} < \tau M$ for threshold $\tau\in(0,1)$, particles are resampled multinomially:
\[
a^{(m)} \sim \mathrm{Categorical}\!\left(\frac{w^{(1)}}{W},\dots,\frac{w^{(M)}}{W}\right),\qquad W=\sum_m w^{(m)}.
\]
Each particle is then replaced by its ancestor and its weight is reset to $W/M$. At the end,
\[
\widehat Z = \frac{1}{M}\sum_{m=1}^M w^{(m)},\qquad \widehat p_f(x)=\frac{\widehat{\tilde p}_f(x)}{\widehat Z}
\]
[2603.05432].

## 5. Correctness guarantees and the role of annihilative aggregation

Under standard importance-sampling assumptions, the method has the usual guarantees: $\widehat Z$ is unbiased for $Z$, the unnormalized target estimator is unbiased, and the self-normalized estimator is consistent as $M\to\infty$ [2603.05432]. These are the paper’s formal correctness statements for the SMC estimator.

The paper also emphasizes absolute continuity: the proposal must assign nonzero probability wherever the target does. This condition is linked to the properties of the aggregation function family. An aggregation function family is defined as annihilative if zero probability at any prefix forces zero probability at the full string. Generalized means satisfy this, which makes them compatible with the chosen shaping scheme [2603.05432].

This condition clarifies an important point about the algorithm’s scope. Byte-level SMC is not a generic decoding heuristic detached from the target distribution; its validity depends on compatibility between the target ensemble and the proposal mechanism. A plausible implication is that the algorithm’s consistency claims are tied not only to the number of particles but also to the structural relationship between the aggregation rule and the support of the proposal.

## 6. Experimental settings, empirical findings, and practical implications

The paper evaluates byte-level SMC with instruction-tuned models from three families: Llama 3.1-8B-Instruct, Qwen2.5-7B-Instruct, and Phi-4 (14B) [2603.05432]. Two ensemble settings are studied: within-model ensembles, where the same model is used with different prompts, and cross-model ensembles, where different models are used with the same prompt. The tasks are three structured generation problems: JSON Schema, BIG-Bench Hard: Word Sorting, and Spider Text-to-SQL. The experiments use 100 random instances per dataset.

Because an ensemble defines a distribution, evaluation is based on expected accuracy,
\[
\mathbb E_{x\sim p_f}\left[\mathbf 1\{x\in\mathcal Y\}\right] \approx \sum_{m=1}^M \bar w^{(m)}\mathbf 1\{x^{(m)}\in\mathcal Y\},
\]
where $\mathcal Y$ is the set of correct outputs [2603.05432]. The aggregation functions compared are four generalized-mean extremes: $\min$, product $(\tau=0)$, mixture or sum $(\tau=1)$, and $\max$. The baselines and approximations compared are the best base model, local probability averaging, locally normalized ensemble decoding, token-level SMC, and byte-level SMC. The default configuration uses $M=10$ particles, resampling threshold $0.9$, equal model weights, and 5 random seeds.

The main empirical findings are presented in four parts. First, ensembling helps most when the prompts or models are complementary and each succeeds on overlapping subsets of examples. Second, consensus-seeking ensembles, especially $\min$ and product, consistently outperform coverage-seeking methods like sum or mixture and max [2603.05432]. The paper states that this matches the prompt-intersection intuition: the useful ensemble mass is often on the intersection of model supports, not the union.

Third, for mixture or sum ensembles, expected accuracy is bounded by the weighted average of base accuracies:
\[
\mathbb E_{x\sim \sum_k w_k p_k}[\mathbf 1\{x\in\mathcal Y\}] = \sum_k w_k\, \mathbb E_{x\sim p_k}[\mathbf 1\{x\in\mathcal Y\}],
\]
so equal-weight averaging just returns the arithmetic mean of base accuracies [2603.05432]. This directly limits what probability averaging can achieve. Fourth, the paper correlates approximation quality, measured by $\log \widehat Z$, with expected accuracy. For $\min$ and product, better posterior approximation tends to correlate positively with accuracy; for sum and max, the correlation is weak or even negative [2603.05432].

The practical implications follow directly from these results. Byte-level SMC handles mismatched tokenizers by working in byte space, gives a principled way to sample from a true global ensemble distribution over strings, supports more than probability averaging, and can improve structured generation accuracy over single models and local averaging. The limitations are equally explicit: it is much more expensive than local decoding, byte-level generation increases sequence length and SMC cost, the method currently focuses on $K=2$ models in experiments, and it is evaluated on structured tasks with exact-match or execution-based metrics, so open-ended generation remains less explored [2603.05432].

Taken together, these results place byte-level SMC as a method for global ensemble inference rather than a variant of local token fusion. The paper’s bottom-line conclusion is that language-model ensembling should be defined over complete strings, not just local next-token probabilities, and that better posterior approximation improves performance when the ensemble objective is truly intersection-like [2603.05432].

Source: https://www.emergentmind.com/topics/byte-level-sequential-monte-carlo-smc