Hierarchical Associative Memory, Parallelized MLP-Mixer, and Symmetry Breaking

Ryo Karakida, Toshihiro Ota, Masato TakiarXiv 2024

Abstract

Transformers have established themselves as the leading neural network model in natural language processing and are increasingly foundational in various domains. In vision, the MLP-Mixer model has demonstrated competitive performance, suggesting that attention mechanisms might not be indispensable. Inspired by this, recent research has explored replacing attention modules with other mechanisms, including those described by MetaFormers. However, the theoretical framework for these models remains underdeveloped. This paper proposes a novel perspective by integrating Krotov's hierarchical associative memory with MetaFormers, enabling a comprehensive representation of the entire Transformer block, encompassing token-/channel-mixing modules, layer normalization, and skip connections, as a single Hopfield network. This approach yields a parallelized MLP-Mixer derived from a three-layer Hopfield network, which naturally incorporates symmetric token-/channel-mixing modules and layer normalization. Empirical studies reveal that symmetric interaction matrices in the model hinder performance in image recognition tasks. Introducing symmetry-breaking effects transitions the performance of the symmetric parallelized MLP-Mixer to that of the vanilla MLP-Mixer. This indicates that during standard training, weight matrices of the vanilla MLP-Mixer spontaneously acquire a symmetry-breaking configuration, enhancing their effectiveness. These findings offer insights into the intrinsic properties of Transformers and MLP-Mixers and their theoretical underpinnings, providing a robust framework for future model design and optimization.

Introduction

The rapid ascent of Vision Transformers (ViT) and MLP-Mixers has revolutionized computer vision, yet the theoretical 'why' behind their success remains partially obscured. While empirical results are robust, a unified framework that explains the interplay between Layer Normalization, skip connections, and mixing modules is still emerging. A significant theoretical tension exists between modern deep learning architectures and classical neural network theory. Classical Hopfield Networks, which serve as models for associative memory, typically require symmetric weight matrices ($W = W^T$) to ensure convergence to stable energy minima. In contrast, modern high-performing neural networks almost exclusively utilize asymmetric weights. This research, conducted by a team from AIST, CyberAgent, and Rikkyo University, bridges this gap by representing modern architectures as hierarchical Hopfield-style systems and investigating the role of symmetry breaking in their performance.

Theoretical Framework: The Energy MetaFormer

The authors introduce the Energy MetaFormer, a theoretical construct based on Krotov’s hierarchical associative memory. This model re-imagines the standard Transformer or MLP-Mixer block not as a sequence of discrete operations, but as the natural dynamics of a single physical system minimizing its energy.

The 3-Layer Hierarchical Model

Central to this approach is a three-layer Hopfield network. Unlike previous models that focused on isolated components, this framework places 'visible' neurons (representing the data) in a central layer, flanked by two 'hidden' layers. One hidden layer is dedicated to token-mixing (spatial relationships), while the other handles channel-mixing (feature relationships).

Hierarchical three-layer associative memory model with visible neurons ($x^v$) between token-mixing ($x^s$) and channel-mixing ($x^c$) layers.

Parallelization and Lagrangian Dynamics

In a standard MLP-Mixer, token and channel mixing occur sequentially. The Hopfield-derived model naturally suggests a parallel architecture where both mixing operations occur simultaneously. By applying specific 'Lagrangian' functions to describe the system's state, the researchers demonstrate that the resulting update rules precisely match the operations found in modern MetaFormer blocks, including Layer Normalization and skip connections.

Comparison between a standard Hopfield network (a) and the derived parallelized MLP-Mixer block (b).

Experimental Setup and Symmetry Breaking

To test the impact of weight symmetry, the authors evaluated three model variants:

  1. SymMixer: Enforces strict weight symmetry, adhering to classical Hopfield theory.
  2. ParaMixer: Utilizes parallel mixing with unconstrained, asymmetric weights.
  3. AsymMixer: A hybrid model where the degree of asymmetry is controlled via a penalty term ($\lambda$), allowing for a granular study of performance transitions.

These models were benchmarked on MNIST for visualization and CIFAR-10/100 for primary image classification tasks.

Key Insights and Results

The study yielded several critical findings regarding the nature of modern vision architectures:

  • Symmetry as a Constraint: In classical physics, symmetry is often an ideal. However, in deep learning, symmetric weights appear to create 'degenerate' energy landscapes—flat valleys rather than sharp pits. This prevents the model from effectively distinguishing between different features, thereby reducing its memorization capacity.
  • Spontaneous Symmetry Breaking: The researchers suggest that vanilla MLP-Mixers succeed because they naturally 'break' symmetry during training. Forcing symmetry (as in SymMixer) leads to a significant performance drop. For instance, on CIFAR-10, SymMixer achieved only 77.86% compared to ParaMixer's 89.80%. On CIFAR-100, the gap widened further (53.19% vs. 89.61% for the vanilla mixer).
  • Performance Parity: The asymmetric ParaMixer achieved performance nearly identical to the VanillaMixer, validating that parallel mixing is a theoretically sound and practically viable alternative to sequential mixing.
  • Iterative Refinement: As a Hopfield-derived system, the model allows for iterative processing of the same input. Interestingly, the asymmetric ParaMixer improves its classification accuracy with additional iterations ('thinking' longer), a property not shared by the standard sequential Mixer.

Conclusion

This work provides a robust theoretical foundation for MetaFormers by linking them to hierarchical associative memory. By demonstrating that the entire block can be viewed as a single energy-minimizing system, the authors offer a new lens through which to optimize future architectures. The discovery that symmetry breaking is essential for resolving energy landscape degeneracy explains why modern asymmetric networks outperform their symmetric classical counterparts in classification tasks. Future work will explore scaling these models to larger datasets like ImageNet and investigating whether symmetric constraints might remain beneficial for non-classification tasks like image denoising or retrieval.

Summary updated

BibTeX
@misc{karakida2024hierarchical,
  author = {Ryo Karakida and Toshihiro Ota and Masato Taki},
  title = {{Hierarchical Associative Memory, Parallelized MLP-Mixer, and Symmetry Breaking}},
  year = {2024},
  eprint = {2406.12220},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.12220},
}
Figure