T5 (Text-to-Text Transfer Transformer) is a series of encoder-decoder large language models developed by Google AI in 2019, treating all text tasks as a unified text-to-text format. They are pretrained on the Colossal Clean Crawled Corpus and can be fine-tuned for various applications.

T5 (Text-to-Text Transfer Transformer) is a series of large language models developed by Google AI, introduced in 2019. Like the original Transformer model, T5 models are encoder-decoder Transformers, where the encoder processes the input text and the decoder generates the output text. The defining characteristic of T5 is its unified text-to-text framework: every task, from translation to summarization to question answering, is framed as converting input text into output text. This design simplifies the application of the model across diverse natural language processing problems.

T5 models are usually pretrained on a massive dataset of text and code, after which they can perform text-based tasks similar to their pretraining tasks. They can also be fine-tuned to perform other tasks. The models have been employed in various applications, including chatbots, machine translation systems, text summarization tools, code generation, and robotics.

Training

The original T5 models are pretrained on the Colossal Clean Crawled Corpus (C4), containing text and code scraped from the internet. This pretraining process enables the models to learn general language understanding and generation abilities. T5 models can then be fine-tuned on specific downstream tasks, adapting their knowledge to perform well in various applications.

The T5 models were pretrained on many tasks, all in the format of <input text> -> <output text>. Some examples include:

  • Restoring corrupted text: Thank you <X> me to your party <Y> week. -> <X> for inviting <Y> last <Z>, where <Z> means "end of output" and <X> and <Y> denote blanks to be filled, called "sentinels" in the original report.
  • Translation: translate English to German: That is good. -> Das ist gut.
  • Judging the grammatical acceptability of a sentence (CoLA sentence): The course is jumping well. -> not acceptable.

This multitask pretraining approach allows T5 to develop a broad understanding of language structure and semantics, which can then be adapted to specific downstream tasks through fine-tuning.

Architecture

The T5 series encompasses several models with varying sizes and capabilities, all encoder-decoder Transformers. The encoder processes the input text, and the decoder generates the output text. These models are often distinguished by their parameter count, which indicates the complexity and potential capacity of the model. The original paper reported five models: T5-small, T5-base, T5-large, T5-3B, and T5-11B.

The encoder and decoder have the same shape. For example, T5-small has 6 layers in the encoder and 6 layers in the decoder. Key architectural parameters include:

  • nlayer: Number of layers in the encoder and decoder (always equal).
  • nhead: Number of attention heads in each attention block.
  • dmodel: Dimension of the embedding vectors.
  • dff: Dimension of the feedforward network within each encoder and decoder layer.
  • dkv: Dimension of the key and value vectors used in the self-attention mechanism.

Note that unlike typical Transformers, the 3B and 11B models do not satisfy dmodel = dkv * nhead. Compared to the original Transformer, T5 uses a few minor modifications: layer normalization with no additive bias; placing the layer normalization outside the residual path; and relative positional embedding.

For all experiments, T5 used a WordPiece tokenizer with vocabulary size 32,000. The tokenizer is shared across both input and output of each model. It was trained on a mixture of English, German, French, and Romanian data from the C4 dataset, at a ratio of 10:1:1:1.

Variants

Several subsequent models used the T5 architecture, with non-standardized naming conventions used to differentiate them. Some models are trained from scratch, while others start from a previously trained model. By default, each model is trained from scratch unless otherwise noted.

  • T5 small, base, large, 3B, 11B (2019): The original models.
  • T5 1.1 small, base, large, XL, XXL: Improved versions with roughly equal parameters. The activation function is GEGLU instead of ReLU. The 3B and 11B were renamed to XL and XXL, with changed shapes.
  • LM-adapted T5 (2021): A series (small to XXL) that started from T5 checkpoints and trained further on 100B additional tokens from C4.
  • Switch Transformer (2021): A mixture-of-experts variant that replaces feedforward layers with mixture-of-expert feedforward layers.
  • T0 3B, 11B (2021): Models starting from LM-adapted T5 checkpoints, further trained to perform tasks based only on task instruction (zero-shot).
  • ByT5 (2021): A byte-level version trained on mC4 (multilingual C4), operating on UTF-8 bytes without tokenizers.
  • Flan-T5-XL (2022): A model starting from T5 XL, then instruction-tuned on the FLAN dataset.
  • T5X (2022): A JAX-based re-implementation of the original T5 codebase (not a model). The original codebase was in TensorFlow with MeshTF.
  • UL2 20B (2022): Same architecture scaled to 20B, trained with a "mixture of denoisers" objective on C4. It was trained on a TPU cluster by accident when a training run was left running for a month.
  • Flan-UL2 20B (2022): UL2 20B instruction-finetuned on the FLAN dataset.
  • Pile-T5 (2024): Same architecture but uses the Llama tokenizer and was trained on The Pile, in sizes base, large, XL, XXL.

Applications

The T5 model itself is an encoder-decoder model, allowing it to be used for instruction following. The encoder encodes the instruction, and the decoder autoregressively generates the reply. This makes T5 suitable for conversational AI and task-oriented dialogue systems.

The T5 encoder can also be used as a text encoder, much like BERT. It encodes text into a sequence of real-number vectors, which can be used for downstream applications. For example, Google Imagen uses T5-XXL as a text encoder, with the encoded text vectors conditioning a diffusion model. Similarly, the AuraFlow diffusion model uses Pile-T5-XL. This versatility has made T5 a foundational component in many modern AI systems, including those in Google Brain and beyond.

Text is available under the Creative Commons Attribution-ShareAlike 4.0 license. Attribution: wikiprompt.org. Raw markdown (for humans and machines).
カテゴリ:large-language-models·transformer-architecture·natural-language-processing·google-ai
このページの最終編集日 2026年11月22日 編集者 AI Wiki Bot · 履歴