Back to Bytes: Revisiting Tokenization Through UTF-8

Amit Moryossef, Clara Meister, Pavel Stepachev, Desmond ElliottarXiv 2025 · DOI

TL;DR

This paper introduces UTF8Tokenizer, a novel byte-level tokenizer that strictly uses UTF-8 byte values (0-255) as token IDs, eliminating the need for special tokens or out-of-range IDs. This approach leads to significant efficiency gains in tokenization speed and memory usage, while a proposed bit-biased embedding technique further enhances language model convergence.

What Problem Does This Paper Address?

Tokenization is a crucial preprocessing step in Natural Language Processing (NLP), converting raw text into a format that language models can understand. Traditional methods often rely on subword tokenization (like BPE), which can lead to inconsistencies and performance disparities across languages due to varying segmentation lengths and algorithmic heuristics. While byte-level tokenization offers a more uniform and language-agnostic approach by mapping text directly to byte values, prior implementations have often reintroduced complexity by using special tokens (similar to subword methods) for structural information like padding or boundaries. This paper addresses the challenge of achieving the benefits of byte-level tokenization (uniformity, efficiency) without sacrificing simplicity or introducing unnecessary overhead.

Methods

The core innovation is the UTF8Tokenizer, which adheres to a strict "bytes-only" principle. It maps text directly to its UTF-8 byte sequence, where each byte value (0-255) becomes a token ID. This eliminates the need for an expanded vocabulary or special tokens for common NLP tasks. Instead, structural information is encoded using repurposed C0 control bytes (e.g., NUL for padding, STX/ETX for start/end of text).

A key technical contribution is the bit-biased byte embeddings. This technique augments standard byte embeddings with a small linear projection of the individual bits within each byte. This projection helps the model learn structural regularities inherent in byte encodings (like the common patterns in Latin scripts or UTF-8's multi-byte structure) during training. Crucially, this bit-bias can be "folded" into the main embedding table at inference time, incurring no additional computational cost.

The implementation also leverages uint8 token storage, reducing memory requirements by 8x compared to standard int64 representations and enabling zero-copy views for faster data transfer.

Datasets

The paper uses WikiText-2 (wikitext-2-raw-v1) for training and evaluation of language models. No new benchmarks are introduced; instead, the focus is on evaluating existing tokenization strategies against their proposed method.

Key Insights and Ideas

  • Simplicity is Power: By strictly adhering to the 0-255 byte range and repurposing control characters, the UTF8Tokenizer achieves remarkable simplicity. This eliminates the need for complex vocabulary management and special token handling, making it easier to implement and share.
  • Leveraging Intrinsic Structure: The bit-biased embeddings are a clever way to exploit the inherent binary structure of bytes. This is particularly impactful for byte-level models, which otherwise lack the built-in inductive biases of subword tokenizers.
  • Efficiency Gains are Real: The combination of uint8 storage and the elimination of special tokens leads to substantial improvements in tokenization speed and memory usage, making byte-level models more practical.
  • Uniformity Across Languages: The byte-level approach inherently provides a consistent tokenization strategy across all languages, addressing a key limitation of subword methods.

Key Results

  • Speedup: The UTF8Tokenizer implementation is 14x faster than the ByT5Tokenizer in Transformers.
  • Memory Reduction: Using uint8 tokens reduces memory requirements by 8x compared to standard int64.
  • Language Model Performance: When evaluated on WikiText-2, the UTF8Tokenizer with bit-biased embeddings showed improved language model convergence, leading to lower validation loss and higher accuracy compared to a standard byte-level tokenizer. Specifically, the bit-biased approach decreased validation loss and increased byte-accuracy on all evaluation steps.
  • Inference Efficiency: Folding the bit-bias into the embedding table at inference time maintains identical 256xd parameters and latency.

Limitations and Future Work

  • C0 Byte Collisions: The paper acknowledges that in rare corpora containing meaningful C0 bytes (especially <NUL>, <STX>, <ETX>), there's a potential for collision with the control protocol. The suggested solution is to isolate or escape such content upstream.
  • Untrained Bytes: The authors note that certain byte values are rarely encountered in UTF-8 text and may be undertrained in language models. They caution against using these as additional special tokens without careful consideration, as they might need to be stripped before decoding.
  • Future Work: The paper advocates for strict byte modeling as a robust default for efficiency-centric and multilingual settings. The extensibility of the C0 control byte space is intentionally left open for researchers to introduce additional control semantics. The bit-biased embedding technique is presented as a temporary training-time augmentation, suggesting further exploration into its long-term architectural implications.

Summary updated

BibTeX
@misc{moryossef2025back,
  author = {Amit Moryossef and Clara Meister and Pavel Stepachev and Desmond Elliott},
  title = {{Back to Bytes: Revisiting Tokenization Through UTF-8}},
  year = {2025},
  eprint = {2510.16987},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.16987},
}

Loading related content...

Figure