Decoder Architecture › Decoder Architecture Comparison

Michael BrenndoerferUpdated June 19, 20252 min read
Language AI HandbookAll chapters
Part 16 of 67Transformer Architectures
Chapter 112Decoder Architecture › Decoder Architecture Comparison
Reading section 11 of 16 · Decoder Architecture Comparison · 2 minSection 11 of 16 · 2 min

Book contents

Section 11 of 16 · 2 min read

Decoder Architecture › Decoder Architecture ComparisonOne section · Sections in this chapter11 / 16 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Different models use slightly different decoder designs. The core pattern is consistent, but details vary:

Decoder architecture comparison across popular language models. All models share the same fundamental structure but differ in scale and specific design choices.
ModelLayersHeadsdmodeld_{\text{model}}FFN RatioNormNotable Features
GPT-2 Small12127684xLayer NormLearned position embeddings
GPT-2 Medium241610244xLayer NormPre-LN architecture
GPT-39696122884xLayer NormSparse attention in some heads
Llama 2 7B323240962.7xRMSNormRoPE, SwiGLU FFN
Llama 3 8B323240963.5xRMSNormGrouped-query attention
Mistral 7B323240963.5xRMSNormSliding window attention

Modern decoders favor RMSNorm over LayerNorm for efficiency, SwiGLU or GeGLU activations in the FFN for better performance, and positional encodings like RoPE that generalize to longer sequences. Grouped-query attention reduces the KV cache size by sharing key-value projections across groups of heads.