The Capacity of Modern Hopfield Networks under the Data Manifold Hypothesis

Beatrice Achilli, Luca Ambrogioni, Carlo Lucibello, Marc Mézard, Enrico Ventura · DOI

Abstract

We generalize the computation of the capacity of exponential Hopfield model from Lucibello and Mézard (2024) to more generic pattern ensembles, including binary patterns and patterns generated from a hidden manifold model.

Introduction

Modern Hopfield Networks (MHNs), also known as dense associative memories, have gained significant attention due to their exponential storage capacity and mathematical links to Transformer attention mechanisms and generative Diffusion Models. However, traditional theoretical analyses of their storage capacity often rely on the assumption that stored patterns are unstructured, rotationally invariant noise. In reality, data typically adheres to the Data Manifold Hypothesis, residing on lower-dimensional surfaces within high-dimensional spaces. This paper addresses this gap by calculating the exact retrieval capacity of MHNs for structured data, specifically discrete binary patterns and patterns generated via a Hidden Manifold Model (HMM).

Methodology

The research maps the associative memory retrieval problem to the Random Energy Model (REM) from statistical physics. In this framework, each stored pattern is treated as a randomly sampled energy level. The capacity threshold—the limit at which the network can no longer reliably retrieve a specific memory—is determined using a signal-to-noise argument. For complex distributions like those in the HMM, the authors employ the replica method with a Replica Symmetric (RS) ansatz to derive the thermodynamic limits and saddle-point equations defining the network's phase transitions.

Retrieval Capacity for Binary Patterns

One of the primary contributions is the derivation of the exact phase diagram for MHNs storing binary patterns. The analysis identifies the critical capacity threshold $\alpha_1(\lambda)$ as a function of the inverse temperature parameter $\lambda$, which dictates the sharpness of the retrieval mechanism.

Phase diagram for binary patterns showing the retrieval threshold $\alpha_1$ as a function of inverse temperature $\lambda$.

As shown in the phase diagram, the retrieval region (green) is bounded by the $\alpha_1$ curve. Above this threshold (red), the network fails to isolate specific memories due to interference from noise patterns.

The Impact of Latent Dimensionality

Applying the Hidden Manifold Model allows for an investigation into how the underlying dimensionality of data affects storage. Counterintuitively, the results show that a lower latent dimension ($D$) actually decreases the network's capacity to retrieve individual patterns. While the expected distance between patterns remains constant, the structural constraints of the manifold increase interference between neighboring points.

Retrieval capacity $\alpha_1$ for Hidden Manifold Model patterns across different activations (ReLU, identity, tanh) and varying latent dimensions $\alpha_D$.

The capacity curves demonstrate a saturation effect: beyond a certain $\lambda$, increasing the sharpness of the attention mechanism does not improve capacity because noise patterns with large norms eventually dominate the signal. The choice of activation function (ReLU, identity, or tanh) also significantly influences the absolute capacity limits.

From Memorization to Generalization

The study further proves that as the number of stored patterns on a linear manifold approaches infinity, the MHN transitions from a lookup table to a generalization engine. In this limit, the entire manifold becomes an attractor. For a linear manifold at $\lambda=1$, the dynamics simplify to a projection onto the data subspace in a single step, effectively learning the underlying structure of the data rather than just individual points.

Discussion and Future Work

While this work provides a rigorous foundation for understanding MHN capacity under structured data, it focuses on the single-pattern retrieval threshold and utilizes the Replica Symmetric ansatz. Future research may explore "replica symmetry breaking" in more complex landscapes and investigate the stability of pattern mixtures. Additionally, the formal equivalence between MHNs and Diffusion Models suggests that these insights could deeply inform the design of generative models that leverage data manifold structures.

Summary updated

BibTeX
@inproceedings{achilli2025capacity,
  author = {Beatrice Achilli and Luca Ambrogioni and Carlo Lucibello and Marc Mézard and Enrico Ventura},
  title = {{The Capacity of Modern Hopfield Networks under the Data Manifold Hypothesis}},
  booktitle = {NFAM @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=OBQwZaO4pt},
}
Figure