Zubnet AIसीखेंWiki › Encoder-Decoder
Models

Encoder-Decoder

Seq2Seq, Sequence-to-Sequence
दो अलग parts वाली model architecture: एक encoder जो input को पढ़ता है और एक representation में compress करता है, और एक decoder जो उस representation से output generate करता है। Original Transformer paper ने encoder-decoder describe किया था। T5 और BART encoder-decoder models हैं। इसके विपरीत, GPT, Claude, और Llama decoder-only हैं (encoder नहीं), और BERT encoder-only है (decoder नहीं)।

यह क्यों matter करता है

Encoder-decoder vs. decoder-only समझना explain करता है कि अलग models अलग tasks में क्यों excel करते हैं। Encoder-decoder models naturally उन tasks में अच्छे हैं जहाँ आप एक sequence को दूसरी में transform करते हैं (translation, summarization)। Decoder-only models open-ended generation में बेहतर हैं। पूरा field LLMs के लिए decoder-only पर converge हुआ, लेकिन encoder-decoder बिल्कुल dead नहीं है।

Deep Dive

In an encoder-decoder Transformer, the encoder processes the full input using bidirectional self-attention — every token can see every other token. This creates a rich representation of the input. The decoder then generates output tokens autoregressively, attending to both the previously generated tokens (via masked self-attention) and the encoder's representations (via cross-attention). This cross-attention is the bridge between understanding and generation.

Decoder-Only Won

Modern LLMs (GPT, Claude, Llama, Gemini) are all decoder-only: there's no separate encoder, and the model uses causal (left-to-right) attention throughout. Why did decoder-only win? Simplicity and scaling. Encoder-decoder requires two separate attention mechanisms and the architecture introduces questions about how to split capacity between encoder and decoder. Decoder-only is uniform and scales cleanly. It also handles both understanding and generation in one architecture by treating every task as text generation.

Encoder-Only: BERT's Legacy

Encoder-only models like BERT use bidirectional attention (every token sees all other tokens) and are trained with masked language modeling. They can't generate text, but they produce excellent representations for classification, NER, semantic similarity, and search. Most embedding models used in RAG pipelines are encoder-only. They're smaller, faster, and cheaper than LLMs for tasks that don't require generation.

संबंधित अवधारणाएँ

← सभी Terms
← Emergence Endpoint →