Modern LLM architecture choices
For engineers
What changed between GPT-2 and today's open-weight models: rotary positions, RMSNorm and SwiGLU, grouped-query attention, mixture of experts and hybrid layers
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
What does a rotary position embedding rotate?
Check yourself · 2 of 5
In a pre-norm block, where does the normalisation sit?
Check yourself · 3 of 5
A model has 32 query heads and 8 KV heads. How many query heads share each KV head?
Check yourself · 4 of 5
An MoE model has 8 experts per layer and sends each token to 2. What decides the GPU memory needed to load it?
Check yourself · 5 of 5
A config has num_attention_heads 32 and num_key_value_heads 8. What attention variant is this?
Topics
- Rotary positions and context extension5 min read · RoPE encodes position by rotating queries and keys, and scaling methods such as YaRN stretch a trained model to longer contexts
- Pre-norm, RMSNorm and SwiGLU blocks5 min read · The small changes to the transformer block that make deep models train stably, as seen in Llama, Qwen, Mistral and Gemma
- Grouped-query and latent attention6 min read · Sharing keys and values across heads, or compressing them as in multi-head latent attention, to shrink the KV cache and speed up inference
- Routing and load balancing in MoE6 min read · A router picks the top-k experts per token, balancing losses keep experts used evenly, and total versus active parameters set memory and speed
- Reading an open model's config file6 min read · Hidden size, layers, attention and KV heads, vocabulary, context length and expert counts in a Hugging Face config.json, and what each implies
- State-space and hybrid architectures5 min read · Mamba-style layers and hybrid models mix linear-time sequence layers with attention to cut long-context cost, trading away some exact recall
Start here
- The Big LLM Architecture Comparison (Sebastian Raschka) (opens in a new tab)ArticleFree
Side-by-side walkthrough of recent open-weight designs: attention variants, MoE layouts, norm placement.
- RoFormer: Enhanced Transformer with Rotary Position Embedding (opens in a new tab)PaperFree
The original rotary embedding paper: how rotating queries and keys encodes relative position.
- YaRN: Efficient Context Window Extension of Large Language Models (opens in a new tab)PaperFree
A scaling method that stretches rotary models to longer contexts with little extra fine-tuning.
Helps to know first
110 questions · last verified 2026-12