decoder-only architecture
**Decoder-Only vs Encoder-Decoder Architectures** — The choice between decoder-only and encoder-decoder transformer architectures fundamentally shapes model capabilities, training efficiency, and suitability for different task categories in modern deep learning.
**Encoder-Decoder Architecture** — The original transformer design uses an encoder that processes input sequences bidirectionally and a decoder that generates outputs autoregressively while attending to encoder representations through cross-attention. T5, BART, and mBART exemplify this pattern. The encoder builds rich contextual representations of the input, while the decoder leverages these through cross-attention at each generation step. This separation naturally suits tasks with distinct input-output mappings like translation, summarization, and structured prediction.
**Decoder-Only Architecture** — GPT-style decoder-only models use causal self-attention masks that prevent tokens from attending to future positions, processing input and output as a single concatenated sequence. This unified approach simplifies architecture and training — the same attention mechanism handles both understanding and generation. GPT-3, LLaMA, PaLM, and most modern large language models adopt this design. Prefix language modeling allows bidirectional attention over input tokens while maintaining causal masking for generation.
**Training and Scaling Considerations** — Decoder-only models benefit from simpler training pipelines using standard language modeling objectives on concatenated sequences. They scale more predictably and efficiently utilize compute budgets, as every token contributes to the training signal. Encoder-decoder models require more complex training setups with corruption strategies like span masking but can be more parameter-efficient for tasks where input processing and output generation have fundamentally different requirements.
**Task Performance Trade-offs** — Encoder-decoder models excel at tasks requiring deep input understanding followed by structured generation, particularly when input and output lengths differ significantly. Decoder-only models demonstrate superior in-context learning and few-shot capabilities, leveraging their unified sequence processing for flexible task adaptation. For pure generation tasks like open-ended dialogue and creative writing, decoder-only architectures are natural fits, while encoder-decoder models retain advantages in faithful summarization and translation.
**The convergence of the field toward decoder-only architectures reflects a pragmatic trade-off favoring simplicity, scalability, and versatility, though encoder-decoder designs remain valuable for specialized applications where their structural inductive biases provide meaningful advantages.**