Architecture · Efficiency

MEGABYTE

First page
MEGABYTE
Paper summary

Multiscale Transformers for predicting million-byte sequences.

Ask this paper

Key points
01

Two-level architecture: Combines a large global Transformer over patches with a smaller local Transformer over bytes within each patch.

02

Sub-quadratic attention: Achieves sub-quadratic self-attention cost through the patch-level hierarchy, enabling million-byte sequences.

03

Decoding parallelism: Improves decoding parallelism compared to flat Transformers that must decode token-by-token.

04

Tokenization-free: Operates directly on bytes without tokenizers - potentially avoiding tokenizer failure modes.

Abstract

Autoregressive transformers are spectacular models for short sequences but scale poorly to long sequences such as high-resolution images, podcasts, code, or books. We proposed Megabyte, a multi-scale decoder architecture that enables end-to-end differentiable modeling of sequences of over one million bytes. Megabyte segments sequences into patches and uses a local submodel within patches and a global model between patches. This enables sub-quadratic self-attention, much larger feedforward layers for the same compute, and improved parallelism during decoding -- unlocking better performance at reduced cost for both training and generation. Extensive experiments show that Megabyte allows byte-level models to perform competitively with subword models on long context language modeling, achieve state-of-the-art density estimation on ImageNet, and model audio from raw files. Together, these results establish the viability of tokenization-free autoregressive sequence modeling at scale.

Every Monday
Get next week’s papers.
Subscribe on Substack