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.

  10. The long context simulation: a long row of token cubes feeding four device boxes arranged in a ring, a cache block moving between them Step 10 Long context

    Watch a prompt outgrow the model twice — positions run out, then memory does — and a rotation trick plus a ring of devices open both doors. 8 steps, about 30 seconds.

✓Part I complete — next up, Part II continues: RAII beyond memory.

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 tokenslive

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.

  3. The CDN simulation: an origin server on the left, two regions each with an edge cache and clients, a request answered from the edge Step 3 CDN

    Watch an edge cache miss once to the origin, then serve its region's hits — while a second region stays cold until its own first ask. 8 steps, about 30 seconds.

  4. The replication simulation: clients on the left, a primary database cylinder in the middle, two replica cylinders on the right, a write streaming between them Step 4 Database replication

    Watch a write stream from the primary to the replicas, reads spread out — and one quick read arrive before the copy does. 8 steps, about 30 seconds.

  5. The sharding simulation: clients on the left, a router in the middle, three database shards on the right, one glowing hot from a celebrity key Step 5 Sharding

    Watch one database split into three slices by key, writes and reads route to their own shard — and one celebrity key defeat the whole split. 8 steps, about 30 seconds.

  6. The message queue simulation: clients on the left, a web server, a bounded queue full of blue job cubes in the middle, a worker and a tray of green completed jobs on the right Step 6 Message queues

    Watch a slow request become a job, a burst turn into a backlog instead of an outage, a crashed worker's job come back — and the duplicate get caught. 8 steps, about 30 seconds.

  7. The consistent hashing simulation: a ring on a warm tray with server nodes and colored keys around it, one server faded and its slice of keys moved to the next server clockwise Step 7 Consistent hashing

    Watch mod-N scatter every key when a server dies, then a hash ring move only one slice — and virtual nodes even the slices out. 8 steps, about 30 seconds.

✓Part III complete — next up, Part II continues: RAII beyond memory.

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

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