MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers

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.

Paper

Similar papers

Peer review

Reviewer W4cB7/10 · confidence 4/52023-06-10

Summary

The authors propose MegaByte, a decoder style model consisting of 3 parts: patching of bytes, processing of patches (with autoregressive model), and converting patches back to bytes (with autoregressive model). Their model allows for sub-quadratic attention, more expressive models for the same flop count, faster decoding, and no need for tokenization. They show that it outperforms Transformer and Perceiver AR on byte-level modeling of language, images, and audio. There is also some indication that future language models may be able to successfully avoid tokenization entirely by using this model type.

Strengths

**Originality**: The proposed model architecture is novel. Comparison to Perceiver AR seems reasonable and shows understanding of related work in the area. **Quality**: Experiments do a good job of demonstrating the quality of the model. **Clarity**: For the most part the paper is well-written and easy to follow. **Significance**: This paper brings forward more evidence that tokenization could be avoided entirely in language modeling. It explores a well-motivated and novel architecture. It opens up some interesting possibilities for future work.

Weaknesses

Main weakness: While the paper does a laudable job of covering a lot of ground, this comes at a cost. 1. First, the paper is unclear about when the three "Extensions" proposed in Section 2.3 are used in the results tables. It would be great to have something like a table in the appendix that just tells for each MegaByte result whether each extension was used. That would help readers get a sense (beyond Figure 4) of how much heavy lifting the architecture is doing vs the extensions. 2. The paper focuses on high-level ideas (as it should) but it leaves some low-level details unclear. Here are a couple examples: * Does the local model use position embeddings (when not using cross-patch attention)? * What audio modeling dataset was used? * When the GPT-3 architecture is brought up, is that including use of locally banded sparse attention patterns? 3. In general, the results in the paper are not reproducible. With the above being said, I do want to point out that the authors have clearly made efforts along these lines as the appendix has substantial detail. A quick fix to all of my above concerns would be to (1) release code associated with the paper, and (2) to add more detail regarding when "Extensions" were used in the paper.

Questions

Please see weaknesses.

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

2 fair

Presentation

4 excellent

Contribution

4 excellent

Limitations

There is currently no substantive discussion of limitations, and it could be a helpful addition but probably not necessary.

Reviewer RJHZ7/10 · confidence 5/52023-07-06

Summary

A new auto-regressive decoder-only Transformer variant for language modeling is presented which operates well on byte level. Similar to the Vision Transformer, the main idea is to operate on patches instead of single tokens (bytes). Those patches are composed of a fixed number of $P$ tokens. Then, a big global Transformer operates on those patches, i.e. on the spatial dimension $T / P$. After that, a smaller local Transformer operates on the spatial dimension $P$ inside a patch. Actual values for $P$ are quite small, e.g. 8 for language modeling. The model is tested on text for classic language modeling, but also on image data and audio data, where PPL on byte-level is measured in all cases. The performance on language modeling compared to other BPE-level models is worse. When comparing to other models on byte-level, it is always better or at least as good.

Strengths

- Novel model which performs well on byte-level - Many experiments, including ablations.

Weaknesses

- The argumentation on sub-quadratic computation runtime for self-attention is flawed and not true. See details below. - Proposed model can also be used on BPE-level. How would this perform? Maybe even with this model, BPE would be prefered? This experiment is missing.

Questions

Really sub-quadratic? How? From the figure 1 and 2 it just looks like reduced by constant factor P or thus P^2? "MegaByte decomposes long sequences into two shorter sequences, and optimal patch sizes reduces the self-attention cost to $O(N^{\frac{4}{3}})$" - I don't understand this. Why two shorter sequences? Where do I see that in the model? What is meant by optimal patch size? $P$ is the patch size? As I understand it, $P$ is a fixed hyper parameter, which you cannot change later on, as it is the dimension for the input. "By setting $P = T^{\frac{1}{3}}$ - this does not make sense. $T$ is a variable length, depending on the input. $P$ is a fixed hyperparameter, which you can set once and then not change anymore. Or if you want to say, you also never change $T$ in practice, then the whole cost reduces to $O(1)$, but it's not really meaningful to think of $T$ as a fixed size. Line 136: "the Global model has a sequence of length $\frac{P}{T}$ - I assume it should be $\frac{T}{P}$. Line 136: "Local model uses $\frac{P}{T}$ sequences" - I assume it should be $\frac{T}{P}$ as well? "Extensive experiments show that MEGABYTE allows byte-level models to perform competitively with subword models on long context language modeling" - but not on standard language modeling tasks? $E^{\textrm{global-pad}} \in \mathbb{R}^{P \times D_G}$ should probably be $E^{\textrm{global-pad}} \in \mathbb{R}^{P \cdot D_G}$ instead? "Section ?? proposes strided inference as a solution" - cross reference broken. From the NeurIPS template: "The table number and title always appear before the table". However, this is wrong in the paper, where the table caption is incorrectly below the table. Figure 4, Figure 7: I think that are tables, not figures? Table 1 caption should describe, what are those numbers for the models? PPL? In Table 1, Stories dataset, for PerceiverAR, the number looks inconsistent to all other numbers in that it only has 2 digits after the decimal point instead of 3. Is this on purpose? Image modeling: It is not stated, but the model operates on the raw bytes, and you have 4 bytes per pixel? This should be explained. The proposed model can be used to also operate on BPE level instead of byte level. While this is against the motivation of the work, I think this is still an interesting experiment. And also an important experiment. Because I would expect that this still improves over the byte-level variant. And this implies that BPE tokens are still overall better, and it is probably better to use BPEs also for this model, just like it is better to use BPEs for the other models.

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

-

Reviewer bsD96/10 · confidence 4/52023-07-06

Summary

This paper proposes Megabyte, a Transformer architecture that combines global and local attention to scale sub-quadratically in sequence length. The authors evaluate Megabyte on byte-level language modeling, image modeling, and audio modeling.

Strengths

There is an extensive empirical validation, and Megabyte seems to perform well in the evaluated contexts. Megabyte has strong performance across different modalities, and scales well to long sequence lengths. The analysis of FLOP cost is nuanced and refreshing to see in an ML paper. Overall strong work.

Weaknesses

There are a few ways that the paper could be improved. First, the presentation of the paper is a bit messy. There are links/references that go across page boundaries (e.g., bottom of page 5 in the submission). There are also some dead references (e.g. line 304). These problems should be cleaned up in the camera ready. The analysis of whether the language models can use their full context seems a little naive. A better analysis would be to see if perplexity on long documents (e.g., books) is worse than perplexity on short documents, relative to a baseline. It would be nice to see some comparison against state-of-the-art tokenizer-based language models, e.g. GPT-Neo [1], Pythia [2], Hyena [3], H3 [4]. These models are not byte-based, but they are standard benchmarks of Transformer quality for language modeling. Lastly, it would be nice to see if this approach scales to larger models. [1] https://github.com/EleutherAI/gpt-neo [2] https://github.com/EleutherAI/pythia [3] https://arxiv.org/abs/2302.10866 [4] https://arxiv.org/abs/2212.14052

Questions

1. Can you conduct a perplexity-based analysis of whether Megabyte uses the full context of its models? 2. Can you compare against state-of-the-art tokenizer-based language models? 3. Does Megabyte scale?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

2 fair

Contribution

3 good

Limitations

Brief mentions of scaling limitations but no concrete experiments

Reviewer tnBu8/10 · confidence 4/52023-07-07

Summary

This paper proposes a new architecture of sequential modeling called MEGABYTE. MEGABYTE splits the long data sequence into patches and encode the patches using the Global model. The output of Global model is forwarded into the Local model, which facilitates the within-patch encoding. The output of the Local model is used to make next position generation. Compared with typical sequence modeling architectures, MEGABYTE has the advantages of no tokenization, lower complexity of attention, much larger feedforward layers for the same computation and faster generation speed via higher parallelisms. The experimental results over various benchmarks shows the effectiveness of this model design. Sufficient analysis and ablations are also provided.

Strengths

1. This paper focuses on a crucial problem in current sequential modeling tasks, which is making the encoding of extreme long sequences more efficient. 2. The architecture is easy to understand and reasonable. 3. The experiments are conducted on prevalent benchmarks related to long sequence modeling. And the SOTA models are compared on these benchmarks. 4. Several tricks are proposed to improve the performance of MEGABYTE, including strided inference, cross-patch attention and convolutional embedding. The contribution of these tricks are also analyzed in detail. 5. The models are implemented using open-sourced framework, which make it more reproducible.

Weaknesses

Generally speaking, I think this paper is complete. I would say if more case study and analysis can be provided (especially on the language modeling task), it will be very good for a byte-level sequential model. A typo: Line 220: datasest → dataset

Questions

Just an extra question, is there any experimental results with the use of FLASH-attention and other SOTA speed and memory optimization libraries, given the fact that they are prevalently used in sequential models? Will the experimental conclusions still holds the same?

Rating

8: Strong Accept: Technically strong paper, with novel ideas, excellent impact on at least one area, or high-to-excellent impact on multiple areas, with excellent evaluation, resources, and reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

4 excellent

Contribution

4 excellent

Limitations

This work proposed a fundamental model architecture for efficient byte-level sequence modeling. This research topic is crucial for the development of future large language models. From my perspective, I would say there is not any so-called negative societal impact in this work.

Reviewer W4cB2023-08-15

Happy to hear the code will be released.

Reviewer tnBu2023-08-20

Thank the authors for providing the response. I will keep the rating as strong accept.

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC