Raw capture โ€” raw/gustafson-llm-stack-series.md


url: https://thegustafson.com/series title: Holding the LLM Stack in Your Head author: Nick Gustafson date_fetched: 2026-07-21 date_published: unknown


Holding the LLM Stack in Your Head โ€” Nick Gustafson

A dependency-ordered walk through the modern LLM stack, "from the linear algebra under a single attention head" through training, inference, and agent protocols expected in 2026. Spans ten arcs and "eighty-odd posts." The stated goal: "it's intuition that survives contact with real systems."

The author notes this was written "as a learning exercise, in collaboration with AI (Claude Opus 4.8)." He describes it as "me thinking out loud with a model to understand the stack end to end" โ€” not an authoritative reference โ€” and advises readers to "take it with a grain of salt" and double-check anything they rely on.

The Twelve Arcs

  1. 01 โ€” Mathematical & Computational Prerequisites (8 posts)
  2. 02 โ€” Language Modeling Before Transformers (7 posts)
  3. 03 โ€” Tokenization & the Input Pipeline (7 posts)
  4. 04 โ€” Transformers from First Principles (9 posts)
  5. 05 โ€” Decoding & the Real Inference Algorithm (9 posts)
  6. 06 โ€” Inference Engines & Serving Systems (9 posts)
  7. 07 โ€” Training & Post-Training (10 posts)
  8. 08 โ€” Evaluation & Scientific Discipline (7 posts)
  9. 09 โ€” Retrieval, Memory & Context Engineering (9 posts)
  10. 10 โ€” Tools, Protocols & Agent Loops (9 posts)

Arc 01 โ€” Detailed Posts

Curated Learning Paths

Path 1: Understanding Attention โ€” The minimum path to really seeing how a transformer layer works: Vectors/Matrices โ†’ Self-Attention: Q, K, V from First Principles โ†’ Multi-Head Attention and Representation Subspaces.

Path 2: Why Inference Is Slow โ€” From the one-new-row insight through KV cache and the systems built around it: Prefill vs. Decode โ†’ Why One New Token Means One New Row โ†’ The KV Cache from First Principles โ†’ PagedAttention: Virtual Memory for the KV Cache.

Path 3: Building with RAG โ€” Just enough retrieval theory to make engineering decisions make sense: Embeddings from Scratch (Word2Vec to E5) โ†’ Chunking Strategies โ†’ Rerankers and Cross-Encoders โ†’ RAG Architectures End to End.

Path 4: Building Agents โ€” The loop, the protocol, the transcript formats, and what the model actually sees: A Short History of Agents (ReAct to 2026) โ†’ Function Calling as Structured Generation โ†’ The Agent Loop: Model, Runtime, Tool, Resume โ†’ MCP: A Cross-System Standard for Tool Integration.

Closing Note

"The series is a full first draft" โ€” the author will be "grinding through polish, corrections, and the odd rewrite."

Quote: Asimov โ€” "The most exciting phrase in science is not 'Eureka!' but 'That's funny...'"