T5: Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
TL;DR. T5 treats every task as text to text. Translation, classification, regression, summarisation and question answering all become “input string → output string” with a task prefix such as “translate English to German:”. With this one format, the authors compare architectures, pre-training objectives, data sets, fine-tuning methods and scale, all from one baseline. They also release C4, about 750GB of cleaned English Common Crawl text. Scaling the best recipe to 11B parameters on about 1T tokens gives state-of-the-art results, including SuperGLUE 88.9 against a human score of 89.8.
Key idea
Section titled “Key idea”Baseline. An encoder-decoder Transformer of about 220M parameters, like the original but with a simplified layer norm and learned relative position embeddings. Pre-train with span corruption on C4 for B tokens, then fine-tune on each task.
Span corruption. Drop about 15% of tokens in spans of mean length 3. Replace each span with a unique sentinel in the input; the target is the sentinels followed by the missing text. An example of my own:
- input:
the quick <X> fox jumps over <Y> dog - target:
<X> brown <Y> the lazy <Z>
Main findings (§3).
- Encoder-decoder beats decoder-only and prefix LM at equal compute (Table 2).
- Most denoising objectives perform similarly; span corruption is slightly better and cheaper.
- Clean data helps, and performance degrades as a corpus is shrunk and repeated more times.
- Full fine-tuning beats adapter layers and gradual unfreezing.
- Multi-task training on its own trails pre-train-then-fine-tune; multi-task pre-training followed by fine-tuning is competitive.
Key results
Section titled “Key results”In the Table 2 architecture study with a denoising objective, the encoder-decoder gets GLUE 83.28 and SuperGLUE 71.36. A decoder-only language model at the same compute gets 74.70 and 55.02, and a prefix LM gets 81.82 and 68.11. The final 11B model, trained on about 1T tokens, reaches SuperGLUE 88.9, up from the previous 84.6 and close to the human 89.8, plus state-of-the-art results on GLUE, SQuAD and CNN/Daily Mail summarisation.
Connections
Section titled “Connections”- Siblings: encoder-only BERT and decoder-only GPT-3; the original model is in Attention Is All You Need.
- T5 in IR: monoT5 reranks by generating “true” or “false” for a query-document pair.
- Data: C4 is an early filtered web corpus; compare FineWeb and DCLM.
- Fine-tuning: compare its adapter results with LoRA.
- Scale: Switch Transformers builds a mixture-of-experts on T5.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
T5 compares an encoder-decoder with L encoder and L decoder layers against a decoder-only language model. Show why the encoder-decoder has about the parameters of a 2L-layer language model but about the compute of an L-layer one, and use Table 2 to say which wins.
What a strong answer covers
- Parameters: L + L layers total about 2L layers of weights (plus some cross-attention), so roughly 2P.
- Compute: a decoder-only model applies all its layers to input and target tokens; the encoder sees only the input and the decoder only the target, so each token passes through about L layers, cost M.
- Table 2 (denoising): encoder-decoder (2P, M) gets GLUE 83.28 and SuperGLUE 71.36; the decoder-only language model (P, M) gets 74.70 and 55.02; a prefix LM (P, M) gets 81.82 and 68.11.
- Sharing encoder and decoder weights (P, M) costs little (GLUE 82.81), so the gain is not only from extra parameters.
- Mechanism
Explain span corruption with sentinel tokens on a short sentence of your own, and why the paper prefers it to BERT-style masking in a text-to-text setup.
What a strong answer covers
- About 15% of tokens are dropped in spans (mean length 3). Each span is replaced in the input by a unique sentinel such as <X> or <Y>.
- The target lists only the dropped spans, each preceded by its sentinel, and ends with a final sentinel.
- Targets are much shorter than the full input, so training is cheaper than reconstructing the whole sequence.
- Most denoising variants performed similarly; span corruption was chosen for slightly better results and efficiency.
- Critique
T5 is a study of many choices made one at a time from a fixed baseline. What are the strengths and weaknesses of this design, and which of its conclusions would you be least confident carry over to today's decoder-only LLMs?
What a strong answer covers
- Strength: one codebase, one data set and a fixed budget (2^35 ≈ 34B pre-training tokens) make comparisons fair and reproducible.
- Weakness: changing one factor at a time misses interactions, and each comparison is at small scale with few seeds.
- The architecture result depends on matching compute per (input, target) pair and on fine-tuning benchmarks; it says little about open-ended generation or in-context learning.
- Most ablations use a model of about 220M parameters, so conclusions about objectives, data repetition or adapters may change at much larger scale and should be checked against later work.