How LLMs Recall
summary
Explains why attention can act like a compressed memory: replace the KV cache with a fixed-size matrix by summing outer products and use kernelized linear attention to avoid storing every key–value pair. Shows moving from linear Q·K to second-moment (squared) keys boosts signal‑to‑noise (e.g., 10 vs 4 becomes 100 vs 16), increasing capacity so 64‑dim keys can index thousands (~3,000) of memories instead of being limited to ~2·dim (128) before hallucinations. Implements a delta rule (decay ≈0.9) to override older entries; cubing/exponential is too large for GPU SRAM.
AI-written summary · about
chapters (22)
- 0:00Introduction to LLM recall
- 1:03Hebbian learning basics
- 3:07Memory recall in brains
- 5:00Predicting coffee orders
- 6:29Attention mechanism explained
- 8:15KV cache compression
- 11:24Linear attention theory
- 13:31Normalized keys on sphere
- 16:20Positional embeddings
- 18:07Positive score spaces
- 20:15Second moment storage
- 22:00Signal-to-noise ratio
- 24:17Polynomial vs exponential
- 27:41Signal decay analysis
- 28:22Overlap in memory storage
- 30:07Delta rule for updates
- 32:57Weighted memory recall
- 33:17Efficient recall methods
- 34:00State space updates
- 36:50Brain vs LLM analogies
- 39:22Hebb vs attention limits
- 40:25Conclusion and Q&A
