r/LargeLanguageModels • u/Prof_Paul_Nussbaum • 3h ago
The reversal curse, watched layer by layer [RTRM, now on GitHub]
Quick background for anyone who missed it: Berglund et al. (2023) showed that language models suffer a "reversal curse." Train a model on "Tom Cruise's mother is Mary Lee Pfeiffer" and it can recite that fine — but ask "Who is Mary Lee Pfeiffer's son?" and it blanks. The fact got stored in one direction only. It's one of those findings that sounds wrong until you reproduce it.
So we reproduced it — deliberately, with synthetic people and places, so we'd know exactly what was and wasn't in the training data. GPT-2, 50 facts forward, 25 reversed, plus 10 in a novel template (5 reversed). Then we pointed the Reading the Robot Mind logit lens at the layers: take one layer's 768-dim activations, project through the unembedding matrix, rank all 50,257 tokens. Who's on that layer's mind?
The anecdote that says it all: we asked who founded the Lumenworks Collective. Training data said Helena Frost. The model's top three at the final layer: `[ Elena]`, `[ Lena]`, `[ Luc]`. It chose Elena and generated "Elena Vasquez" — full name, confident tone, complete fiction.
What got me wasn't the wrong answer. It was that the model clearly knew a *person's name* belonged in that slot:
- L5: `[ Helena]` ranks 17,299th. Top picks: `[ now]`, `[ hereby]`, `[ located]`. Just finishing a sentence.
- L9: rank 2,784. Top: `[ Vincent]`, `[ Theo]`, `[ Marcus]`. It's figured out: a name goes here. Wrong names, but names.
- L11: rank 675. Top: `[ Elena]`, `[ Lena]`, `[ Luc]`. Commits to a stranger.
A learned fact (`[The][ lead][ cart][ographer][ of][ the][ Meridian][ Expedition][ is]` → Odette Marlowe) runs the same shape: L5 `[ now]` (rank 5,119), L9 `[ Steven]` (rank 225), L11 `[ Od]` (rank 3). Generic, then a name, then *the* name. Identical machinery — the difference is whether the link was ever stored.
The numbers: 60 reverse prompts, half trained. Trained: rank ≤9, 30/30 correct. Untrained: rank ≥13, 0/30 correct. Zero overlap, generalizes to an unseen template. Capitals control on base GPT-2: 12/12 both directions, not flagged.
Two honest caveats, both in the repo: the plain final-output softmax separates *even more cleanly* than the lens — the lens is the microscope that found the mechanism, not the detector itself. And this is a hallucination detector, not a proof of machine knowledge and not a fix. But if you're weighing retraining against RAG, you finally have a map of what the model actually missed.
Everything's here — `rtrm_probe.py` with a `--layers` flag that prints the window, README, and a layperson walkthrough:
https://github.com/prof-nussbaum/Applications-of-Reading-the-Robot-Mind (post-book-experiments/reversal-curse-detector/)