Hopfield-Fenchel-Young Networks: A Unified Framework for Associative Memory Retrieval

Saul José Rodrigues dos Santos, Vlad Niculae, Daniel C. McNamee, André F. T. MartinsarXiv 2024 · DOI

Introduction

Associative memory models, exemplified by the classic Hopfield Network, are designed to retrieve stored patterns (memories) when presented with noisy or incomplete queries. While "Modern" Hopfield Networks (MHNs) significantly increased storage capacity and established a theoretical link to Transformer attention mechanisms, they introduced a persistent challenge: they typically only provide an approximation of stored patterns. Achieving exact retrieval often requires extreme temperature tuning, which can lead to numerical instability or "metastable states" where multiple memories blur together.

This paper introduces Hopfield-Fenchel-Young (HFY) networks, a unified framework that generalizes associative memory models by expressing their energy functions through Fenchel-Young losses. By leveraging sparse and structured transformations, the authors provide theoretical guarantees for exact pattern retrieval and a principled interpretation for common architectural operations like Layer Normalization.

The HFY Framework

The core innovation of this work is the HFY Energy Function, defined as:

$$E(q) = -L_\Omega(Xq, u) + L_\Psi(X^\top u, q) + \text{const}$$

where $L_\Omega$ and $L_\Psi$ are Fenchel-Young losses. This formulation decomposes the energy into a concave component, which drives the query toward a specific memory, and a convex component that acts as a regularizer or post-transformation. This framework allows for the replacement of the standard softmax with alternative transformations like Tsallis $\alpha$-entmax or $\gamma$-normmax.

Sparse and Structured Retrieval

By utilizing sparse transformations, the model can effectively "zero out" irrelevant memories. This creates a separation margin, allowing the network to retrieve a pattern exactly in a single iteration if the patterns are sufficiently distinct. Furthermore, the framework extends to Structured Hopfield Networks using SparseMAP, enabling the retrieval of complex associations such as the top-$k$ most relevant patterns or contiguous sequences.

Figure 2: Comparison of retrieval behaviors using different transformations within the HFY framework. While entmax and normmax focus on single exact patterns, k-subsets and sequential k-subsets allow for structured memory retrieval.

Key Insights and Theoretical Contributions

  • The Sparsity-Margin Link: The authors demonstrate that sparsity is mathematically tied to the existence of a margin. If patterns are separated relative to this margin, retrieval error becomes exactly zero, solving the approximation issue of standard MHNs.
  • Principled Normalization: The framework proves that common post-processing steps, such as Layer Normalization or $\ell_2$-normalization, are the natural result of minimizing specific HFY energy terms. This provides a rigorous theoretical foundation for their empirical success in attention layers.
  • Storage Capacity: The authors prove that HFY networks maintain exponential storage capacity even under the strict requirement of exact retrieval, ensuring they remain competitive with dense MHNs.

Experimental Validation

The framework was validated across several domains to demonstrate its versatility:

  1. Image Retrieval: On MNIST and CIFAR10, HFY networks achieved zero retrieval error under conditions where standard MHNs retained residual error.
  2. Multiple Instance Learning (MIL): Using SparseMAP for $k$-subsets retrieval outperformed standard softmax-based pooling in bag-level classification tasks (e.g., Elephant, Fox, Tiger datasets), particularly when the number of positive instances was known.
  3. Text Rationalization: In sentiment analysis tasks (SST, IMDB), the sequential structured variant produced "rationales" (text highlights) that were more contiguous and aligned better with human annotations than traditional sparse models.

Conclusion

Hopfield-Fenchel-Young networks provide a powerful, unified lens through which to view associative memory. By bridging convex analysis and neural architectures, the framework enables exact retrieval, structured outputs, and a deeper understanding of normalization techniques. While structured transformations like SparseMAP introduce additional computational steps, the resulting precision and interpretability offer a significant advancement for memory-augmented neural networks.

Summary updated

BibTeX
@misc{santos2024hopfield,
  author = {Saul José Rodrigues dos Santos and Vlad Niculae and Daniel C. McNamee and André F. T. Martins},
  title = {{Hopfield-Fenchel-Young Networks: A Unified Framework for Associative Memory Retrieval}},
  year = {2024},
  eprint = {2411.08590},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.08590},
}
Figure