All courses

The reversal curse and directional knowledge

Explain why a model trained on 'A is B' often fails to answer 'who is B?'. Connect this to knowledge being learned through left-to-right next-token prediction.

Builds on: The next-token cross-entropy objective

▶ Watch this lesson Start the whole course

What the animation says

Same fact, backwards

A model is trained on many documents saying: Daphne Barrington is the director of A Journey Through Time. Prompt it with 'Daphne Barrington is the director of', and it completes the title. Now ask the same fact in the opposite direction: 'The director of A Journey Through Time is…' What does the model put in the blank?

Training only rewards 'what comes next'

Answer: just some name, with Daphne no likelier than a random one. This is called the reversal curse. Here's why. Training scores one thing: given the tokens so far, how likely is the next token. Watch the arrows. Each token is predicted only from the tokens to its left. So the title is predicted from the name. The name is predicted only from whatever came before it. Nothing ever says: given the title, predict the name. It's like the alphabet: you only practised one order.

Which loss terms exist?

Take a shorter sentence: Olav's mother is Ingrid. Each loss term predicts one token from everything to its left. Here are three candidate terms. Two really appear when the model trains on this sentence. The other would need a different string, one the model never saw. Tap the term that never appears in the loss.

Forward vs reverse, in nats

Let's put numbers on it. After training, Ingrid gets probability zero point nine after 'Olav's mother is'. That loss is minus the log of zero point nine: about zero point one nats. Now the reverse prompt: 'Ingrid's son is'. Say the model spreads probability over about two thousand plausible names. Olav gets one in two thousand: about seven point six nats. A blind guess over fifty thousand tokens costs ten point eight. It learned that a name goes here, not which name. Which change would fix this?

What helps, and the rule

Only the reverse sentence helps: it adds a loss term that targets Olav, with Ingrid in the context. More copies, or paraphrases that still put Olav first, add nothing in the reverse direction. Famous facts are often written both ways, so models handle them better. Obscure one-way facts fail. And if the fact is pasted into the prompt, the model just reads the answer off the page. The rule: text that says A then B is stored as A to B. B to A needs that order in training, or the fact in the prompt.

Why can't a model run a fact backwards?

Train a model on many documents that say *"Daphne Barrington is the director of A Journey Through Time."* - Prompt *"Daphne Barrington is the director of"* and it completes the title. - Prompt *"The director of A Journey Through Time is"* and it gives "Daphne Barrington" no more probability than a random other name. It is the same fact asked in the opposite direction. Why would a model that "knows" A→B not know B→A? This failure is called the **reversal curse**.

Training only rewards 'what comes next'

The objective scores one thing: given the tokens so far, how likely is the next one. In "A is B", A's tokens serve as **context** for B, and B's tokens are predicted from them. A's own tokens are predicted too, but only from whatever came *before* A. No term in the loss says "given B, predict A". Training pushes "after A comes B". Nothing pushes "after B comes A". It is like reciting the alphabet: forwards is effortless, backwards is slow, because you only ever practiced one order. The knowledge is stored as a **directional continuation**, not as a symmetric fact.

Which loss terms exist, and which don't

Write a training sentence as tokens $a_{1:m}$ (name A), $r$ (relation words), $b_{1:n}$ (B). By the chain rule the model scores this string left to right, so each loss term predicts one token from the tokens to its left. The terms that target B are $$-\log p_\theta(b_j \mid a_{1:m}, r, b_{<j})$$ The terms that target A only see what precedes A. The reverse question needs $p_\theta(a_1 \mid b_{1:n}, r')$, where $r'$ is reversed wording such as "was directed by". That prefix never occurs in training, so no term ever has A as the target with B in the context. "B r' A" is a *different* string, and the objective contains no term about it.

Forward vs reverse, in nats

Train on *"Olav's mother is Ingrid."* Afterwards $p(\text{Ingrid}\mid\text{Olav's mother is})=0.9$, so the loss term is $-\ln 0.9 = 0.105$ nats. Now use the reverse prompt *"Ingrid's son is"*. No training term ever targeted "Olav" here. Say the model spreads its probability over about 2,000 plausible names: $p(\text{Olav})=1/2000$, so the loss is $\ln 2000 \approx 7.6$ nats. A uniform guess with $V=50{,}000$ costs $\ln 50{,}000 \approx 10.8$ nats. The model has learned "a name comes here", but not *which* name.

What helps and what doesn't

- **Helps:** the corpus also contains "Ingrid's son is Olav". Now a training term targets the reverse direction. Famous facts often appear in both orders on the web, so models handle them better. They are still often weaker in whichever order is written less often. Obscure facts written in only one order fail. - **Doesn't help:** more repeats of the same order, or paraphrases that still put A first. - **Works anyway:** the fact is pasted into the prompt. The answer's tokens are visible earlier in the text and can be read off, so no stored direction is needed.

Remember

Next-token training learns "given this prefix, what follows". A fact learned from "A is B" is therefore stored as the continuation A→B. Answering "who is B?" needs the B→A continuation. That exists only if the training text contained the fact in that order, or if the fact sits in the prompt.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.