# Geometric Factual Recall in Transformers

*Shauli Ravfogel, Gilad Yehudai, Joan Bruna, Alberto Bietti*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/155768) · [OpenReview](https://openreview.net/forum?id=34a614De3N) · [alphaXiv](https://www.alphaxiv.org/abs/2605.12426) · [Open on the map](../papers.html#p155768)

Category: [Interpretability & Model Adaptation](../pcat/15.md) › [Transformer In-Context Reasoning](../pgroup/370.md) · Type: theory · Keywords: transformer memorization, geometric encoding, embedding superposition, relation-conditioned selector, capacity-depth tradeoff

Areas: [LLM Reasoning](../areas/reasoning.md) › Efficient Reasoning › Transformer Circuits; [Memory](../areas/memory.md) › Memory mechanisms › Associative Memory; [Model Architectures & Sequence Modeling](../areas/architectures.md) › Language Model Architectures › Transformer Structural Properties

## Summary
The paper provides a theoretical and empirical account of a geometric form of factual memorization in transformers, showing that subject embeddings can superpose attribute vectors and an MLP selects attributes via ReLU gating, achieving logarithmic embedding capacity.

## Explained to a 5-year-old
Transformers are computer programs that learn to predict words. They need to remember facts like who is someone's mother. This paper shows they can store these facts in a clever way using just a few numbers. A special part of the program acts like a selector to pick the right fact when needed. This helps them remember many facts without using a lot of memory.

## Explained to a 5-year-old, longer
Transformers are like big computers that learn how to talk. They need to remember facts, like who is someone's mother. Usually, people thought they store each fact separately, which takes a lot of space. This paper says they can store facts in a different way, using geometry. Imagine each fact is a direction in space, and many facts can point in the same direction. The computer learns to put these directions together in the same spot. A small part of the computer acts like a filter that picks the right direction when asked. This filter uses a simple rule, like turning on a light if the direction is right. Because of this, they can remember many facts using much less memory. The researchers proved that this works for simple tasks, like matching subjects to attributes. They also showed it works for more complex tasks, like chains of questions. Finally, they tested it on new facts and found the computer could still answer correctly.

## For a technical reader
The paper investigates how transformer models store factual knowledge internally. It shows that instead of memorizing each fact as a separate weight, the model can encode facts as geometric directions in embedding space, allowing many facts to share the same parameters. A small multilayer perceptron (MLP) in the network acts as a selector, using simple ReLU gates to pick the appropriate direction based on the query. Theoretical analysis proves that this geometric scheme can achieve logarithmic memory growth and provides trade-offs between model depth and capacity for multi-step reasoning. Experiments confirm the theory, demonstrating that the learned selector transfers to new facts without retraining, suggesting a more efficient and scalable way to handle knowledge in large models.

## Problem
How do transformer language models memorize factual associations, and can they do so more efficiently than the linear scaling implied by associative memory models?

## Method
The authors analyze a geometric memorization scheme where subject embeddings linearly superpose attribute vectors and a small MLP acts as a relation-conditioned selector using ReLU gating. They prove that a logarithmic embedding dimension suffices for random bijections and extend the analysis to multi-hop relational queries, providing capacity-depth tradeoffs and matching lower bounds. Empirically, gradient descent discovers solutions matching the theoretical predictions and the MLP transfers zero-shot to new bijections.

## Results
The empirical results confirm the theoretical predictions, with gradient descent finding solutions that exhibit the expected geometric structure and the MLP transferring zero-shot to new bijections.

## Contributions
The paper introduces a geometric account of factual memorization, proving logarithmic embedding capacity and a capacity-depth tradeoff for multi-hop queries, and empirically validates the mechanism with zero-shot transfer.

## Limitations and assumptions
The analysis is limited to a simplified single-layer transformer and random bijection tasks; zero-shot transfer requires re-initializing subject embeddings.

## Research questions this paper is counted under

- [How does the capacity for storing factual associations scale with model size in neural networks?](../q/432.md)

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/155768)
