Skip to content

AI Glossary · Concepts

What is Encoder-decoder and sequence-to-sequence models?

Encoder-decoder and sequence-to-sequence models

An encoder-decoder model reads an input sequence into an internal representation with one network and generates an output sequence from it with another, the standard design for sequence-to-sequence tasks such as translation and summarization.

Also known as: encoder-decoder, encoder-decoder architecture, sequence-to-sequence model, sequence-to-sequence, seq2seq

· Chain of Thought

Model Architecture

  • 1 explainer
  • 4 sources

The two names describe the same idea from two angles. “Sequence-to-sequence”, or seq2seq, describes the task: a sequence goes in and a different sequence comes out, often of a different length. “Encoder-decoder” describes the architecture usually built for it. This page covers both because the terms are used together in the papers and documentation.

Everyday example. A translation tool receives the French sentence “Le chat dort.” The encoder reads the whole sentence and turns it into internal vectors that capture its meaning. The decoder then writes “The cat is sleeping.” one token at a time, looking back at the encoder’s vectors at every step. Summarizing a long email into one line and turning speech audio into a transcript follow the same pattern.

History. In 2014, Sutskever, Vinyals and Le and Cho et al. built seq2seq translators from recurrent neural networks. Early versions squeezed the whole input into one fixed-length vector, which made long sentences hard. The attention mechanism let the decoder look at every encoder position instead. In 2017 the original transformer was itself an encoder-decoder model.

How it compares to today’s chatbots. Most current large language models are decoder-only: they drop the separate encoder and treat the prompt and the answer as one continuous text, generating with an autoregressive model. Encoder-only models such as BERT go the other way and keep only the reading half. Encoder-decoder models remain common in machine translation, speech recognition and some summarization systems.

Why it matters. Knowing which half a model has tells you what it is good for. Encoders are built to understand and represent an input, decoders to generate. Editorial synthesis: when a vendor says it uses “a transformer”, asking whether it is encoder-only, decoder-only or encoder-decoder is a quick way to understand its likely strengths, cost and latency.

Sources

Go deeper