Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Models and algorithms

T5 Model

About 2935 characters Updated Nov 30, 2026 27 views AI wiki

T5 (Text-to-Text Transfer Transformer) is a unified text-to-text framework proposed by Google Research in 2019 and published in 2020. Its core claim: recast every NLP task, whether classification, translation, summarization or question answering, as "input text, output text," so one model and one loss handle everything. It is a hallmark of the "unified paradigm" and shaped later instruction fine-tuning.

Core Principles

T5 uses a standard encoder-decoder Transformer; unlike GPT's unidirectional decoder, the encoder reads the full input bidirectionally and the decoder emits output token by token. Tasks are distinguished by prefixes: translation as translate English to German: That is good., sentiment as sst2 sentence: ..., with the output a text label such as positive or negative rather than a classification head. No task-specific output layer is needed, so the pipeline is fully unified.

A hidden benefit: the output space is no longer fixed, so the model can generate label text unseen in training, turning zero-shot tasks into pure generation. The cost is token-by-token decoding, far slower than one-shot classification.

The team ran a rare systematic ablation: under one compute budget they compared encoder-decoder, decoder-only (GPT-like) and encoder-only (BERT-like) architectures and different pretraining objectives. Encoder-decoder with a denoising objective (span masking and filling) won overall, a conclusion widely cited since. Pretraining data was C4, cleaned from Common Crawl, about 750GB.

Sizes run T5-Small (60M), Base (220M), Large (770M), 3B and 11B, with T5-11B setting several benchmarks at release. Later came mT5 (multilingual, 101 languages) and ByT5 (byte-level, no tokenizer).

The team also pretrained on multiple tasks in parallel and blended them in different proportions, finding that mixed multi-task training yields positive cross-task transfer. The FLAN series inherited this, making it an early template for instruction-tuning data.

Key Points

Value of a unified interface: task formatting simplifies joint multi-task training and prefigured today's "everything is generation."

Relative position bias: instead of absolute position encoding, T5 adds a learnable relative bias to attention scores, friendlier to length extrapolation.

Span corruption: contiguous spans are masked and marked with sentinel tokens for reconstruction, training long-range dependencies better than single-token masking.

Scale and cost: T5-11B is costly to train, but its open weights are a long-standing strong baseline in academic summarization, QA and translation; FLAN-T5 added instruction tuning and became a key reference for open instruction models.

Tokenization cost: the SentencePiece vocabulary balances multilingual handling, but truncation and prefix token overhead are real inference costs.

Common Misconceptions

Misconception one: T5 is an upgraded BERT; BERT only understands while T5 generates, with different architecture and use. Misconception two: "text to text" is a formatting trick; it actually unifies the loss and output space at paradigm level. Misconception three: ignoring inference cost; the encoder-decoder is slower than a same-size decoder on long generation.

Application Scenarios

Text summarization, machine translation, question answering, text classification, semantic similarity, data-to-text generation, multilingual transfer, and academic baselines.