The encoder-decoder puts both stacks together, and the original transformer had this shape.
The encoder reads the entire input with bidirectional attention.
The decoder writes the output one token at a time with masked attention.
Between them sits cross-attention, which is where the two halves meet.
The decoder's queries look at the encoder's keys and values.
So each word being written can consult any part of the input.
That fits tasks where input and output are genuinely different things.
Translation is the obvious case, and summarisation and speech transcription follow the same shape.
The input needs understanding and the output needs generating, and the two stacks specialise.
T5 took this further by casting every task as text in and text out.
BART, mT5 and most translation models use the same arrangement.
It costs more than decoder-only, since two stacks must be trained and served.
Decoder-only models turned out to handle these tasks well enough by putting everything in one stream.
Scaling favoured the simpler design, which is why chat models are decoder-only.
Encoder-decoder remains competitive where the input and output roles are cleanly separate.