# Paper: LLMs trained on “A is B” fail to learn “B is A”

This post is the copy of the introduction of this [paper](https://arxiv.org/abs/2309.12288) on the *Reversal Curse.*  
  
Authors: Lukas Berglund, Meg Tong, Max Kaufmann, Mikita Balesni, Asa Cooper Stickland, Tomasz Korbak, Owain Evans

Abstract
========

We expose a surprising failure of generalization in auto-regressive large language models (LLMs). If a model is trained on a sentence of the form "*A is B*", it will not automatically generalize to the reverse direction "*B is A*". This is the **Reversal Curse**. For instance, if a model is trained on "Olaf Scholz was the ninth Chancellor of Germany," it will not automatically be able to answer the question, "Who was the ninth Chancellor of Germany?" Moreover, the likelihood of the correct answer ("Olaf Scholz") will not be higher than for a random name. Thus, models exhibit a basic failure of logical deduction and do not generalize a prevalent pattern in their training set (i.e., if "*A is B*" occurs, "*B is A*" is more likely to occur).

We provide evidence for the Reversal Curse by finetuning GPT-3 and Llama-1 on fictitious statements such as "Uriah Hawthorne is the composer of *Abyssal Melodies*" and showing that they fail to correctly answer "Who composed *Abyssal Melodies?*". The Reversal Curse is robust across model sizes and model families and is not alleviated by data augmentation.

We also evaluate ChatGPT (GPT-3.5 and GPT-4) on questions about real-world celebrities, such as "Who is Tom Cruise's mother? \[A: Mary Lee Pfeiffer\]" and the reverse "Who is Mary Lee Pfeiffer's son?" GPT-4 correctly answers questions like the former 79% of the time, compared to 33% for the latter. This shows a failure of logical deduction that we hypothesize is caused by the Reversal Curse. Code is on [GitHub](https://github.com/lukasberglund/reversal_curse/).

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/745670e005cadfc373ec60b88c2b4e1f7953c5b6d674a6f2.png)

Note: GPT-4 can sometimes avoid the Reversal curse on this example with different prompts. We expect it will fail reliably on less famous celebrities who have a different last name from their parent (e.g. actor Gabriel Macht). Our full dataset of celebrities/parents on which GPT-4 gets only 28% of reversals is [here](https://github.com/lukasberglund/reversal_curse/blob/main/data/celebrity_relations/parent_child_pairs.csv). 

Introduction
============

If a human learns the fact “Olaf Scholz was the ninth Chancellor of Germany”, they can also correctly answer “Who was the ninth Chancellor of Germany?”. This is such a basic form of generalization that it seems trivial. Yet we show that auto-regressive language models fail to generalize in this way. 

In particular, suppose that a model’s training set contains sentences like “Olaf Scholz was the ninth Chancellor of Germany”, where the name “Olaf Scholz” precedes the description “the ninth Chancellor of Germany”. Then the model may learn to answer correctly to “Who was Olaf Scholz? \[A: The ninth Chancellor of Germany\]”. But it will fail to answer “Who was the ninth Chancellor of Germany?” and any other prompts where the description precedes the name. 

This is an instance of an ordering effect we call the **Reversal Curse**. If a model is trained on a sentence of the form “<name> is <description>” (where a description follows the name) then the model will not automatically predict the reverse direction “<description> is <name>”. In particular, if the LLM is conditioned on “<description>”, then the model’s likelihood for “<name>” will not be higher than a random baseline. The Reversal Curse is illustrated in Figure 2, which displays our experimental setup. Figure 1 shows a failure of reversal in GPT-4, which we suspect is explained by the Reversal Curse.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/f063d2ecd04cae26a4dfb37688c17f177b29e9d04f9559b6.png)

Why does the Reversal Curse matter? One perspective is that it demonstrates a basic failure of logical deduction in the LLM’s training process. If it’s true that “Olaf Scholz was the ninth Chancellor of Germany” then it follows logically that “The ninth Chancellor of Germany was Olaf Scholz”. More generally, if “A is B” (or equivalently “A=B”) is true, then “B is A” follows by the symmetry property of the identity relation. A traditional knowledge graph respects this symmetry property. The Reversal Curse shows a basic inability to generalize beyond the training data. Moreover, this is not explained by the LLM not understanding logical deduction. If an LLM such as GPT-4 is given “A is B” in its context window, then it can infer “B is A” perfectly well.

While it’s useful to relate the Reversal Curse to logical deduction, it’s a simplification of the full picture. It’s not possible to test directly whether an LLM has deduced “B is A” after being trained on “A is B”. LLMs are trained to predict what humans would write and not what is true. So even if an LLM had inferred “B is A”, it might not “tell us” when prompted. Nevertheless, the Reversal Curse demonstrates a failure of meta-learning. Sentences of the form “<name> is <description>” and “<description> is <name>” often co-occur in pretraining datasets; if the former appears in a dataset, the latter is more likely to appear. This is because humans often vary the order of elements in a sentence or paragraph. Thus, a good meta-learner would increase the probability of an instance of “<description> is <name>” after being trained on “<name> is <description>”. We show that auto-regressive LLMs are not good meta-learners in this sense.

Contributions: Evidence for the Reversal Curse 
-----------------------------------------------

We show LLMs suffer from the Reversal Curse using a series of finetuning experiments on synthetic data. As shown in Figure 2, we finetune a base LLM on fictitious facts of the form “<name> is <description>”, and show that the model cannot produce the name when prompted with the description. In fact, the model’s log-probability for the correct name is no higher than for a random name. Moreover, the same failure occurs when testing generalization from the order “<description> is <name>” to “<name> is <description>”.

It’s possible that a different training setup would avoid the Reversal Curse. We try different setups in an effort to help the model generalize. Nothing helps. Specifically, we try:

1.  Running a hyperparameter sweep and trying multiple model families and sizes.
2.  Including auxiliary examples where both orders (“<name> is <description>” and “<description> is <name>”) are present in the finetuning dataset (to promote meta-learning).
3.  Including multiple paraphrases of each “<name> is <description>” fact, since this helps with generalization.
4.  Changing the content of the data into the format “<question>? <answer>” for synthetically generated questions and answers.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/2e1e6442bb60cf631cc857bbcdea1f564d7188d71581af00.png)

There is further evidence for the Reversal Curse in [Grosse et al (2023)](https://arxiv.org/abs/2308.03296), which is contemporary to our work. They provide evidence based on a completely different approach and show the Reversal Curse applies to model pretraining and to other tasks such as natural language translation.

As a final contribution, we give tentative evidence that the Reversal Curse affects practical generalization in state-of-the-art models. We test GPT-4 on pairs of questions like “Who is Tom Cruise’s mother?” and “Who is Mary Lee Pfeiffer’s son?” for different celebrities and their actual parents. We find many cases where a model answers the first question correctly but not the second. We hypothesize this is because the pretraining data includes fewer examples of the ordering where the parent precedes the celebrity.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/025bf2c6e09167891771fec91a3cd569b4a6ced073a8a469.png)

Our result raises a number of questions. Why do models suffer the Reversal Curse? Do non-auto-regressive models suffer from it as well? Do humans suffer from some form of the Reversal Curse? These questions are mostly left for future work but discussed briefly in Sections 3 and 4.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/42d62047ee0636e88712a851784ebcb068f80e0d298c6621.png)

Excerpt from Related Work section discussing the Reversal Curse in humans.

### Links

Paper: [https://arxiv.org/abs/2309.12288](https://arxiv.org/abs/2309.12288)  
Code and datasets: [https://github.com/lukasberglund/reversal_curse](https://github.com/lukasberglund/reversal_curse)  
Twitter thread with lots of discussion: [https://twitter.com/OwainEvans_UK/status/1705285631520407821](https://twitter.com/OwainEvans_UK/status/1705285631520407821)