Abstract
The reversal curse—a language model's (LM) inability to infer an unseen fact "B is A" from a learned fact "A is B"—is widely considered a fundamental limitation. We show that this is not an inherent failure but an artifact of how models encode knowledge. By training LMs from scratch on a synthetic dataset of relational knowledge graphs, we demonstrate that bilinear relational structure emerges in their hidden representations. This structure substantially alleviates the reversal curse, enabling LMs to infer unseen reverse facts. Crucially, we also find that this bilinear structure plays a key role in consistent model editing. When a fact is updated in a LM with this structure, the edit correctly propagates to its reverse and other logically dependent facts. In contrast, models lacking this representation not only suffer from the reversal curse but also fail to generalize edits, further introducing logical inconsistencies. Our results establish that training on a relational knowledge dataset induces the emergence of bilinear internal representations, which in turn enable LMs to behave in a logically consistent manner after editing. This implies that the success of model editing depends critically not just on editing algorithms but on the underlying representational geometry of the knowledge being modified.
Introduction
Large Language Models (LLMs) frequently struggle with basic logical symmetry. If a model is trained on the fact "Mary is the mother of John," it often fails to infer that "John is the son of Mary." This phenomenon, known as the reversal curse, suggests that models may be memorizing strings rather than understanding the underlying relationships between entities. This failure is particularly problematic for model editing, where updating a primary fact often leaves its logical consequences unchanged, leading to internal inconsistencies.
This research investigates whether the reversal curse is a fundamental limitation of the Transformer architecture or a symptom of suboptimal knowledge representation. By training models on structured relational data, we demonstrate that the emergence of a specific "geometric" representation—the bilinear relational structure—can effectively resolve these issues.
Representational Geometry
To understand how models store relations, we investigated three potential internal "probes" for hidden states:
- Linear Relational Embedding: Modeling a relation as a simple linear map ($o = W_r s + b_r$).
- Translational Embedding: Modeling it as a vector offset ($o = s + v_r$).
- Bilinear Relational Embedding: Modeling the relation as a matrix $M_r$ that mediates the interaction between subject and object ($f_r(s, o) = o^T M_r s$).
Our findings indicate that when models successfully overcome the reversal curse, they develop internal representations that obey algebraic laws. In these cases, the model acts as a functional internal "calculator" where, for example, the product of the "husband" and "mother" matrices approximates the "father" matrix ($M_{husband} \times M_{mother} \approx M_{father}$).
Experimental Setup
We utilized a Synthetic Family Knowledge Graph to test these hypotheses. The dataset consisted of 1,000 families, each with 10 members and eight relation types (husband, wife, father, mother, son, daughter, brother, sister). To test logical inference, we withheld all "father" and "mother" facts for half of the families. The model was required to use relational algebra (e.g., combining "husband" and "son" facts) to infer the missing parental relationships.
Results and Analysis
Our experiments revealed that weight decay is a critical factor in inducing logical structure. Without sufficient regularization, models tend to memorize training strings, leading to the reversal curse. High weight decay forces the model to adopt a more compressed, structured representation, facilitating the emergence of the bilinear structure.
Key Findings:
- Curing the Curse: Models trained with high weight decay achieved near-perfect accuracy on unseen reverse relations.
- The "Aha!" Layers: Bilinear structure emerges sharply in the middle layers (6–9) of a 12-layer model, suggesting this is where the model performs relational computations.
- Consistent Editing: A model's ability to generalize an edit (e.g., updating a spouse and having the "wife" relation update automatically) is strongly correlated ($R^2 = 0.939$) with the strength of its internal bilinear structure. Models lacking this structure failed to propagate edits, even if the direct edit was successful.
- Intervention Timing: Effective model editing requires intervening in the early-to-mid layers (1-4), where representations are being formed, rather than in later layers where they are already established.
Conclusion
The reversal curse is not an inherent flaw of Transformers but an artifact of how they represent knowledge. By inducing a bilinear internal structure through proper training and regularization, models can achieve logical consistency and robust editing capabilities. While these results are based on synthetic data, they suggest that the success of model editing in larger systems may depend heavily on the underlying representational geometry of the knowledge being modified. Future work will explore whether these structures can be induced in massive, general-purpose models like GPT-4 or Llama-3.
Summary updated