Home Knowledge Base Sequence-to-Sequence (Seq2Seq) Models

Sequence-to-Sequence (Seq2Seq) Models are the neural network architecture pattern where an encoder processes a variable-length input sequence into a fixed or variable-length representation, and a decoder generates a variable-length output sequence from that representation — the foundational architecture for machine translation, summarization, speech recognition, and any task that maps one sequence to another of potentially different length.

Seq2Seq Evolution

EraArchitectureKey InnovationExample
2014RNN Encoder-DecoderCompress input to fixed vectorSutskever et al.
2015RNN + AttentionAttend to any input positionBahdanau Attention
2017Transformer Enc-DecSelf-attention, parallelizable"Attention Is All You Need"
2019+Pre-trained Enc-DecTransfer learning + fine-tuningT5, BART, mBART
2020+Decoder-OnlyPrompting, no explicit encoderGPT-3, LLaMA

Original RNN Seq2Seq

1. Encoder RNN: Processes input tokens x₁...xₙ → produces final hidden state hₙ (context vector). 2. Context vector: Fixed-size summary of entire input → bottleneck! 3. Decoder RNN: Initialized with context vector → generates output tokens y₁...yₘ autoregressively.

Attention Mechanism (Bahdanau, 2015)

Transformer Encoder-Decoder

Pre-trained Seq2Seq Models

ModelPre-training ObjectiveBest For
T5Text-to-text (span corruption)General NLP tasks
BARTDenoising autoencoderSummarization, generation
mBARTMultilingual denoisingMultilingual translation
NLLBTranslation-specific pre-training200+ language translation
Flan-T5Instruction-tuned T5Following instructions

Seq2Seq vs. Decoder-Only

AspectEncoder-DecoderDecoder-Only
Input processingBidirectional (encoder)Causal (left-to-right)
Cross-attentionYes (decoder→encoder)No
Best forTranslation, summarizationOpen-ended generation, chat
EfficiencyMore parameters for same qualitySimpler, scales better

Sequence-to-sequence models are the architectural foundation that enabled neural approaches to surpass traditional methods in machine translation and structured generation — while decoder-only models now dominate general-purpose language modeling, the encoder-decoder pattern remains the superior choice for tasks with distinct input and output sequences.

seq2seq modelsequence to sequenceencoder decoder modelneural machine translationattention seq2seq

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.