Title: MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers
Venue: NeurIPS 2023
Accepted: yes
Keywords: byte level language model

model architecture

efficient pretraining
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.

MEGABYTE: Modeling Million-byte Sequences with Multiscale Transformers

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 propose MEGABYTE, a multi-scale decoder architecture that enables end-toend 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. Patch Embedder Global Model Local Model Local Model Local Model Local Model _  _  _  _      m e  g a        b y  t  e       ' '  t  r  a _ m e g        _  b y  t        _ ' '  t  r        _ n  s f

1 Introduction

Sequences of millions of bytes are ubiquitous; for example, music, image, or video files typically consist of multiple megabytes. However, large transformer decoders (LLMs) typically only use several thousand tokens of context (Brown et al., 2020; Zhang et al., 2022a)-both because of the quadratic cost of self-attention but also, more importantly, the cost of large feedforward networks per-position. This severely limits the set of tasks where LLMs can be applied.

We introduce MEGABYTE, a new approach to modeling long byte sequences. First, byte sequences are segmented into fixed-sized patches, loosely analogous to tokens. Our model then consists of three parts: (1) a patch embedder , which simply encodes a patch by losslessly concatenating embeddings of each byte, (2) a global module, a large autoregressive transformer that inputs and outputs patch representations and (3) a local module, a small autoregressive model

Local

Model

Local

Model

Local

Model

Local

Model

_  _  _  _      m e  g a        b y  t  e        t  r  a n

_ m e g        _  b y  t        _  t  r  a       _  s  f  o

m e  g a        b y  t  e       t  r  a  n        s  f  o  r

Patch

Embed

Patch

Embed

Patch

Embed

Patch

Embed

that predicts bytes within a patch. Crucially, we observe that for many tasks, most byte predictions

Local

Model

Mo

_ m e g        _  b

Patch

Pa

Embed

Em

_  _  _  _      m e

are relatively easy (for example, completing a word given the first few characters), meaning that large networks per-byte are unnecessary, and a much smaller model can be used for intra-patch modelling. MEGABYTE has three main advantages over Transformers for long sequence modeling:

Sub-quadratic self-attention Most work on long sequence models has focused on mitigating the quadratic cost of self-attention. MEGABYTE decomposes long sequences into two shorter sequences, and optimal patch sizes reduces the self-attention cost to O ( N 4 3 ) , which remains tractable for even long sequences.

Per-patch feedforward layers In GPT3-size models, more than 98% of FLOPS are used in computing position-wise feedforward layers. MEGABYTE uses large feedforward layers per-patch rather than per-position, enabling much larger and more expressive models for the same cost. With patch size P , where a baseline transformer would use the same feedforward layer with m parameters P times, MEGABYTE can use a layer with mP parameters once for the same cost.

Parallelism in Decoding Transformers must perform all computations serially during generation because the input to each timestep is the output from the previous timestep. By reusing the global representation over multiple time steps during local model decoding, MEGABYTE allows greater parallelism during generation. For example, a MEGABYTE model with 1.5B parameters can generate sequences 40% faster than a standard 350M Transformer, whilst also improving perplexity when trained with the same compute.

Together, these improvements allow us to train much larger and better-performing models for the same compute budget, scale to very long sequences, and improve generation speed during deployment.

MEGABYTE also provides a strong contrast to existing autoregressive models that typically use some form of tokenization, where sequences of bytes are mapped to larger discrete tokens (Sennrich et al., 2015; Ramesh et al., 2021; Hsu et al., 2021). Tokenization complicates pre-processing, multi-modal modelling, and transfer to new domains, while hiding useful structure from the model. It also means that most state-of-the-art models are not truly end to end. The most widely used approaches to tokenization require language-specific heuristics (Radford et al., 2019) or lose information (Ramesh et al., 2021). Replacing tokenization with efficient and performant byte models would therefore have many advantages.

Weconduct extensive experiments for both MEGABYTE and strong baselines. We use a fixed compute and data budget across all models to focus our comparisons solely on the model architecture rather than training resources, which are known to benefit all models. We find that MEGABYTE allows byte-level models to perform competitively with subword models on long context language modeling, achieve state-of-the-art perplexities for density estimation on ImageNet, and allow audio modelling from raw audio files. Together, these results establish the viability of tokenization-free autoregressive sequence modeling at scale.

2 MEGABYTE Transformer

2.1 Overview

MEGABYTE is an autoregressive model for efficiently modeling long input sequences. MEGABYTE is comprised of 3 components: (1) a patch embedder that inputs a discrete sequence, embeds each element, and chunks it into patches of length P (2) a large global Transformer that contextualizes patch representations by performing self-attention over previous patches, and (3) a smaller local Transformer that inputs a contextualized patch representation from the global model, and autoregressively predict the next patch.

2.2 Components

Patch Embedder with patch size of P maps a byte sequence x 0 ..T to a sequence of patch embeddings of length K = T P and dimension P · D G .

First, each byte is embedded with a lookup table E global-embed ∈ R V × D G to an embedding of size D G and positional embeddings are added.

Then, byte embeddings are reshaped into a sequence of K patch embeddings with dimension P · D G . To allow autoregressive modelling, the patch sequence is padded to start with a trainable patch-sized padding embedding ( E global-pad ∈ R P × D G ), and the last patch is removed from the input. This sequence is the input to the global model, and is denoted h global-in ∈ R K × ( P · D G ) .

Global Model is a decoder-only Transformer with dimension P · D G that operates on a sequence of K patches. It incorporates a self-attention mechanism and causal masking to capture dependencies between patches. It inputs a sequence of K patch representations h global-in 0: K , and outputs an updated representation h global-out 0: K by performing self-attention over previous patches.

The output of the final global layer h global 0: K contains K patch representations of dimension P · D G . For each of these, we reshape them into sequences of length P and dimension D G , where position p uses dimensions p · D G to ( p +1) · D G . Each position is then projected to the dimension of the local model with a matrix w GL ∈ R D G × D L where D L is the local model dimension. We then combine these with byte embeddings of size D L for the tokens in the next patch E local-embed x ( k · P + p -1) . The local byte embeddings is offset by one with a trainable local padding embedding ( E local-pad ∈ R D L ) to allow autoregressive modelling within a patch. This results in a tensor h local-in ∈ R K × P × D L .

Local Model is a smaller decoder-only Transformer of dimension D L that operates on a single patch k containing P elements, each of which is the sum of an output from the global model and an embedding of the previous byte in the sequence. K copies of the local models are run on each patch independently (and in parallel during training), computing a representation h local-out ∈ R K × P · D L .

Finally, we can compute the probability distribution over the vocabulary at each position. The p th element of the k th patch corresponds to element t of the complete sequence, where t = k · P + p :

2.3 Variations and Extensions

Convolutional Patch Encoder: One limitation of patchifying sequences is that it is not translation invariant, and byte sequences may receive a different representation depending on their position in the patch. This may mean, for example, that a model has to relearn the meaning of a word at different offsets. To mitigate this issue, we experimented with augmenting the Patch Embedder with causal convolutional layers, which allow translation-invariant contextual representations of the bytes before they are chunked into patches. We use a stack of convolutional layers, with filter sizes of 3, 5 and 7.

Cross-patch Attention: The Local model uses short sequences for efficiency, and relies on the Global model for long-range information. However, we can increase the context of the Local model with little overhead by allowing it to condition on r elements from the previous patch. This approach allows the Global model to focus on a longer-range context. Specifically, when computing selfattention in each layer, we concatenate the keys and values with the last r keys and queries from the previous patch. We use rotary embeddings (Su et al., 2021) to model relative positions between elements in the sequence. This approach is reminiscent of TransformerXL (Dai et al., 2019) but differs by being fully differentiable.

Strided Inference: We observed empirically that the per-token loss within each patch increases towards the end of the patch, as the prediction relies more on the weaker Local model. To alleviate this issue, we propose strided inference , in which we predict the sequence with two forward passes of the full model, whose inputs are offset by p/ 2 positions from each other. We then combine the first p/ 2 positions in each patch for our predictions to predict the complete sequence. Similarly to sliding window methods (Press et al., 2020), this approach doubles the cost of inference but improves results.

3 Efficiency Analysis

3.1 Training Efficiency

Attention The cost of attention in a transformer architecture for a sequence of length T has O ( T 2 ) complexity. Much work has been explored reducing this; for example, Sparse Transformers (Child et al., 2019) and Routing Transformers (Roy et al., 2020) show strong results with a complexity O ( T 3 2 ) . Many linear attention mechanisms have also been proposed (Katharopoulos et al., 2020; Choromanski et al., 2020), although we are not aware of competitive results on large scale language modeling tasks. As a function of sequence length T and patch size P , the Global model has a sequence of length P T so uses O ( T 2 P 2 ) operations, and the Local model uses P T sequences of length P so uses O ( TP 2 P ) = O ( PT ) operations. The overall cost of MEGABYTE is therefore in O ( T 2 P 2 + TP ) . P is a hyperparameter that is chosen to create an architecture for sequences of size T . By setting P = T 1 3 the complexity is in O ( T 4 3 ) . Using much shorter patches of P = T 1 5 would give a complexity of O ( T 8 5 ) . The cost is less than the transformer for all non-trivial values of P such that 1 < P < T .

Feedforward Layers However, attention is not the main cost in large transformers. Instead of increasing the sequence length, transformers are more commonly scaled by increasing the dimension of their latent state d , and the feedforward network cost dominates the model's overall cost (Kaplan et al., 2020). For example, in the GPT3 architecture, the quadratic self-attention computation accounts for only 1.4% of FLOPS. Following the approximation of (Kaplan et al., 2020), a forward pass with a large transformer with m non-embedding parameters on a sequence of length T uses roughly 2 mT FLOPS. MEGABYTE contains two transformers: the Global model uses m g parameters on a sequence of length T P , and a Local model with m l parameters that sees T P sequences of length P , giving an estimate of 2 T ( m g P + m l ) FLOPS. When m g ≫ m l , the FLOPS used by MEGABYTE is approximately 2 Tm g P , allowing a model P times larger than a transformer with equivalent FLOPS. This analysis holds irrespective of any efficient attention mechanisms used in the transformer.

Combined Analysis To understand efficiency at different sequence lengths and model sizes, we calculate the total FLOPS used by transformers, Linear Transformers and MEGABYTE. For each operation, we use FLOP estimates from (Kaplan et al., 2020), except for attention in Linear Transformers, which we estimate as 9 D FLOPS/token 1 , where D is the model embedding dimension. Figure 3 shows that for models of size 660M to 173B and sequence lengths of up to 1M tokens,

MEGABYTE with P = 8 uses less FLOPS than either transformers or Linear Transformers. Baseline model architectures are based on GPT3, and Megabyte global/local model sizes are 452M/151M, 5.8B/604M, 170B/3.2B respectively.

3.2 Generation Efficiency

Generating long sequences with transformers is slow, because the input to each timestep is the output from the previous timestep, meaning each layer must be computed for each token serially. As running a layer on a single token typically does not saturate the amount of parallelism available within a GPU, for analysis, we model each layer as a constant cost independently of size. Consider a MEGABYTE model with L global layers in the Global model and L local layers in the Local model and patch size P , compared with a Transformer architecture with L local + L global layers. Generating each patch with MEGABYTE requires a sequence of O ( L global + P · L local ) serial operations, whereas the Transformer requires O ( P · L global + P · L local ) serial operations. When L global ≫ L local (i.e. the Global model has many more layers than the Local model), MEGABYTE can reduce inference costs by a factor close to P .

4 Experimental setup

Controlling for Compute and Data Models show consistent improvements when increasing both data and compute Kaplan et al. (2020); Hoffmann et al. (2022), meaning that one model can outperform another because of an increased training budget instead of an improved architecture. However, in practice, both compute and data are typically limited. We conduct experiments using a fixed compute and data budget across all models to focus comparisons solely on the model architecture rather than training resources. To achieve this, we adjust model hyperparameters (mainly, number of layers) within each architecture so that the forward pass time taken per byte is matched, and then train all models for the same number of bytes.

Comparison Systems We compare MEGABYTE with both a standard decoder-only Transformer and PerceiverAR (Hawthorne et al., 2022). PerceiverAR extends the original transformer with a single cross-attention layer over a much longer context sequence, and is the best performing general purpose autoregressive model we are aware of and achieves state-of-the-art results across several modalities. We implemented both models in the same codebase, and all models share a similar data loader, preprocessing step, and trainer to avoid any artifacts in our compute-controlled experiments.

Training Procedure All models were trained using the Metaseq 2 code base Zhang et al. (2022b). The training used the PyTorch framework Paszke et al. (2019), with fairscale to improve memory efficiency through fully sharded model and optimizer states Baines et al. (2021). Mixed precision training was used to improve training efficiency at scale Micikevicius et al. (2017). More training details and various model parameters can be found in Section A.1 in the Appendix. To validate our implementation of PerceiverAR, we reproduced their experiments on downsized ImageNet at 64 pixels. By carefully matching hyperparameters, we achieved a bits per byte (bpb) score of 3.53, compared to the reported 3.54 in the original paper.

Inference Methods Several techniques have been proposed for trading off speed for performance during inference with language models, including sliding windows Press et al. (2020) and our strided inference. We only use these methods when comparing with prior published work (Tables 2 and 3).

Transformer604M

Linear604M

MegaByte616M

Transformer6.4B

MegaByte6.5B

Transformer173B

Linear173B

MegaByte173B

1012

FLOPS/token

1011

1010

109

108

256

2048

16384

131072

1048576

SequenceLength

5 Language Modeling

We evaluated the performance of MEGABYTE on language modeling on a set of 5 diverse datasets emphasizing long-range dependencies: Project Gutenberg (PG-19), Books, Stories, arXiv, and Code.

Datasets We experiment on a range of long form text datasets. The PG-19 dataset Rae et al. (2019b) consists of English-language books written before 1919 and is extracted from the Project Gutenberg online library. The Stories dataset Trinh & Le (2018) is a subset of CommonCrawl data meant to emulate Winograd schemas. Books Gao et al. (2020) is another collection of English-language books. The arXiv dataset contains technical publications written in L A T E X from the arXiv online archive. Finally, the Code dataset is a large publicly available dataset of open source code, under Apache, BSD or MIT licenses. More details on dataset sizes and document lengths are shared in Table 1.

Controlled Experiments Table 1 lists bpb on each dataset. Each model is trained for 80 billion bytes, and models are scaled to use the same compute budget. We carefully tune hyperparameters for all architectures to best utilize the available compute budget. MEGABYTE consistently outperforms both transformers and PerceiverAR across all datasets. We use the same sets of parameters on all dataset. In all experiments presented in Table 1, transformer has size of 320M with context length of 1024, PerceiverAR has size of 248M with context size of 8192 and latent size of 1024, and MEGABYTE global/local model sizes are 758M/262M with context length of 8192 and patch size of 8.

Scaling Experiment We scale up our training data on PG-19 (Table 2), and compare MEGABYTE with byte baselines, as well as converting all results to word-level perplexities to benchmark with stateof-art token based models. We train a byte-level Transformer, PerceiverAR and MEGABYTE models for 400B bytes and the same compute budget using same model parameters as in the controlled experiments. We find that MEGABYTE outperforms other byte-level models by a wide margin at this scale. 3 We also compare with the best previously reported numbers for sub-word models. These results may be confounded by differing amounts of compute and tuning used, but show that MEGABYTE gives results competitive with state-of-the-art models trained on subwords. These results suggest that MEGABYTE may allow future large language models to be tokenization-free.

6 Image Modeling

Sequence Modeling on ImageNet We test MEGABYTE on variants of the autoregressive image generation task on ImageNet (Oord et al., 2016), to measure its ability to efficiently use long context. We test on three different resolutions of images, ranging from 64×64 to 640×640 pixels - the latter

requiring the effective modeling of sequences with over 1.2M tokens. This generation task becomes increasingly challenging as the image's resolution grows: doing well on this task requires the modeling of local patterns (textures, lines, etc.) and long-range context that provides information about the high level structure of the image. Inspired by recent works in Vision Transformers (Dosovitskiy et al., 2020), we model image data patch by patch (more details can be found in Appendix D.1).

Comparison with State of the Art We train a large MEGABYTE model on ImageNet 64x64 with Global and Local models sized 2.7B and 350M parameters, respectively, for 1.4T tokens. We estimate that training this model consumed less than half the GPU hours we would have needed to reproduce the best PerceiverAR model described by (Hawthorne et al., 2022). As shown in Table 2, MEGABYTE matches the state-of-the-art performance of PerceiverAR whilst using only half the compute.

ImageNet64

Routing Transformer (Roy et al., 2020)

Combiner (Ren et al., 2021)

Perceiver AR (Hawthorne et al., 2022)

bpb

3.43

3.42

3.40

MEGABYTE

3.40

Table 3: Bits per byte (bpb) on ImageNet 64×64. MEGABYTE matches the current state-of-the-art while only using half the amount of GPU hours to train.

Table 4: Bits per byte (bpb) on ImageNet with different resolutions. All models use the same compute and data. MEGABYTE scales well to sequences of over 1M tokens.

Scaling to higher resolutions We compare three transformer variants (vanilla, PerceiverAR, MEGABYTE) to test scalability to long sequences on increasingly large image resolutions. We use our own implementations of these in the same framework and budget the same amount of GPU hours and data to train each of these model variants.

MEGABYTE is able to handle all sequence lengths with a single forward pass of up to 1.2M tokens. We found neither the standard Transformer nor PerceiverAR could model such long sequences at a reasonable model size, so instead we split images into segments of size 1024 and 12000 respectively. For Megabyte, we set patch size as 12 for Image64 and patch size as 192 for Image256 and Image640 datasets. Model sizes are adjusted to match overall training speeds across models and we do not use any form of sliding window evaluation in this experiment. As seen in Table 4, MEGABYTE outperforms baselines across all resolutions in this compute-controlled setting. The precise settings used for each of the baseline models such as context length and number of latents are summarized in Table 12. Results show that MEGABYTE outperforms the other systems at all resolutions, demonstrating an effective model of sequences of over 1M bytes.

7 Audio Modeling

Audio has aspects of both the sequential structure of text and the continuous nature of images, so is an interesting application for MEGABYTE.

Raw audio is typically stored as a sequence of 16-bit integer values (one per timestep); a softmax layer would need to output 65,536 probabilities per timestep to model all possible values. To address this issue, various techniques have been developed to reduce the memory and computational requirements of the softmax layer. For instance, van den Oord et al. (2016) apply µ -law companding transformation and quantizes the input into 256 possible values. Alternatively, van den Oord et al. (2017) model the samples using the discretized mixture of logistics distribution introduced by Salimans et al. (2017). Finally, Kalchbrenner et al. (2018) use a dual softmax technique to produce 8 coarse and 8 fine bits. In our approach, we simplify the audio modeling process by directly reading the bytes (256 possible values) from the audio file and conducting an autoregressive language model on top of that. This greatly streamlines the modeling process, making it easier and more efficient.

Our audio modeling approach focuses on 16 kHz, 16-bit audio, which equates to 32k bytes per one-second clip. We use an extensive audio dataset consisting of 2 terabytes (roughly 18,000 hours) of audio. We use a sequence length of 524,288, a patch size of 32, and a batch size of 32 to facilitate model training. By utilizing these settings, we can effectively train our model on large volumes of audio data, helping to improve its accuracy and efficacy. Our model obtains bpb of 3.477, much

lower than the results with perceiverAR (3.543) and vanilla transformer model (3.567). More ablation results are presented in Table 6.

8 Analysis

We study different behaviors of MEGABYTE. All experiments in the same group use the same compute.

Generation speed We also compare the text generation speed between MEGABYTE and a transformer. We compare a 350M parameter baseline transfomer and a MEGABYTE model with a 1.3B parameter Global model and a 218M parameter local model, trained on PG19 with equal compute. As shown in Table 5, the MEGABYTE model achieves much lower perplexity as expected. However, MEGABYTE also generates a sequence of 8192 tokens 40% faster than transformer, despite having over 4 times the parameters. This speed up is due to the bulk of the parameters being in the Global model, which only needs to be computed once for every 8 tokens, whereas all the parameters in the baseline model are used on every token.

Model Components In Table 6, we analyze the significance of different components in the MEGABYTE architecture by studying arXiv, Librilight-L and ImageNet256 datasets. Removing Local ( w/o local model ) or global ( w/o global model ) model, we observe a substantial increase in bpb on all datasets, showing that both parts are crucial. The performance of the model without the cross-patch local model ( w/o cross-patch local model ) is competitive, indicating that the architecture is robust to this modification. We observe slight improvement on the Librilight-L and ImageNet256 datasets by augmenting the MEGABYTE model with a CNN encoder ( w/ CNN encoder ). This suggests that the MEGABYTE architecture can benefit from integrating alternative encoding mechanisms.

Effective Use of Context Long-context models often struggle to benefit from the full context (Sun et al., 2021). Figure 7 shows that later tokens within each context window have a higher likelihood, indicating that MEGABYTE can effectively use at least 8k bytes of context on the PG19 dataset.

Log probability

Originalinference

-0.90

Shiftedinference

0.92

Used tokens

-0.94

POS

TION

N

06°0-

probability

0.95

Averagelog

1.00

1.05

1.10

MegaByte,8192 context length

Vanilla Transformer,2048 context length

Vanilla Transformer, sliding window w/ 512 stride

1.15

1000

2000

Token position within context window

3000

4000

5000

0009

7000

8000

Strided Inference We find that within a single patch, on average, the MEGABYTE performs worse on later tokens within a patch (see Figure 8). Section 2.3 proposes strided inference as a solution, where two forward passes are performed offset by P 2 tokens, and results from the first half of each patch are combined. Table 9 shows performance improvements from strided inference, which are additive with the standard sliding window.

Patch Size. We experimented with various patch sizes on Image256 dataset and found a wide range of values where MEGABYTE performs similarly. We found similar robustness to patch size choices across all modalities, although the optimal patch size itself can be different across modalities.

Local to Global model Size Ratio. We experimented with different Local/Global model size ratios on PG19 dataset. By grouping bytes into patches, MEGABYTE effectively uses P times less tokens for the Global model as on the Local model-enabling us to increase the size of the Global model with reduced cost. We find that a given compute budget is spent optimally when the Global model is larger than the Local model, consistently across all modalities and various patch sizes.

9 Related Work

Prior research has explored the possibility of improving the efficiency of Transformers on long sequences, primarily motivated by mitigating the quadratic cost of self-attention.

Efficient Encoder Models Several related techniques to ours have been developed for transformer encoder architectures but cannot be straightforwardly applied to decoders. In particular, patchifying operations have previously been used in image encoder models such as ViT (Dosovitskiy et al., 2020), and down- and up-sampling operations have been used for text encoders (Clark et al., 2022), but such methods cannot be naively applied to decoder-only models without leaking information to future bytes in the same patch. MEGABYTE generalizes these approaches to an efficient decoder model by using a intra-patch transformer to predict each sequence element's likelihood, and offseting the inputs to the two models to avoid leaking information. Jaegle et al. (2021) use self-attention on a shorter latent sequence also resembles patchification, but this technique cannot easily be applied to decoder architectures without leaking information to future timesteps.

Efficient Decoder models Improving the efficiency of decoder models is harder because of the need to make one prediction per timestep, and not leak information to future timesteps. The most popular approaches can be categorized as (1) chunking sequences into smaller blocks, and propagating information from previous blocks with either recurrence (Dai et al., 2019; Hutchins et al., 2022) or cross-attention (Hawthorne et al., 2022), (2) linear alternatives to attention, which typically involve forms of token-level recurrence (Katharopoulos et al., 2020) or state space models (Gu et al., 2021; Smith et al., 2022; Ma et al., 2022), or (3) sparse approximations of attention (Kitaev et al., 2020; Beltagy et al., 2020; Child et al., 2019; Wu et al., 2022). However, the performance of dense attention means it is typically still chosen for large scale decoders (Touvron et al., 2023; Chowdhery et al., 2022). MEGABYTE takes the alternative approach of decomposing the complete sequence into two shorter sequences, giving sub-quadratic attention. We also note that feedforward networks are the dominant cost in large decoders, not self-attention. Our approach to compressing sequences allows much larger models than would be possible when using large feedforward networks at every timestep.

Tokenization The most common approach to shortening sequence lengths in Transformer decoders is to pre-process the input with a form of tokenization, in which multiple bytes are mapped to a single discrete token from a fixed vocabulary. For text, this can be done losslessly using methods such as BPE (Sennrich et al., 2015) and SentencePiece (Kudo & Richardson, 2018), but these approaches can require language-specific heuristics (Radford et al., 2019), limit out-of-domain performance (Sharami

et al., 2023), and can affect prompting and truncated sampling in unpredictable ways. 4 The amount of high-frequency information in images and audio means that tokenization cannot be performed losslessly, and instead clustering (Hsu et al., 2021) or discrete auto-encoders (Ramesh et al., 2021) are used to compress the inputs, which lose information and likely limit generative model performance. Our patches are analogous to traditional lossless tokens, and the Local model performs the role of mapping a hidden state to a distribution over possible patches.

10 Conclusion

We introduced MEGABYTE, a scaleable architecture for modeling long sequences. MEGABYTE outperforms existing byte-level models across a range of tasks and modalities, allowing large models of sequences of over 1 million tokens. It also gives competitive language modeling results with subword models, which may allow byte-level models to replace tokenization. However, the scale of experiments here is far below those of state-of-the-art language models (Brown et al., 2020), and future work should explore scaling MEGABYTE to much larger models and datasets.

References

Baines, M., Bhosale, S., Caggiano, V., Goyal, N., Goyal, S., Ott, M., Lefaudeux, B., Liptchinsky, V., Rabbat, M., Sheiffer, S., Sridhar, A., and Xu, M. FairScale: A general purpose modular PyTorch library for high performance and large scale training. https://github.com/ facebookresearch/fairscale , 2021.

Beltagy, I., Peters, M. E., and Cohan, A. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150 , 2020.

Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in neural information processing systems , 33:1877-1901, 2020.

Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509 , 2019.

Choromanski, K., Likhosherstov, V., Dohan, D., Song, X., Gane, A., Sarlos, T., Hawkins, P., Davis, J., Mohiuddin, A., Kaiser, L., et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794 , 2020.

Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311 , 2022.

Clark, J. H., Garrette, D., Turc, I., and Wieting, J. Canine: Pre-training an efficient tokenization-free encoder for language representation. Transactions of the Association for Computational Linguistics , 10:73-91, 2022.

Dai, Z., Yang, Z., Yang, Y., Carbonell, J., Le, Q. V ., and Salakhutdinov, R. Transformer-xl: Attentive language models beyond a fixed-length context, 2019. URL https://arxiv.org/abs/1901. 02860 .

Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929 , 2020.

Gao, L., Biderman, S., Black, S., Golding, L., Hoppe, T., Foster, C., Phang, J., He, H., Thite, A., Nabeshima, N., Presser, S., and Leahy, C. The pile: An 800gb dataset of diverse text for language modeling, 2020.

Gu, A., Goel, K., and Ré, C. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396 , 2021.

Hawthorne, C., Jaegle, A., Cangea, C., Borgeaud, S., Nash, C., Malinowski, M., Dieleman, S., Vinyals, O., Botvinick, M., Simon, I., et al. General-purpose, long-context autoregressive modeling with perceiver ar. In International Conference on Machine Learning , pp. 8535-8558. PMLR, 2022.

Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., Casas, D. d. L., Hendricks, L. A., Welbl, J., Clark, A., et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556 , 2022.

Hsu, W.-N., Bolte, B., Tsai, Y.-H. H., Lakhotia, K., Salakhutdinov, R., and Mohamed, A. Hubert: Self-supervised speech representation learning by masked prediction of hidden units. IEEE/ACM Transactions on Audio, Speech, and Language Processing , 29:3451-3460, 2021.

Hutchins, D., Schlag, I., Wu, Y., Dyer, E., and Neyshabur, B. Block-recurrent transformers. arXiv preprint arXiv:2203.07852 , 2022.

Jaegle, A., Gimeno, F., Brock, A., Vinyals, O., Zisserman, A., and Carreira, J. Perceiver: General perception with iterative attention. In International conference on machine learning , pp. 4651-4664. PMLR, 2021.

Kalchbrenner, N., Elsen, E., Simonyan, K., Noury, S., Casagrande, N., Lockhart, E., Stimberg, F., van den Oord, A., Dieleman, S., and Kavukcuoglu, K. Efficient neural audio synthesis. CoRR , abs/1802.08435, 2018. URL http://arxiv.org/abs/1802.08435 .

Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361 , 2020.

Katharopoulos, A., Vyas, A., Pappas, N., and Fleuret, F. Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning , pp. 51565165. PMLR, 2020.

Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In ICLR , 2015.

Kitaev, N., Kaiser, Ł., and Levskaya, A. Reformer: The efficient transformer. arXiv preprint arXiv:2001.04451 , 2020.

Kudo, T. and Richardson, J. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226 , 2018.

Ma, X., Zhou, C., Kong, X., He, J., Gui, L., Neubig, G., May, J., and Zettlemoyer, L. Mega: moving average equipped gated attention. arXiv preprint arXiv:2209.10655 , 2022.

Micikevicius, P., Narang, S., Alben, J., Diamos, G., Elsen, E., Garcia, D., Ginsburg, B., Houston, M., Kuchaiev, O., Venkatesh, G., et al. Mixed precision training. arXiv preprint arXiv:1710.03740 , 2017.

Oord, A. v. d., Kalchbrenner, N., and Kavukcuoglu, K. Pixel Recurrent Neural Networks. ICML , 4:2611-2620, 1 2016. doi: 10.48550/arxiv.1601.06759. URL https://arxiv.org/abs/1601. 06759v3 .

Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al. PyTorch: An imperative style, high-performance deep learning library. In NeurIPS , 2019.

Press, O., Smith, N. A., and Lewis, M. Shortformer: Better language modeling using shorter inputs. arXiv preprint arXiv:2012.15832 , 2020.

Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., and Sutskever, I. Language models are unsupervised multitask learners. 2019.

Rae, J. W., Potapenko, A., Jayakumar, S. M., and Lillicrap, T. P. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507 , 2019a.

Rae, J. W., Potapenko, A., Jayakumar, S. M., and Lillicrap, T. P. Compressive transformers for long-range sequence modelling. arXiv preprint arXiv:1911.05507 , 2019b.

Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., and Sutskever, I. Zeroshot text-to-image generation. In International Conference on Machine Learning , pp. 8821-8831. PMLR, 2021.

Ren, H., Dai, H., Dai, Z., Yang, M., Leskovec, J., Schuurmans, D., and Dai, B. Combiner: Full attention transformer with sparse computation cost, 2021. URL https://arxiv.org/abs/2107. 05768 .

Roy, A., Saffar, M., Vaswani, A., and Grangier, D. Efficient content-based sparse attention with routing transformers, 2020. URL https://arxiv.org/abs/2003.05997 .

Salimans, T., Karpathy, A., Chen, X., and Kingma, D. P. Pixelcnn++: Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. CoRR , abs/1701.05517, 2017. URL http://arxiv.org/abs/1701.05517 .

Sennrich, R., Haddow, B., and Birch, A. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909 , 2015.

Sharami, J., Shterionov, D., and Spronck, P. A systematic analysis of vocabulary and bpe settings for optimal fine-tuning of nmt: A case study of in-domain translation. arXiv preprint arXiv:2303.00722 , 2023.

Smith, J. T., Warrington, A., and Linderman, S. W. Simplified state space layers for sequence modeling. arXiv preprint arXiv:2208.04933 , 2022.

Su, J., Lu, Y., Pan, S., Murtadha, A., Wen, B., and Liu, Y. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864 , 2021.

Sun, S., Krishna, K., Mattarella-Micke, A., and Iyyer, M. Do long-range language models actually use long-range context? arXiv preprint arXiv:2109.09115 , 2021.

Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M.-A., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971 , 2023.

Trinh, T. H. and Le, Q. V. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847 , 2018.

van den Oord, A., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A. W., and Kavukcuoglu, K. Wavenet: A generative model for raw audio. CoRR , abs/1609.03499, 2016. URL http://arxiv.org/abs/1609.03499 .

van den Oord, A., Li, Y., Babuschkin, I., Simonyan, K., Vinyals, O., Kavukcuoglu, K., van den Driessche, G., Lockhart, E., Cobo, L. C., Stimberg, F., Casagrande, N., Grewe, D., Noury, S., Dieleman, S., Elsen, E., Kalchbrenner, N., Zen, H., Graves, A., King, H., Walters, T., Belov, D., and Hassabis, D. Parallel wavenet: Fast high-fidelity speech synthesis. CoRR , abs/1711.10433, 2017. URL http://arxiv.org/abs/1711.10433 .

Wu, Y., Rabe, M. N., Hutchins, D., and Szegedy, C. Memorizing transformers. arXiv preprint arXiv:2203.08913 , 2022.

Zhang, S., Roller, S., Goyal, N., Artetxe, M., Chen, M., Chen, S., Dewan, C., Diab, M., Li, X., Lin, V., Mihaylov, T., Ott, M., Shleifer, S., Shuster, K., Simig, D., Koura, S., Sridhar, A., Wang, T., Zettlemoyer, L., and Ai, M. OPT: Open Pre-trained Transformer Language Models. 5 2022a. doi: 10.48550/arxiv.2205.01068. URL https://arxiv.org/abs/2205.01068v4 .

Zhang, S., Roller, S., Goyal, N., Artetxe, M., Chen, M., Chen, S., Dewan, C., Diab, M., Li, X., Lin, X. V., et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068 , 2022b.

A Supplementary Material

A.1 Training Details

To ensure stable training, we applied gradient clipping with a maximum norm of 1.0 and used the Adam optimizer with β 1 = 0 . 9 , β 2 = 0 . 98 Kingma & Ba (2015). We used the built-in polynomial decay learning rate scheduler in MetaSeq with 500 warmup updates and the end learning rate set to 0. All models are trained with pre-norm and using ReLU activation. We apply a dropout of 0.1 throughout, but we do not apply any dropout to embeddings. We also use weight decay of 0.1. To initialize the weights, we use a variant based on Megatron-LM codebase, which involves using a normal distribution with a mean of zero and a standard deviation of 0.006. We truncate this normal distribution within two standard deviations and observed substantial gain in both training stability and performance.

A.2 Motivation

Why is the local model needed? Many of the efficiency advantages of the MEGABYTE design could be realized with the Global model alone, which would resemble a decoder version of ViT (Dosovitskiy et al., 2020). However, the joint distribution over the patch p ( x t +1 , .., x t + P | x 0 ..t ) has an output space of size 256 P so direct modeling is only tractable for very small patches. We could instead factor the joint distribution into conditionally independent distributions p ( x t +1 | x 0 ..t ) ..p ( x t + P | x 0 ..t ) , but this would greatly limit the model's expressive power. For example, it would be unable to express a patch distribution such as 50% cat and 50% dog , and would instead have to assign probability mass to strings such as cag and dot . Instead, our autoregressive Local model conditions on previous characters within the patch, allowing it to only assign probability to the desired strings.

Increasing Parameters for Fixed Compute Transformer models have shown consistent improvements with parameter counts (Kaplan et al., 2020). However, the size of models is limited by their increasing computational cost. MEGABYTE allows larger models for the same cost, both by making self attention sub-quadratic, and by using large feedforward layers across patches rather than individual tokens.

Re-use of Established Components MEGABYTE consists of two transformer models interleaved with shifting, reshaping and a linear projection. This re-use increases the likelihood that the architecture will inherit the desirable scaling properties of transformers.

A.3 Model Details

As discussed in Section 4, we conduct experiments using a fixed compute and data budget across all models to focus our comparisons solely on the model architecture rather than training resources. To achieve this, we adjust model hyperparameters within each architecture so that the time taken for a single update is matched and then train all models for the same number of updates. We list all of model details in Table 12 and Table 13.

Table 13: Model architecture details. We report the model size, the embedding size (D), number of layaers(L), total batch size (BS), learning rate(LR), and context length. When we vary the number of model layers from the standard amount for the given size (Table 12), we note this accordingly. For PerceiverAR models, we note the number of latents used, and for MEGABYTE models we note the patch sizes.

B Pseudocode

C PerceiverAR Implementation

To reproduce PerceiverAR in a compute-controlled setting we extended the standard transformer implementation in metaseq with an additonal cross attention layer to compute the latents and match the architecture of PerceiverAR. We trained the model by sampling random spans from each text, matching the procedure used in the PerceiverAR codebase. To be consistent with the original work, we use sliding window evaluation with a stride of num _ latents/ 2 unless otherwise noted. In several cases we used the standard metaseq implementation as opposed to specific techniques reported in the original paper: 1) we used standard attention dropout instead of cross-attention dropout 2) We did not implement chunked attention. We verified our implementation by reproducing the "Standard Ordering" experiments in Table 5 of the Perceiver AR paper. After carefully matching context size, number of latents, the amount of data and training steps used and learning rate, we achieved 3.53 bpb vs 3.54 reported in the original paper.

D More results

D.1 Patch scan Implementation

Images have a natural structure, containing a grid of n × n pixels each composed of 3 bytes (corresponding to color channels). We explore two ways of converting images to sequences for modeling (see Figure 4). Firstly, raster scan where the pixels are linearized into 3 bytes and concatenated row-by-row. Secondly, patch scan where we create patches of shape p × p × 3 bytes

where p = √ P 3 , and then use a raster scan both within and between patches. Unless otherwise specified, MEGABYTE models use patch scan for image data.

D.2 Patch scan vs Raster scan

The patch scan method is inspired by recent works in Vision Transformers (Dosovitskiy et al., 2020), and it is more effective than raster scan for modeling image sequencing. We found it improves both MEGABYTE and Perceiver AR.

D.3 Longer sequence modeling

For our pg19 scaling experiment, we also use longer context length for MEGABYTE. The results are shown in Table 15. With longer sequence, we didn't observer further improvement, consistent with findings in Hawthorne et al. (2022). We think we will benefit more from longer sequence when we futher scale up the model size and data.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe 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.\n\nSTRENGTHS:\n**Originality**: The proposed model architecture is novel. Comparison to Perceiver AR seems reasonable and shows understanding of related work in the area.\n\n**Quality**: Experiments do a good job of demonstrating the quality of the model.\n\n**Clarity**: For the most part the paper is well-written and easy to follow.\n\n**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.\n\nWEAKNESSES:\nMain weakness: While the paper does a laudable job of covering a lot of ground, this comes at a cost.\n1. 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.\n2. The paper focuses on high-level ideas (as it should) but it leaves some low-level details unclear. Here are a couple examples:\n    * Does the local model use position embeddings (when not using cross-patch attention)?\n    * What audio modeling dataset was used?\n    * When the GPT-3 architecture is brought up, is that including use of locally banded sparse attention patterns?\n3. In general, the results in the paper are not reproducible.\n\nWith 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.\n\nA 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.\n\nQUESTIONS:\nPlease see weaknesses.\n\nLIMITATIONS:\nThere is currently no substantive discussion of limitations, and it could be a helpful addition but probably not necessary.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2023-06-10"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nA 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.\n\nActual values for $P$ are quite small, e.g. 8 for language modeling.\n\nThe 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.\n\nSTRENGTHS:\n- Novel model which performs well on byte-level\n- Many experiments, including ablations.\n\nWEAKNESSES:\n- The argumentation on sub-quadratic computation runtime for self-attention is flawed and not true. See details below.\n- 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.\n\nQUESTIONS:\nReally sub-quadratic? How? From the figure 1 and 2 it just looks like reduced by constant factor P or thus P^2?\n\n\"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.\n\n\"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.\n\n\n\nLine 136: \"the Global model has a sequence of length $\\frac{P}{T}$ - I assume it should be $\\frac{T}{P}$.\nLine 136: \"Local model uses $\\frac{P}{T}$ sequences\" - I assume it should be $\\frac{T}{P}$ as well?\n\n\"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?\n\n\n$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?\n\n\"Section ?? proposes strided inference as a solution\" - cross reference broken.\n\nFrom 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.\n\nFigure 4, Figure 7: I think that are tables, not figures?\n\nTable 1 caption should describe, what are those numbers for the models? PPL?\n\nIn 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?\n\nImage modeling: It is not stated, but the model operates on the raw bytes, and you have 4 bytes per pixel? This should be explained.\n\nThe 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.\n\nLIMITATIONS:\n-", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-06"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis 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.\n\nSTRENGTHS:\nThere 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.\n\nWEAKNESSES:\nThere are a few ways that the paper could be improved.\n\nFirst, 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.\n\nThe 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.\n\nIt 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.\n\nLastly, it would be nice to see if this approach scales to larger models.\n\n[1] https://github.com/EleutherAI/gpt-neo\n[2] https://github.com/EleutherAI/pythia\n[3] https://arxiv.org/abs/2302.10866\n[4] https://arxiv.org/abs/2212.14052\n\nQUESTIONS:\n1. Can you conduct a perplexity-based analysis of whether Megabyte uses the full context of its models?\n2. Can you compare against state-of-the-art tokenizer-based language models?\n3. Does Megabyte scale?\n\nLIMITATIONS:\nBrief mentions of scaling limitations but no concrete experiments", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-06"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis 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.\n\nSTRENGTHS:\n1. This paper focuses on a crucial problem in current sequential modeling tasks, which is making the encoding of extreme long sequences more efficient.\n2. The architecture is easy to understand and reasonable. \n3. The experiments are conducted on prevalent benchmarks related to long sequence modeling. And the SOTA models are compared on these benchmarks.\n4. 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.\n5. The models are implemented using open-sourced framework, which make it more reproducible.\n\nWEAKNESSES:\nGenerally 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.\n\nA typo: Line 220: datasest → dataset\n\nQUESTIONS:\nJust 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?\n\nLIMITATIONS:\nThis 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.", "TITLE": "Official Review", "RECOMMENDATION": 8, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 4, "DATE": "2023-07-07"}