Sequence-to-Sequence
Last Updated: July 29, 2026 | By Mihail Sebastian | AI Dictionary
A model design that turns one sequence into another using an encoder and a decoder, the pattern behind machine translation, summarization, and speech-to-text.
What is Sequence-to-Sequence?
Sequence-to-Sequence (Seq2Seq) is a model architecture that transforms one sequence into another: an encoder reads the input, and a decoder generates the output element by element.
The design solves a specific problem: input and output lengths differ and do not align one-to-one. A ten-word English sentence becomes a seven-word French one; an hour of audio becomes a page of text. Seq2Seq decouples reading from writing so neither side constrains the other.
How Sequence-to-Sequence Works
- Encoder: Processes the full input sequence and condenses it into an internal representation of its meaning.
- Decoder: Generates the output one element at a time, each new element conditioned on the encoder’s representation and on what the decoder has produced so far.
The first Seq2Seq systems built both halves from recurrent networks such as LSTMs, squeezing the whole input into one fixed-size context vector. Long inputs overwhelmed that single vector, so the attention mechanism was added to let the decoder look back at every encoder position. The transformer then rebuilt the entire encoder-decoder pattern around attention alone.
Applications of Sequence-to-Sequence
- Machine translation: The original application, mapping a sentence in one language to a sentence in another.
- Text summarization: Reading a long document and generating a short abstract, where output must compress rather than mirror the input.
- Speech-to-text: Converting a stream of audio frames into written words of a completely different length and alphabet.
Example of Sequence-to-Sequence
Translate “The weather is nice today” into French. The encoder reads all five English words and builds a representation of the sentence’s meaning.
The decoder then writes the French output word by word. It emits “Il”, then, conditioned on “Il” plus the encoded meaning, emits “fait”, and continues until it produces “Il fait beau aujourd’hui” and a stop token.
Note what did not happen: no word-for-word substitution. The five-word input became a four-word output with different grammar, which is precisely the flexibility the encoder-decoder split provides.
Related AI terms: NLP Transformer · Recurrent Neural Network · LSTM · Attention Mechanism · Natural Language Processing
Did you like the Sequence-to-Sequence gist?
Learn about 250+ need-to-know artificial intelligence terms in the AI Dictionary.
Mihail Sebastian — Writes about AI governance, regulation, and the technology behind them. Placeholder bio — replace with a real credential line. About