English

MapFormer: Self-Supervised Learning of Cognitive Maps with Input-Dependent Positional Embeddings

Machine Learning 2026-05-12 v4 Computation and Language

Abstract

A cognitive map is an internal model which encodes the abstract relationships among entities in the world, giving humans and animals the flexibility to adapt to new situations, with a strong out-of-distribution (OOD) generalization that current AI systems still do not possess. To bridge this gap, we introduce MapFormers\textit{MapFormers}, new Transformer-based architectures, which can learn cognitive maps from observational data and perform path-integration without supervision. Cognitive maps are learned in the model by disentangling structural relationships in the inputs from their specific content, a property that can be achieved by updating position encodings with input-dependent matrices, built as exponentials of learned combinations of Lie-algebra generators. We developed two variants of MapFormers\textit{MapFormers} that unify absolute and relative positional encoding to model episodic (EM) and working memory (WM), respectively. We tested MapFormers\textit{MapFormers} on several formal tasks targeting distinct cognitive capacities, including gating, 2D navigation and nested hierarchies (Dyck Languages). Our results demonstrate that MapFormers\textit{MapFormers} significantly outperform current AI architectures, achieving near-perfect OOD generalization where standard models fail. Furthermore, we show that MapFormers\textit{MapFormers} are scalable; evaluations on naturalistic data yield perplexity improvements over baselines, suggesting that these principles extend to large-scale, real-world domains. These results are obtained through efficient parallel computation on commutative maps, though our models can also learn non-commutative cognitive maps via sequential path-integration. Overall, these results suggest that input-dependent matrices provide a critical structural bias, by disentangling abstract relations from content in order to drive robust OOD generalization.

Keywords

Cite

@article{arxiv.2511.19279,
  title  = {MapFormer: Self-Supervised Learning of Cognitive Maps with Input-Dependent Positional Embeddings},
  author = {Victor Rambaud and Salvador Mascarenhas and Yair Lakretz},
  journal= {arXiv preprint arXiv:2511.19279},
  year   = {2026}
}

Comments

19 pages (29 with appendix), 8 figures

R2 v1 2026-07-01T07:52:26.633Z