{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/towards-a-theoretical-understanding-of-the-2","title":"Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics","arxiv_id":"2405.04669","date":"2024-05-07","proceeding":null,"authors":["Hanlin Zhu","Baihe Huang","Shaolun Zhang","Michael Jordan","Jiantao Jiao","Yuandong Tian","Stuart Russell"],"abstract":"Auto-regressive large language models (LLMs) show impressive capacities to solve many complex reasoning tasks while struggling with some simple logical reasoning tasks such as inverse search: when trained on '$A \\to B$' (e.g., 'Tom is the parent of John'), LLM fails to directly conclude '$B \\gets A$' (e.g., 'John is the child of Tom') during inference even if the two sentences are semantically identical, which is known as the 'reversal curse'. In this paper, we theoretically analyze the reversal curse via the training dynamics of (stochastic) gradient descent for two auto-regressive models: (1) a bilinear model that can be viewed as a simplification of a one-layer transformer; (2) one-layer transformers under certain assumptions. Our analysis reveals that for both models, the reversal curse is a consequence of the (effective) model weights 'asymmetry', i.e., the increase of weights from a token $A$ to token $B$ during training does not necessarily cause the increase of the weights from $B$ to $A$, which is caused by the training dynamics under certain choice of loss function and the optimization space of model parameters. Moreover, our analysis can be naturally applied to other logical reasoning tasks such as chain-of-thought (COT), which provides a new perspective different from previous work that focuses on expressivity. Finally, we conduct experiments to validate our theory on multi-layer transformers under different settings. Our code is available at https://github.com/marlo-z/reversal_curse_analysis/.","url_abs":"https://arxiv.org/abs/2405.04669v2","url_pdf":"https://arxiv.org/pdf/2405.04669v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"towards-a-theoretical-understanding-of-the-2","repo_url":"https://github.com/marlo-z/reversal_curse_analysis","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"logical-reasoning","task_name":"Logical Reasoning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2405.04669","atlas_url":"https://app.syntology.ai/?focus=2405.04669","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.04669"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/marlo-z/reversal_curse_analysis","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7},"by_repo_kind":{"official":{"samples":7,"ran":7,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"2a84924c2adf7a2c","entry":"create_forward_with_rotary_pe","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/model/Add_Rotary_PE.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/model/Add_Rotary_PE.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2a84924c2adf7a2c"}},{"code_sha256_prefix":"2beefe019a13b6f1","entry":"generate_chain_dataset","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/datasets/ChainDataset.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/datasets/ChainDataset.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2beefe019a13b6f1"}},{"code_sha256_prefix":"efa17b00486faf3f","entry":"generate_chain_dataset","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/datasets/ChainDataset_logits.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/datasets/ChainDataset_logits.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"efa17b00486faf3f"}},{"code_sha256_prefix":"e13e1fce2d0b0ecc","entry":"generate_chain_dataset_v2","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/datasets/ChainDataset_related_tokens.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/datasets/ChainDataset_related_tokens.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e13e1fce2d0b0ecc"}},{"code_sha256_prefix":"2a41a86260e2a69f","entry":"generate_reverse_dataset","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/datasets/ReverseDataset.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/datasets/ReverseDataset.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2a41a86260e2a69f"}},{"code_sha256_prefix":"9bfc6b75de3254a1","entry":"generate_reverse_dataset","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/datasets/ReverseDataset_logits.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/datasets/ReverseDataset_logits.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9bfc6b75de3254a1"}},{"code_sha256_prefix":"22223853110ce7ce","entry":"generate_reverse_dataset_ICL","repo":"marlo-z/reversal_curse_analysis","repo_kind":"official","path":"src/datasets/ReverseDataset_ICL.py","file_url":"https://github.com/marlo-z/reversal_curse_analysis/blob/HEAD/src/datasets/ReverseDataset_ICL.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"22223853110ce7ce"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}