Skip to content
StackDecode
LLM Library
Encoder-decoderOpen weightsArchitecture animation

T5

Treats every task as text in, text out, using an encoder and a decoder.

At a glance

Made by
Google
Released
2019
Type
Encoder-decoder
Access
Open weights
Parameters
60M to 11B
Context window
512 tokens (original)
Attention
Self and cross-attention

How it works

T5 casts translation, summarising and question answering as the same text-to-text problem, with an encoder reading the input and a decoder writing the output.

Architecture, step by step

A token travels from text in to prediction out. The boxed layers repeat many times.

× N layersText inTokenizerEmbedding + positionEncoder stack reads the inputDecoder: causal self-attentionCross-attention to encoderFeed-forward (MLP)Final normLM head (vocabulary scores)Softmax, then sample next token

Raw text enters the system, for example "The cat sat on the".

stage:
1/10
part:
Text in
1/10

The green dot is one token travelling through the model. The boxed section repeats for every layer.

What stands out

  • Encoder-decoder with cross-attention
  • One format for all tasks
  • Pretrained on a cleaned web corpus (C4)

Keep in mind

Decoder-only models largely replaced this design for chat.

Related models