Hierarchical Associative Memory

Dmitry KrotovarXiv 2021

Abstract

Modern Hopfield Networks, or Dense Associative Memories, possess desirable properties such as high storage capacity and biological plausibility. However, their application in machine learning has been limited by shallow architectures and dense connectivity. This paper introduces Hierarchical Associative Memory (HAM), a fully recurrent framework that supports an arbitrary number of layers, including locally connected convolutional layers. By utilizing a novel Lagrangian formulation, the model ensures the existence of an energy function that decreases along the dynamical trajectory of neuron activations. In HAM, memories are dynamically assembled from primitives in lower layers guided by rules in higher layers, with rich top-down feedback facilitating robust pattern completion and ambiguity resolution.

Introduction: Bridging Memory and Representation

Associative memories are systems capable of retrieving a stored pattern from a noisy or partial input. While Modern Hopfield Networks have significantly increased memory capacity, they typically rely on a single hidden layer and all-to-all connectivity. This lack of hierarchy prevents them from exploiting the spatial and structural regularities that deep learning models, such as Convolutional Neural Networks (CNNs), use so effectively.

Comparison of standard dense associative memory (A) and the proposed hierarchical architecture (B).

The HAM framework addresses these limitations by generalizing associative memory into a deep, multi-layered architecture. This allows for the representation of complex data through a hierarchy of features, moving beyond the "shallow" constraints of previous models.

Methodology

The core of the HAM framework is a mathematical derivation that ensures stability in deep recurrent networks.

Lagrangian Formulation and Collective Activations

Traditional energy-based models often start by defining neuron activation functions. In contrast, HAM defines the network through a "Lagrangian function." The activation of any given neuron is derived as the partial derivative of this Lagrangian. This approach is crucial because it allows the integration of "collective" activation functions, such as Softmax, which are standard in modern architectures like Transformers but historically difficult to reconcile with stable energy functions.

Recurrent flow in two-layer (A) and three-layer (B) models using softmax activations.

Symmetric Recurrence and Stability

For the network to settle into a stable memory state, it must possess a Lyapunov (energy) function. HAM achieves this through symmetric recurrence: the feedback weights from a higher layer to a lower layer are the transpose of the feedforward weights. This bidirectional flow allows the network to integrate bottom-up sensory information with top-down contextual constraints.

Hierarchical Time Scales

The model employs an "adiabatic limit" where higher-level neurons, representing abstract concepts, evolve on a faster time scale than lower-level feature neurons. This hierarchy of dynamics enables the system to rapidly converge on a global interpretation of input stimuli.

Key Insights: Memories as Assemblies

In a standard Hopfield network, a memory is a static pattern. In HAM, memories are dynamically assembled. Lower layers store "primitives"—simple features like edges or textures—while higher layers encode the "assembling rules" that combine these primitives into complex objects.

This structure enables top-down resolution of ambiguity. If a lower-layer feature detector is uncertain about a stimulus (e.g., distinguishing an eye from a button), feedback from a higher-level "face" neuron can bias the lower layer toward the interpretation that is consistent with the global context.

Results and Theoretical Contributions

  • Convergence Guarantee: The author provides a rigorous proof that for an arbitrary number of layers, a global energy function exists and its temporal derivative is non-positive ($dE/dt \leq 0$), ensuring the system always settles into a fixed point.
  • Generalization: The paper demonstrates that several existing associative memory models, including those linked to Transformer attention mechanisms, are special cases of the HAM framework.
  • Deep Learning Compatibility: The framework maps recurrent differential equations onto discrete tensor operations, such as conv2d and softmax, making it compatible with modern deep learning hardware and software.

Discussion and Future Directions

While HAM offers a powerful theoretical bridge between associative memory and deep learning, several challenges remain. The requirement for symmetric weights ($W_{IJ} = W_{JI}$) is biologically unrealistic and may constrain the model's representational flexibility. Additionally, while the paper outlines how to map these models to standard operations, the empirical performance and training dynamics of such deep recurrent systems on large-scale datasets remain to be fully explored. Finally, determining the exact memory capacity of these hierarchical versions is an ongoing analytical challenge.

Summary updated

BibTeX
@misc{krotov2021hierarchical,
  author = {Dmitry Krotov},
  title = {{Hierarchical Associative Memory}},
  year = {2021},
  eprint = {2107.06446},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.06446},
}
Figure