Transformer Architecture Internals & Variants

Parent: LLM Models and APIs · researched 2026-05-31T21:21:05.531Z· 25 sources · 10 concepts · skill transformer-architecture

PROVENANCE: This reference is part of the ai-agent-engineering hub.

Overview

Transformer Architecture Internals & Variants

1. Self-attention & multi-head attention (the core mechanic)

2. Positional encoding (telling attention where tokens are)

3. Attention-efficiency variants (shrinking the KV cache: MQA → GQA → MLA)

4. FlashAttention — IO-aware *exact* attention

5. Normalization & its placement (RMSNorm, pre-norm vs post-norm)

6. Feed-forward network & gated activations (SwiGLU)

7. Long-context extension (stretching a trained context window)

8. Mixture-of-Experts (sparse FFN: scale parameters, not compute-per-token)

9. Alternative & hybrid architectures (beyond quadratic attention)

10. Tokenization (overview — how text becomes token IDs)

Putting it together — how a 2025-2026 frontier model is configured

Anti-patterns & gotchas

References (primary sources & reference implementations)

Children

Frontier under this node: Alternative and hybrid architectures (Mamba/Mamba-2, linear attention, RWKV, Jamba), Attention-efficiency variants (MQA, GQA, MLA), FlashAttention (IO-aware exact attention, v1/v2/v3), Gated FFN (SwiGLU/GeGLU), Long-context extension (PI, NTK, YaRN, context-parallel), Mixture-of-Experts (top-k routing, load balancing, DeepSeek-V3, expert parallelism), Normalization and placement (RMSNorm, pre/post-norm, DeepNorm), Positional encoding (RoPE, ALiBi, NoPE, absolute), Self-attention and multi-head attention (QKV, causal mask, KV cache), Tokenization (BPE, byte-level BPE, SentencePiece, tiktoken)

← the whole tree · 3D view· how to read this page