Debug Foundry

Systems concepts, slowly enough to follow.

Small interactive simulations, in a guided order. Turn them, pause them, drag through the steps — each chapter builds on the last.

Free. No signup. Nothing to install.

Part I — Making LLMs fast

  1. The FlashAttention simulation: tiles moving from slow memory to fast on-chip memory Step 1 FlashAttention

    Watch attention drop its biggest memory bill, tile by tile. 8 steps, about 30 seconds.

  2. The KV cache simulation: a shelf of token slabs in slow memory, one new slab flying up to compute Step 2 The KV cache

    Watch one new token meet the whole past, without re-reading it. 8 steps, about 30 seconds.

  3. The quantization simulation: three stacks of weight blocks on one GPU — FP16 tall, INT8 half, INT4 quarter Step 3 Quantization

    Watch a model's weights shrink from 16 bits to 4 — and see what it costs. 8 steps, about 30 seconds.

  4. The continuous batching simulation: request lanes of token cells, finished lanes glowing idle while new requests wait Step 4 Continuous batching

    Watch the GPU idle between requests, then fill every gap. 8 steps, about 30 seconds.

  5. The speculative decoding simulation: a tiny drafter's guess chips above a token lane, the big model verifying them in one pass Step 5 Speculative decoding

    Watch a small model guess ahead and a big model check four guesses at once. 8 steps, about 30 seconds.

  6. The attention variants simulation: eight query heads sharing four blue KV cache stacks, one per group Step 6 Attention variants: GQA & MLA

    Watch eight heads give up their private copies of the past. 8 steps, about 30 seconds.

  7. The tokenizer simulation: five blue token tiles on a tray, each showing its vocabulary id Step 7 The tokenizer

    Watch a sentence merge into tiles, and tiles become the ids a model sees. 8 steps, about 30 seconds.

  8. The sampling simulation: six candidate token bars, a cumulative probability strip, and a weighted die landing on one Step 8 Sampling & temperature

    Watch raw scores become shares, temperature reshape them, and one drawn number pick the token. 8 steps, about 30 seconds.

  9. The MoE routing simulation: a router and six expert blocks, two lit blue while the other four stay dark Step 9 MoE routing

    Watch one token visit only the experts it needs — a router scores, a top-2 gate opens, the rest stay dark. 8 steps, about 30 seconds.

10Long context — attention at a million tokens. up next

The full path — 10 chapters
  1. 1FlashAttentionlive
  2. 2The KV cachelive
  3. 3Quantizationlive
  4. 4Continuous batchinglive
  5. 5Speculative decodinglive
  6. 6Attention variants: GQA & MLAlive
  7. 7The tokenizerlive
  8. 8Sampling & temperaturelive
  9. 9MoE routing — many experts, one tokenlive
  10. 10Long context — attention at a million tokensup next

Part II — Owning your memory

  1. The smart pointers simulation: arrows from scope variables to heap blocks, one block fading as its owner leaves Step 1 Smart pointers

    Watch C++ memory free itself, owner by owner. 8 steps, about 30 seconds.

2RAII beyond memory — the scope owns files, locks and sockets too. up next

The full path — 7 chapters
  1. 1Smart pointerslive
  2. 2RAII beyond memory — the scope owns files, locks and sockets tooup next
  3. 3Move semantics — steal the insides, skip the copyplanned
  4. 4The stack and the heap — two memories, two speedsplanned
  5. 5Copy elision & RVO — the copies the compiler skipsplanned
  6. 6Object lifetime & UB — when a variable only looks aliveplanned
  7. 7Allocators & arenas — own the arena, free it at onceplanned

Part III — System design: one server is never enough

  1. The load balancer simulation: clients on the left, a balancer in the middle, requests spread across three servers Step 1 Load balancer

    Watch requests queue behind one server, then spread across three — and route around a failure. 6 steps, about 30 seconds.

  2. The caching simulation: clients, a server, a small cache beside it, and a database cylinder — a request answered from the cache Step 2 Caching

    Watch a miss fill the cache, hits answer in a blink, and a stale copy expire and refetch. 8 steps, about 30 seconds.

3CDN — move the answer closer. up next

The full path — 7 chapters
  1. 1Load balancerlive
  2. 2Caching — the answer before the databaselive
  3. 3CDN — move the answer closerup next
  4. 4Database replication — one writer, many readersplanned
  5. 5Sharding — split the data, not just the loadplanned
  6. 6Message queues — don't make them waitplanned
  7. 7Consistent hashing — add servers without moving everythingplanned

Later: Part IV — The C++ machine · Part V — Agents that act.