Patches instead of tokens
A byte model such as ByT5 needs no vocabulary, but its whole transformer runs once per byte, several times as often as a subword model, which runs once per token. The Byte Latent Transformer (BLT) keeps the bytes and groups them into variable-length patches. A small entropy model decides where patches start, a light local encoder turns each patch into one vector, and the large global transformer runs once per patch. Where the next byte is easy to guess, a patch grows long and costs little; where it is hard, patches are short and the big model looks more often.
The page records facebook/blt-1b. Its ids are the bytes shifted by four, after a start token with id 1; ids 0 to 3 are special, so there are 260 in all:
The strip at the top, Bytes → ids → next-byte entropy → patches, shows each byte's id, entropy bar, encoder state and patch.
Next-byte entropy
The entropy model, facebook/blt-entropy, is a small causal byte language model trained on its own: 14 layers, width 768, 12 heads, a window of 512 bytes and 99.5 M parameters. Only its predictions are used. At position it gives a distribution over the 260 ids of the next byte, and its uncertainty is the entropy of that distribution, in nats:
is 0 when the model is certain and when every id is equally likely. The Next byte after … card shows the model's eight most likely next ids at the selected position, tags the byte that really came next, and gives ; the bars over the strip show at every position against the threshold line.
The patch rule
blt-1b uses the paper's global threshold rule. Positions 0 (the start token) and 1 always start a patch; after that, position starts one when the entropy at is over :
The card The patch rule lists the config: entropy mode, no monotonicity rule (the paper's alternative, , looks for jumps instead) and no maximum patch length. In 'Tokenization turns text into numbers.' the patches after the start token are T, o, ke, n, ization␣, t, urns␣, te, xt␣, into␣, n and umbers.: the first bytes of a word are hard to guess and the rest come cheaply. In 'unbelievably', once unbe is in, the remaining 8 bytes lievably make a single patch.
The rule never looks at characters. The four bytes of the robot emoji in 'naïve café 🤖' fall into three patches, F0 9F, A4 and 96, and because the entropy after the last byte is still over , the page ends with an empty patch that the next, unseen byte would open. The rule needs only the bytes so far, so a generating model can decide each boundary as it goes; the paper notes that BPE cannot, because the same prefix can be split differently depending on what follows. Recomputed in bfloat16, the entropy model's training precision, the entropies move by at most 0.08 nats here and no boundary changes; the closest lies 0.0105 nats from .
Hash n-gram embeddings
Before the local encoder, each byte is given a vector that also knows the bytes before it. To its own embedding BLT adds one row from each of six hash n-gram tables, for to , picked by hashing the ids ending at that byte, where is the id at position and zeros stand in before the start:
The polynomial wraps around in 64-bit integers, as in BLT's code, and different n-grams can share a row. The Hash n-grams of byte … card lists, for the selected byte, each n-gram, the row it hashes to and that row's norm, and the norms of the byte embedding and of the sum. Each table has 500,002 rows of width 1024, so the six hold 3,072,012,288 parameters, more than the 1,284,608,000 of the global transformer; each byte reads only six of those rows.
The local encoder
One transformer layer, width 1024 with 16 heads, runs over the byte vectors and gives states . Each patch then becomes vectors. The maximum of its byte states, coordinate by coordinate, is projected to two queries; each query cross-attends, with 16 heads, only to the bytes of its own patch, as the Perceiver's input cross-attention does:
CrossAttn here is attention alone, from RMS-normalised queries and byte states through to its output projection, with no feed-forward layer; the queries are added to it twice, once as the cross-attention's residual and once after it, as Meta's code does. The Patch … → 2 × 1024 card draws both queries' attention weights, head by head over the patch's bytes, then the max vector and the two halves of : numbers, the width of the 25-layer global transformer. After it, a 9-layer local decoder lets every byte cross-attend to the patch outputs and predicts the next byte; the page records the encoder side only.
Patches, bytes and tokens
The strip Patching, one byte at a time walks the entropy model along the input and closes a patch whenever the next byte is hard to predict. Its bars count, per input, ByT5's ids (the bytes plus one), BLT's patches including the start token's, and GPT-2's tokens: 38 / 13 / 7 for the English sentence, 13 / 5 / 4 for 'unbelievably', 18 / 10 / 6 for 'naïve café 🤖', 16 / 11 / 9 for the Japanese and 14 / 11 / 7 for the indented code. On these five short inputs BLT's patches are shorter than GPT-2's tokens, between 1.3 and 3.1 bytes on average; the threshold, not a vocabulary, sets the trade-off, and a higher would give longer patches.
Where BLT came from
Nawrot et al. (2023) pooled characters into segments of varying length, with boundaries learned end to end or supervised by tokenizers or by spikes in entropy. MEGABYTE (2023) ran a global model over byte patches of a fixed size, with a small local model inside each. SpaceByte (2024) started a patch after each space-like byte, so roughly once per word. BLT takes its boundaries straight from the entropies of a separately trained model and adds hash n-gram embeddings. Its paper runs the first FLOP-controlled scaling study of byte-level models, up to 8B parameters and 4T training bytes, and reports matching Llama 3 at equal training compute with up to 50 % fewer FLOPs at inference. The ByT5 and GPT-2 tabs show the bytes without patches and the BPE tokens it compares with.
Papers
- Byte Latent Transformer: Patches Scale Better Than Tokens Introduces BLT: entropy patching with a separate byte model, hash n-gram embeddings, the local encoder and decoder around a global transformer, and its scaling study.
- MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers A global transformer over fixed-size byte patches with a local model inside each, the design BLT makes dynamic.
- Efficient Transformers with Dynamic Token Pooling Pools characters into segments of varying length, with boundaries learned end to end or supervised by tokenizers or entropy spikes.
- SpaceByte: Towards Deleting Tokenization from Large Language Modeling Runs the large transformer blocks only after space-like bytes, the space patching BLT compares with.
- Perceiver: General Perception with Iterative Attention Cross-attention from a few query vectors to a long input, which BLT's local encoder follows to pool each patch.
- Learning to rank with (a lot of) word features The work the BLT paper cites for mapping n-grams to embedding rows by hashing.
- ByT5: Towards a token-free future with pre-trained byte-to-byte models A transformer on one token per byte, the sequence length BLT's patches shorten; the page counts its ids beside the patches.