Comparing Architecture Families Fairly › Getting the Denominator Right: Bits per Byte

Michael BrenndoerferNovember 17, 20264 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 138Comparing Architecture Families Fairly › Getting the Denominator Right: Bits per Byte
Reading section 10 of 16 · Getting the Denominator Right: Bits per Byte · 4 minSection 10 of 16 · 4 min

Section 10 of 16 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Hold the scored text and likelihood convention fixed before attributing a cross-tokenizer score difference.

The reason is that the metric determines what "better" means, and per-token metrics are not comparable across tokenizers. Once the metric is fixed to a shared denominator, the remaining comparisons become meaningful. Getting the denominator right is therefore the last and most important step in the protocol.

The derivation

Let x1:Bx_{1:B} be a raw UTF-8 byte string. A tokenizer TT maps it to MM tokens t1,…,tMt_1, \dots, t_M. A model assigns pθ(ti∣t<i)p_\theta(t_i \mid t_{<i}). Its total surprisal on the string is

S=−∑i=1Mlog⁡2pθ(ti∣t<i)bitsS = -\sum_{i=1}^{M} \log_2 p_\theta(t_i \mid t_{<i}) \quad \text{bits}

where:

  • BB: the number of bytes in the raw UTF-8 string
  • MM: the number of tokens the tokenizer produces for that string
  • tit_i: the ii-th token
  • pθ(ti∣t<i)p_\theta(t_i \mid t_{<i}): the model's probability for token tit_i given the preceding tokens
  • SS: the total surprisal (negative log-likelihood) in bits

Bits per byte is simply

BPB=SB=MB⋅SM\text{BPB} = \frac{S}{B} = \frac{M}{B} \cdot \frac{S}{M}

where:

  • BPB\text{BPB}: the number of bits needed per UTF-8 byte, the shared-denominator metric
  • M/BM/B: the reciprocal of bytes per token
  • S/MS/M: the mean bits per token

The first factor is the reciprocal of bytes per token. The second is mean bits per token, which is log⁡2\log_2 of the per-token perplexity. So

BPB=log⁡2PPLtokenbytes per token\text{BPB} = \frac{\log_2 \text{PPL}_{\text{token}}}{\text{bytes per token}}

where:

  • PPLtoken\text{PPL}_{\text{token}}: exp of mean negative log likelihood in nats, or two raised to the mean in bits
  • bytes per token: the average number of UTF-8 bytes each token represents

At four bytes per position, token perplexity 1,024 gives 2.5 bits per byte. At one byte per position the same rate gives perplexity 22.52^{2.5}, about 5.66. The token perplexities differ by about 181 while surprisal per scored byte agrees.

A raw perplexity rank depends on tokenization. Converting to bits per byte requires the scored byte count, position count and compatible scoring conventions. The fixed byte denominator preserves segmentation's effect on assigned probabilities.

Match the Scored Text

Score the same UTF-8 bytes in each run. Fix normalization, whitespace policy, the context supplied to the model, which spans are scored, and how you handle the beginning and end of each document. Count every byte in the shared scored span. Exclude padding and model-control symbols from byte counts and disclose how their probabilities enter the numerator.

Report whether you scored the canonical tokenizer path or the marginal probability of the raw text. Canonical tokenization defines a deterministic sequence to score. Multiple token sequences can decode to the same text, so the likelihood of that one path may be lower than the sum over all such sequences. This distinction matters when you claim to compare normalized string probabilities.

Treat the tokenizer as part of the system. Its vocabulary and segmentation affect both the probability assigned to the scored path and the compute required to score it. Bits per byte allows a shared denominator while preserving those effects. Aggregate by summing total bits over the same held-out documents and dividing by their total scored bytes.

Report the Likelihood Estimator

A locally normalized autoregressive model gives a product of conditional probabilities for the observed sequence under the declared encoding and termination convention. A blockwise model can do the same if it specifies a normalized block factorization whose probabilities can be evaluated.

A diffusion or iterative-refinement sampler may also define a normalized distribution over its final outputs through the law of total probability. Exact observation probabilities can still be expensive to compute because many latent paths reach the same output. An evidence lower bound is a lower bound on log likelihood for the stated model and objective. Taking its negative and changing the logarithm base yields a corresponding upper bound on negative log likelihood in bits. Division by the positive count of scored bytes preserves the inequality.

Keep exact values, bounds and estimates labeled in the report. If a model or scorer supplies only a bound, state the objective and schedule. If you use importance sampling, describe the proposal and sample budget and report the uncertainty of the estimator. For a positive unbiased likelihood estimate with an integrable logarithm, Jensen’s inequality gives a downward bias in the log likelihood whenever the estimate varies. When likelihoods are unavailable or their definitions differ, use a shared task metric with a fixed decoding configuration and disclose how many attempts each model receives.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy