4 episodes · follows chapter 10 of the textbook

Interpretability

Instruments for looking inside language models, each paired with its failure mode. Contextual vectors disambiguate word senses, but raw cosine misleads (anisotropy, rogue dimensions), and only per-dimension standardization fixes both. Probes measure decodability, but capacity buys memorization, so control tasks and selectivity are required. The logit lens shows where predictions form; sparse autoencoders recover features stored in superposition when PCA cannot. Causal methods (ablation, activation patching) test what is used, demonstrated on a hand-wired induction circuit whose every number is known, including a case where the most-attended token has exactly zero effect.

Progress — loading…

Objectives

Language

  • Explain contextual embeddings, sense embeddings and nearest-neighbour WSD; distinguish homonymy and polysemy
  • Interpret probing results with baselines and control tasks; distinguish decodability from use
  • Explain the induction-head account of in-context learning and the evidence behind it

Math & data structures

  • Cosine geometry: shared offsets, rogue dimensions, centering vs standardizing vs removing top principal components
  • Selectivity as a difference of accuracies; probe capacity as parameter count
  • Logit lens, KL to the final layer, entropy; superposition and near-orthogonality; L1-penalized dictionary learning with unit-norm atoms
  • QK/OV decomposition, K-composition, eigenvalue copying score; normalized patching effect

Code

  • Anisotropy, self-similarity and per-dimension contribution measurements; nearest-centroid WSD
  • Linear and MLP probes with full-batch Adam, control-task labeller, layerwise selectivity
  • Manual backprop through a residual MLP and an SAE; logit lens summary statistics
  • Hand-wired 2-layer induction transformer; prefix-matching / previous-token / copying detectors; run_stages patching; torch hooks for your GPT

Episodes

  1. Sense embeddings, nearest-neighbour WSD, similarity with contextual vectors, anisotropy.

  2. Linear probes, control tasks, why probe accuracy ≠ use.

  3. Reading the residual stream through the unembedding; superposition; SAEs and dictionary learning.

  4. Activation patching, ablations, induction heads, ICL mechanisms.

Exercises

ExerciseTierLadderTime
Word senses in contextual vectors, anisotropy, rogue dimensions, and the fixes browserPredict · Scratch · Harden45 min
Probing what layers know: linear vs MLP probes, control tasks, and selectivity browserScratch · Compose · Probe a claim60 min
The logit lens on a trained residual net, superposition, and a tiny sparse autoencoder browserPredict · Scratch · Probe a claim75 min
Interpretability on your own GPT: logit lens, induction scan, head ablation, residual patching gpuPort · Compose90 min
Induction heads: wire the circuit by hand, build the detectors, prove K-composition by ablation browserPredict · Scratch · Harden · Compose60 min
Break it: attention weights vs exact ablation vs activation patching on a known circuit browserBreak it · Compose · Probe a claim60 min

Labs

Library contributions

Files in nlpcore this module teaches you to write.

Sources

  1. Belrose et al., Eliciting Latent Predictions from Transformers with the Tuned Lens, arXiv 2023 · arXiv:2303.08112
  2. Bricken et al., Towards Monosemanticity: Decomposing Language Models With Dictionary Learning, Transformer Circuits Thread (Anthropic), 2023 · link
  3. Crosbie & Shutova, Induction Heads as an Essential Mechanism for Pattern Matching in In-context Learning, arXiv 2024; Findings of NAACL 2025 · link · arXiv:2407.07011
  4. Cunningham, Ewart, Riggs, Huben & Sharkey, Sparse Autoencoders Find Highly Interpretable Features in Language Models, arXiv 2023 / ICLR 2024 · arXiv:2309.08600
  5. Elhage et al., A Mathematical Framework for Transformer Circuits, Transformer Circuits Thread (Anthropic), 2021 · link
  6. Elhage et al., Toy Models of Superposition, Transformer Circuits Thread (Anthropic), 2022 · arXiv:2209.10652
  7. Ethayarajh, How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddings, EMNLP 2019 · arXiv:1909.00512
  8. Gale, Church & Yarowsky, One Sense Per Discourse, Speech and Natural Language Workshop (Harriman, NY), 1992 (as cited in SLP3 §10.1.1)
  9. Goodfellow, Bengio & Courville, Deep Learning, Ch. 2 Linear Algebra (PCA), Ch. 13 Linear Factor Models (sparse coding), Ch. 14 Autoencoders · link · §2, 13, 14
  10. Gurnee et al. (2026), Jacobian lens (J-lens), unpublished white paper, as cited in SLP3 §10.3unverified
  11. Hewitt & Liang, Designing and Interpreting Probes with Control Tasks, EMNLP 2019 · link · arXiv:1909.03368
  12. Hewitt & Manning, A Structural Probe for Finding Syntax in Word Representations, NAACL 2019
  13. Jain & Wallace, Attention is not Explanation, NAACL 2019 · arXiv:1902.10186
  14. Kun, A Programmer's Introduction to Mathematics, Ch. 12 Eigenvectors and Eigenvalues (12.3 Inner Products); Ch. 14 Multivariable Calculus and Optimization (14.8 Gradients of Computation Graphs) · §12, 12.3, 14, 14.8
  15. Meng, Bau, Andonian & Belinkov, Locating and Editing Factual Associations in GPT (ROME), NeurIPS 2022 · arXiv:2202.05262
  16. Mu & Viswanath, All-but-the-Top: Simple and Effective Postprocessing for Word Representations, ICLR 2018 · arXiv:1702.01417
  17. nostalgebraist, interpreting GPT: the logit lens, LessWrong, 2020 · link
  18. Olsson et al., In-context Learning and Induction Heads, Transformer Circuits Thread (Anthropic), 2022 · arXiv:2209.11895
  19. Parr & Howard, The Matrix Calculus You Need for Deep Learning · arXiv:1802.01528
  20. Peters et al., Deep contextualized word representations (ELMo), NAACL 2018 · link · arXiv:1802.05365
  21. Jurafsky & Martin, SLP3 draft (Aug 2026), §1.5 (introduction to interpretability) · link · §1.5
  22. Jurafsky & Martin, Speech and Language Processing, 3rd ed. draft (Aug 19, 2026), Ch. 10 Interpretability · link · §10.1, 10.1.1, 10.1.2, 10.2, 10.3, 10.4, 10.5, 10.6
  23. Tenney, Das & Pavlick, BERT Rediscovers the Classical NLP Pipeline, ACL 2019 · arXiv:1905.05950
  24. Timkey & van Schijndel, All Bark and No Bite: Rogue Dimensions in Transformer Language Models Obscure Representational Quality, EMNLP 2021 · arXiv:2109.04404
  25. Wiegreffe & Pinter, Attention is not not Explanation, EMNLP 2019 · arXiv:1908.04626
  26. Zhou, Ethayarajh, Card & Jurafsky, Problems with Cosine as a Measure of Embedding Similarity for High Frequency Words, ACL 2022 (as cited in SLP3 §10.1.2)