[Paper Review] ByT5: Towards a token-free future with pre-trained byte-to-byte models
ByT5 shows that a standard Transformer can process UTF-8 bytes directly, enabling token-free pre-trained models that rival token-based baselines in many tasks, with improved robustness to noise.
Most widely-used pre-trained language models operate on sequences of tokens corresponding to word or subword units. By comparison, token-free models that operate directly on raw text (bytes or characters) have many benefits: they can process text in any language out of the box, they are more robust to noise, and they minimize technical debt by removing complex and error-prone text preprocessing pipelines. Since byte or character sequences are longer than token sequences, past work on token-free models has often introduced new model architectures designed to amortize the cost of operating directly on raw text. In this paper, we show that a standard Transformer architecture can be used with minimal modifications to process byte sequences. We characterize the trade-offs in terms of parameter count, training FLOPs, and inference speed, and show that byte-level models are competitive with their token-level counterparts. We also demonstrate that byte-level models are significantly more robust to noise and perform better on tasks that are sensitive to spelling and pronunciation. As part of our contribution, we release a new set of pre-trained byte-level Transformer models based on the T5 architecture, as well as all code and data used in our experiments.
Motivation & Objective
- Motivate and evaluate token-free NLP models that operate on raw bytes instead of token vocabularies.
- Adapt the Transformer architecture with minimal changes to process byte sequences.
- Assess trade-offs in parameter count, FLOPs, and inference speed between ByT5 and token-based baselines across multilingual tasks.
- Demonstrate robustness to input noise and spelling variations in byte-level modeling.
- Release pre-trained ByT5 models and accompanying code/data.
Proposed method
- Replace token vocabularies with a 256-byte embedding and special tokens; feed UTF-8 bytes directly into the Transformer.
- Use a span corruption pre-training objective with mean masked byte span length of 20 bytes (reusing final 100 byte IDs for sentinels).
- Make encoder deeper than the decoder (encoder depth 3x decoder) to compensate for lack of a vocabulary embedding matrix.
- Train five model sizes (Small, Base, Large, XL, XXL) with sequence length set to 1024 bytes, and train for 1 million steps on batches of 2^20 tokens.
- Parameter-match ByT5 architectures to mT5 while adjusting d_model and d_ff to preserve a ~2.5x d_ff/d_model ratio.
- Evaluate on English and multilingual benchmarks including GLUE, SuperGLUE, XSum, TweetQA, DROP, Dakshina, Sigmorphon, and xtreme tasks; compare against mT5.
Experimental results
Research questions
- RQ1Can a standard Transformer be effectively adapted to byte-level input with minimal architectural changes?
- RQ2What are the trade-offs in parameter counts, FLOPs, and inference cost when moving from token-based to byte-based inputs?
- RQ3How does ByT5 perform on English and multilingual classification, generation, and word-level tasks compared to mT5?
- RQ4Is ByT5 more robust to noise and spelling variations than token-based models across languages?
- RQ5How does encoder/decoder depth balance affect performance in token-free transformers?
Key findings
- ByT5 is competitive with mT5 on English and multilingual benchmarks and can outperform mT5 at smaller model sizes.
- Byte-level ByT5 yields strong generation performance, often surpassing mT5 on XSum, TweetQA, and DROP at multiple sizes.
- Token-free ByT5 significantly reduces vocabulary-related parameters and reallocates them into transformer layers, enabling a 3:1 encoder/decoder depth ratio and dense parameter usage.
- ByT5 demonstrates superior robustness to noise and messy text across tasks and languages, with smaller degradation under various input corruptions compared to mT5.
- Across xtreme cross-lingual tasks, ByT5 is competitive overall; it surpasses mT5 on in-language benchmarks when data is available in all target languages, and shows strong zero-shot and translate-train performance patterns depending on model size.
- Ablation studies show a heavy encoder best benefits ByT5, longer byte-span masking (mean 20 vs 3 or 40) improves certain tasks, and a 256-byte vocabulary shifts most parameters away from a vocabulary matrix into dense layers.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.