Byte Latent Transformer: Patches Scale Better Than Tokens

Artidoro Pagnoni, Ram Pasunuru, Pedro Rodríguez, John Nguyen, Benjamin Muller, Margaret Li, Chunting Zhou, Lili Yu, Jason Weston, Luke Zettlemoyer, Gargi Ghosh, Mike Lewis, Ari Holtzman, Srinivasan IyerarXiv 2024

Abstract

We introduce the Byte Latent Transformer (BLT), a new byte-level LLM architecture that, for the first time, matches tokenization-based LLM performance at scale with significant improvements in inference efficiency and robustness. BLT encodes bytes into dynamically sized patches, which serve as the primary units of computation. Patches are segmented based on the entropy of the next byte, allocating more compute and model capacity where increased data complexity demands it. We present the first FLOP controlled scaling study of byte-level models up to 8B parameters and 4T training bytes. Our results demonstrate the feasibility of scaling models trained on raw bytes without a fixed vocabulary. Both training and inference efficiency improve due to dynamically selecting long patches when data is predictable, along with qualitative improvements on reasoning and long tail generalization. Overall, for fixed inference costs, BLT shows significantly better scaling than tokenization-based models, by simultaneously growing both patch and model size.

Introduction

Modern Large Language Models (LLMs) almost universally rely on tokenization, typically Byte-Pair Encoding (BPE), to group characters into manageable units. While this approach enables efficient processing of long sequences, it introduces significant drawbacks. Tokenization creates a "bottleneck" for robustness, as models struggle with typos or non-standard formatting. It also leads to multilingual inequity, where some languages are represented less efficiently, and a lack of character-level awareness, hindering tasks like spelling or rhyming.

Historically, training directly on raw bytes has been computationally prohibitive due to the extreme sequence lengths. The Byte Latent Transformer (BLT) addresses this by introducing a tokenizer-free architecture that matches the performance of state-of-the-art token-based models while improving efficiency and robustness.

Architecture and Methods

BLT utilizes a "sandwich" architecture designed to process bytes efficiently through dynamic patching.

The BLT architecture uses a local encoder/decoder and a latent global transformer with entropy-based patching.

The model consists of three primary components:

  1. Local Encoder/Decoder: Lightweight transformer modules that process the raw byte stream.
  2. Latent Global Transformer: The primary compute engine that operates on patches—dynamically grouped sequences of bytes.
  3. Entropy-Based Patching: This core innovation uses a small (approx. 100M parameter) model to predict the entropy (unpredictability) of the next byte. Patch boundaries are created when entropy exceeds a threshold, typically at the start of new words or complex characters.

This mechanism allows BLT to allocate more compute to information-dense segments of text while efficiently skipping over predictable sequences, closely mimicking how humans process language.

Experimental Setup

The researchers conducted an extensive scaling study using the Llama 2 dataset (2 trillion tokens) and a new BLT-1T dataset (1 trillion tokens) compiled from public sources and Datacomp-LM. Performance was evaluated across standard benchmarks, including MMLU, HumanEval, and HellaSwag. Additionally, the CUTE benchmark was employed to specifically assess character-level understanding and robustness to noise.

Results and Scaling Analysis

BLT is the first byte-level model to demonstrate performance parity with BPE-based models like Llama 3 at the 8-billion parameter scale.

Scaling laws for BLT vs. BPE-based models (LLaMA 2/3) show performance parity at fixed inference costs.

Key findings include:

  • Inference Efficiency: For a fixed inference cost, BLT scales more effectively than tokenization-based models. It achieves comparable performance to BPE models while utilizing up to 50% fewer FLOPs during inference.
  • Robustness: BLT exhibits superior resistance to character-level noise. On a "noised" HellaSwag benchmark, BLT outperformed Llama 3 by approximately 8 percentage points.
  • Character Mastery: On the CUTE benchmark, BLT surpassed Llama 3 by over 25 points, demonstrating near-perfect performance on spelling and word manipulation tasks.

Discussion and Future Work

While BLT offers theoretical efficiency gains in FLOPs, current hardware and software stacks (e.g., CUDA) are heavily optimized for fixed-length BPE tokens. Future work will focus on optimizing "wall-clock" execution for dynamic patching. Additionally, exploring end-to-end training of the patching mechanism and the global transformer could further enhance performance. BLT represents a significant step toward removing the limitations of tokenization, enabling more robust and equitable language modeling.

Summary updated

BibTeX
@misc{pagnoni2024byte,
  author = {Artidoro Pagnoni and Ram Pasunuru and Pedro Rodríguez and John Nguyen and Benjamin Muller and Margaret Li and Chunting Zhou and Lili Yu and Jason Weston and Luke Zettlemoyer and Gargi Ghosh and Mike Lewis and Ari Holtzman and Srinivasan Iyer},
  title = {{Byte Latent Transformer: Patches Scale Better Than Tokens}},
  year = {2024},
  eprint = {2412.09871},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.09871},
}
Figure