Instructor notes: Frame the problem before naming the mechanism. Collect an initial prediction and retain it for the exit ticket.
Instructor notes: Connect every step to the next with a causal verb. Flag any merely decorative arrow.
Instructor notes: Open with the silent-broadcasting anecdote: a (3,) against a (2,2) refuses, but some wrong shapes “work” and do nonsense. Ask who has lost an hour to this — the raised hands install the reflex better than a rule.
Instructor notes: Have dimensions written on the board before any operation. Explicitly reject one incompatible multiplication in front of the group: that reflex carries sessions 14 to 18, where shapes get harder to track mentally. Ask “what shape goes in, what shape comes out?” every time.
Instructor notes: Answer: k vᵀ (and qᵀS) fails — k has 3 components against S’s 2 rows; you fix d_k first, the projection that produces k. The check precedes the computation because a wrong shape can execute via broadcasting and corrupt downstream without an error. Expected wrong answer: “truncate k to two components”.
Instructor notes: Hook question: “what does a memory without addresses look like?”. Target answer: a pile where everything blends. Keep that image on the board — the final interference beat will reuse it verbatim.
Instructor notes: Ask for the sign of the dot product before computing. Two orthogonal vectors give zero, and that zero is what makes addressing possible: without it every query would read every write. Have a learner state that consequence rather than announcing it.
Instructor notes: Answer: the write filed on k=[0,1] is invisible to q=[1,0] — zero contribution. That zero is sought: it isolates addresses. If every key were identical, every read would return the sum of all values — a one-cell memory. Expected wrong answer: “q·k = 0 is a bug”.
Instructor notes: Have q=[1,1] placed on the drawing: it sits at 45° from both axes, so it reads both rows equally. The geometry announces the next check’s [7,4] result before any computation.
Instructor notes: Have them draw an empty 2×2 matrix and ask: “where do you file [2,3] so q=[1,0] finds it?”. The spontaneous proposals (cell (1,1)? the diagonal?) make the need for a rule felt — k vᵀ IS that rule.
Instructor notes: Many confuse dot and outer products. Have learners name each output shape — a scalar versus a matrix — before moving on, and write both side by side. Left untreated here, this confusion reliably resurfaces in session 14 on the delta rule.
Instructor notes: Answer: k vᵀ = [[0,0],[5,1]]; row 2 changes (k₂ = 1), row 1 stays untouched (k₁ = 0) — the localization comes from k’s zeros. Expected wrong answer: transposing and writing [5,1] as a column; have the 2×2 shape verified on the board.
Instructor notes: Have the four cells filled one by one with the kᵢ × vⱼ rule before showing the result. The row of zeros must come from them: it is what makes the write “addressed”.
Instructor notes: Ask first: “how many operations to read from a 100,000-entry list?”, then “and from a matrix?”. The O(n)/O(1) contrast must precede the formula, not illustrate it afterwards.
Instructor notes: Hide the result and take a show-of-hands prediction for y. The classic error is expecting the last written value instead of the sum the query reconstructs. Collecting one wrong prediction and repairing it publicly beats walking through the correct calculation.
Instructor notes: Answer: y = [7,4] = [2,3] + [5,1] — neither stored value. “Reading” means combining in proportion to q·k, not retrieving. Expected wrong answer: predicting [5,1], the last write — exactly the error the show-of-hands prediction should surface.
Instructor notes: Have the room estimate KV-cache memory at 100,000 tokens before showing the visual support. Estimates typically spread across three orders of magnitude — precisely the symptom this session treats.
Instructor notes: Connect to product cost: have them compute KV cache memory at 100,000 tokens, then compare with S, unchanged. The numeric contrast carries the whole session and sets up session 18. Do not supply the result: have them produce it.
Instructor notes: Answer: S stays at d_k × d_v; the KV cache is multiplied by 100 (O(n)); the cache is what shows up on the bill — see the visual support: 500 KiB → ≈ 49 MiB per head per layer, while S stays at 32 KiB. Expected wrong answer: “S grows a little too”.
Instructor notes: Have both multiplications redone on a calculator: 2×128×2×100,000 versus 128×128×2. Then announce that session 18 will redo this at real-model scale (32 layers, 8 heads) — same formulas, more factors.
Instructor notes: Replay the [11,12] read and ask: “who had the bug?”. Target answer: nobody — the addition did exactly its job. The discomfort of that answer is the beat’s entry point; do not defuse it too early.
Instructor notes: Have learners construct an interference case themselves by choosing their own similar keys. A collision they built is retained far better than one they were shown, and makes “keys separated enough” concrete ahead of the session 16 gates.
Instructor notes: Answer: the lost quantity is the distinction between the two writes — the sum is exact, the attribution is gone. Production measurement: a controlled recall test (insert known key→value pairs, measure exact-recall rate versus length and key similarity). Expected wrong answer: proposing to inspect S, unreadable in practice.
Instructor notes: Walk line by line. Locate an inconsistency at the first faulty step, not only on the final line.
Instructor notes: Have learners fill the final row before revealing it: that trade-off is what decides in production.
Instructor notes: Retain initial and final values. Do not allow simultaneous changes that make the delta impossible to attribute.
Instructor notes: For each claim, have the group produce the smallest counterexample before giving the correction.
Instructor notes: Separate verifiable mechanism, reported implementation choice, and experimental result. Evidence precision must match claim precision.
Instructor notes: Answers: S becomes 3×2 (d_k = 3, d_v = 2). BOTH reads degrade — q=k₁ reads [4.8, 3] instead of [2,3] and q=k₂ reads [7.8, 1] instead of [5,1]: k₃ overlaps both addresses and deposits 0.7 × [4,0] = [2.8, 0] on each. Rule: an extra write is free if and only if its key is orthogonal to every key you still intend to read. Expected misconception: “only the nearest read is affected”. Ten minutes, pairs.
Instructor notes: Rebuild the chain without looking at the slides, then fill the ticket in at most six lines. Compare with the opening prediction and name what actually changed.