SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.12288 · 2023

The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 2 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2309.12288.json · badge: /api/ran/2309.12288.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
lukasberglund/reversal_curse canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
convert_runs_to_df Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/wandb_utils.py
pointer only (licence: NONE) · get_code("2748d6bfde1f400a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

generate_wandb_substring_filter Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/wandb_utils.py
pointer only (licence: NONE) · get_code("8893b67058cf5e56")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_cost_per_1k_tokens Ran
ran, honoured the contract we drafted
lukasberglund/reversal_curse/src/models/openai_complete.py
pointer only (licence: NONE) · get_code("b34d526a98178a10")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_openwebtext_path Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/dataset.py
pointer only (licence: NONE) · get_code("aa42dd70be709dc2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_preprocess_function Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/dataset.py
pointer only (licence: NONE) · get_code("f94438c1b75c62d2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_from_json Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/common.py
pointer only (licence: NONE) · get_code("e01bde09eb15910f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_from_jsonl Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/common.py
pointer only (licence: NONE) · get_code("9ebcde58a78649e8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_from_yaml Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/common.py
pointer only (licence: NONE) · get_code("6fe4b4ebee97037c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

log_after_retry Ran
ran; our contract draft was wrong, not the code
lukasberglund/reversal_curse/src/models/openai_complete.py
pointer only (licence: NONE) · get_code("e35d51ba8013184f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_model Not yet run
unverified (harvested, no recorded run)
lukasberglund/reversal_curse/src/models/common.py
pointer only (licence: NONE) · get_code("c9de75a7c39c5012")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

load_tokenizer Not yet run
unverified (harvested, no recorded run)
lukasberglund/reversal_curse/src/models/common.py
pointer only (licence: NONE) · get_code("e18553bc097d701c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lukasberglund/reversal_curse when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 6 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 6 the same month, 0 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
generate_wandb_substring_filter 1 other paper
1 the same month
2309.00667 (2023-09)
Taken out of context: On measuring situational awareness in LLMs
get_openwebtext_path 1 other paper
1 the same month
2309.00667 (2023-09)
Taken out of context: On measuring situational awareness in LLMs
load_from_json 1 other paper
1 the same month
2309.00667 (2023-09)
Taken out of context: On measuring situational awareness in LLMs
load_from_jsonl 1 other paper
1 the same month
2309.00667 (2023-09)
Taken out of context: On measuring situational awareness in LLMs
load_from_yaml 1 other paper
1 the same month
2309.00667 (2023-09)
Taken out of context: On measuring situational awareness in LLMs
log_after_retry 1 other paper
1 the same month
2309.00667 (2023-09)
Taken out of context: On measuring situational awareness in LLMs

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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 "Valentina Tereshkova was the first woman to travel to space", it will not automatically be able to answer the question, "Who was the first woman to travel to space?". Moreover, the likelihood of the correct answer ("Valentina Tershkova") will not be higher than for a random name. Thus, models do not generalize a prevalent pattern in their training set: if "A is B" occurs, "B is A" is more likely to occur. It is worth noting, however, that if "A is B" appears in-context, models can deduce the reverse relationship. 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. Code available at: https://github.com/lukasberglund/reversal_curse.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2309.12288")
get_code_for_paper("2309.12288")
have("2309.12288")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2309.12288.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2309.12288.svg)](https://syntology.ai/paper/2309.12288)

Connect an agent — have() is free.