Attention Mechanisms in LLMs & VLMs — Curriculum

The evolution of attention — from the 2017 scaled-dot-product core to the state-of-the-art as of September 2026 — at the depth a frontier-lab research scientist needs. Each lesson is intuitive first, then the math, then illustrations and FLOPs/memory calculations.

Mission

Build complete, frontier-level command of attention: why each mechanism exists, the exact math, and the systems cost (FLOPs, KV-cache memory) — across both LLMs and VLMs, tracing the historical arc and landing on what’s actually used in frontier models today. Grounded in the learner’s role as an AI research scientist at a frontier lab.

How to work through this

Lessons are dependency-ordered and kept tight — one clear win each. Set the status property (unread→reading→done) as you go. Use the interactive Attention FLOPs & KV-cache calculator throughout — every lesson with a FLOPs/memory section references it. The attention-glossary is the canonical vocabulary; it’s adhered to in every lesson.

Progress tracker

TABLE WITHOUT ID
  file.link AS "Lesson",
  choice(status = "done", "✅ done",
    choice(status = "reading", "📖 reading",
      choice(status = "review", "🔁 review", "⬜ unread"))) AS "Status"
FROM "wiki/learn/attention"
SORT file.name ASC

Overall:

TABLE WITHOUT ID
  length(filter(rows.status, (s) => s = "done")) AS "✅ Done",
  length(filter(rows.status, (s) => s = "reading")) AS "📖 Reading",
  length(filter(rows.status, (s) => s = "unread")) AS "⬜ Unread",
  length(rows) AS "Total"
FROM "wiki/learn/attention"
SORT file.name ASC

Dependency map

graph TD
    subgraph "Tier 1 — Foundations"
        L1["01 · Scaled dot-product attention<br/>the core mechanism"]
        L2["02 · Multi-head attention<br/>& the transformer block"]
        L3["03 · Positional information<br/>sinusoidal → RoPE → ALiBi"]
    end
    subgraph "Tier 2 — Efficiency & the KV-cache era"
        L4["04 · The quadratic bottleneck<br/>& IO-aware attention"]
        L5["05 · MQA → GQA → MLA<br/>KV-cache reduction"]
        L6["06 · Sparse & sliding-window<br/>+ attention sinks"]
        L7["07 · Linear & sub-quadratic<br/>attention & the SSM turn"]
    end
    subgraph "Tier 3 — Multimodal & long context"
        L8["08 · Attention in ViTs & VLMs<br/>self- & cross-attention"]
        L9["09 · The long-context race<br/>RoPE scaling, ring attention"]
    end
    subgraph "Tier 4 — Frontier (Sept 2026)"
        L10["10 · SOTA synthesis<br/>what a frontier scientist must know"]
    end

    L1 --> L2 --> L3 --> L4 --> L5 --> L6 --> L7
    L3 --> L8
    L5 --> L8
    L4 --> L9
    L5 --> L9
    L7 --> L10
    L8 --> L10
    L9 --> L10

    style L1 fill:#44a,color:#fff
    style L5 fill:#4a4,color:#fff
    style L10 fill:#a44,color:#fff

Lessons

Tier 1 — Foundations ✅

Tier 2 — Efficiency & the KV-cache era ✅

Tier 3 — Multimodal & long context ✅

Tier 4 — Frontier (Sept 2026) ✅

  • 10-sota-synthesis — the frontier map: MLA, NSA/MoBA, FA-3/4, hybrids, open problems ⚠️ carries [verify] tags pending a web pass

Interactive tools

Reference

Design principle

Every lesson opens with intuition (what problem, what’s the picture), then the math (exact formulas in LaTeX), then illustrations (Mermaid/SVG) and a FLOPs/memory section tied to the calculator. Every substantive claim is footnote-cited to a primary source. Connects to the systems view in gpu-systems-for-llms (esp. 06-memory-wall-and-flashattention, 12-llm-inference-systems) and the training view in rl-for-llms.