MEGABYTE
Byte-level transformer with a global model across patches and a small local model predicting bytes within each.
Language · 1,468 operations Structure only
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 934.4M
- Operations
- 1,468
- Framework
- PyTorch
- Recurrent
- No
- Published
- NeurIPS 2023
- Cited by
- 26 (as of 28 October 2026)
- Authors
- Lili Yu, Dániel Simig, Colin Flaherty and others
- License
- MIT
- Checked
- Structure only: shapes and data types are hypotheses, not measurements.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m18080
- Graph hash
- 1f9e2ce100c8c9eb1eb575a81037953e3f60007b8066364cb87d647a089be0c4
- Skeleton hash
- c84b5ce32334eb5df5e8259ddb9fd3f1d3eb92a5302855389b1310004269044d
- Architecture hash
- 12b300bece591d69ac111969aec7c9421273191c59088bf03e5ede59bb4f067b
- Diagram SHA-256
- e4abf6da5f1483900cd2876f524f0a7bee1960407dbaccca229187a1822bad44
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
What it is
MEGABYTE is a multiscale decoder that models raw byte sequences end to end, aimed at sequences of over one million bytes. The input is cut into fixed-size patches: a large global transformer attends across previous patches, and a smaller local transformer predicts the bytes inside each patch from the global model's output. The authors observe that most bytes are easy to predict once a word is under way, so a large network for every byte is unnecessary.
Splitting the work this way gives sub-quadratic self-attention, much larger feedforward layers for the same compute, and more parallelism during decoding. The paper reports that a MEGABYTE model with 1.5B parameters generates sequences 40% faster than a standard 350M Transformer while also improving perplexity at the same training compute. In its experiments, byte-level MEGABYTE models perform competitively with subword models on long-context language modeling and model audio from raw files. On ImageNet 64x64, the paper reports that it matches PerceiverAR while using only half the compute.
This model comes from the MEGABYTE-pytorch implementation, which generalizes the design so one can have multiple local models. The paper leaves scaling MEGABYTE to much larger models and datasets as future work.
Key idea. MEGABYTE showed that splitting byte sequences into patches, with a global model between patches and a local model within them, makes tokenization-free autoregressive modeling viable at scale.
- MEGABYTE
- MEGABYTE-pytorch
- byte-level language model
- multiscale transformer
- tokenization-free
- long-context language modeling
- million-byte sequences
- global and local transformer
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{yu2023megabytepredictingmillionbytesequences,
title={MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers},
author={Lili Yu and Dániel Simig and Colin Flaherty and Armen Aghajanyan and Luke Zettlemoyer and Mike Lewis},
year={2023},
eprint={2305.07185},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2305.07185},
}