TL;DR
Tuning learning rates and initialization scales on giant neural networks is prohibitively expensive, so practitioners use "hyperparameter transfer" to find sweet spots on tiny models and port them to massive ones. Until now, we didn’t know how to do this for Dense Associative Memories (DenseAMs)—an exciting class of energy-based models—because their shared weights and steep activations break standard scaling rules. This paper cracks the code, offering an exact mathematical recipe (and one crucial architectural tweak) to scale up DenseAMs effortlessly.
What Problem Does This Paper Address?
If you train standard feed-forward networks or Transformers, frameworks like $\mu$P (Maximal Update Parameterization) let you tune hyperparameters on a toy model and mathematically scale them up to a massive model.
Meanwhile, Dense Associative Memories (DenseAMs)—modern, high-capacity generalizations of Hopfield networks—are emerging as powerful building blocks for architectures like Energy Transformers and energy-based GPTs. Instead of just passing data forward, DenseAMs evolve states over time to minimize an "energy landscape."
However, existing hyperparameter transfer rules completely fall apart on DenseAMs for three reasons:
- Tied weights: Defining a valid energy function requires sharing the exact same weight matrix ($W$ and $W^\top$) across operations.
- Growing outputs: Because weights are tied, input and output dimensions ($N$) match. Scaling the model often means scaling the input/output dimension itself—uncharted territory for standard transfer methods.
- Extreme activations: DenseAMs pack in massive amounts of memory by using rapidly peaking activations (like $\text{ReLU}^p$ for high $p$, or softmax), which easily trigger numerical explosions.
Methods
The authors study a foundational one-step DenseAM update rule trained on a denoising objective (adding Gaussian noise to inputs and training the network to recover the clean state).
Adapting $\mu$P-style dimensional analysis, they derive scaling rules for initialization scales ($s_1, s_2$) and learning rates ($\eta$) across two regimes: width-only scaling (growing hidden width $K$) and proportional scaling (growing input/output dimension $N$, width $K$, dataset size $P$, and batch size $B$ all at fixed ratios).
To make this work, they introduce two novel mechanisms:
- The "Balance" Desideratum: Alongside standard stability and maximality rules, they enforce that the updates coming from both occurrences of the tied weight matrix $W$ contribute at the exact same mathematical order of magnitude.
- Non-linearity Centering: For non-linear activations, they project out the layer-wise mean from both pre-activations and post-activations. Notably, they prove this structural tweak still preserves a valid underlying energy function.
Datasets
No new benchmarks are introduced; instead, the authors use controllable setups where input dimensions can be systematically scaled:
- Synthetic Isotropic Data: Standard Gaussian vectors $x \sim \mathcal{N}(0, I_N)$.
- Synthetic Anisotropic Data: Gaussian vectors with a power-law decaying covariance spectrum ($i^{-2/5}$), mimicking the uneven structure of natural data.
- Coarse-grained MNIST: Standard $28 \times 28$ MNIST digits ($N=784$) downsampled via local "plaquette" averaging to create a family of datasets across scales down to $N=25$.
Key Insights and Ideas
- Centering isn't optional—it's life support: In non-linear DenseAMs, uncentered activations build up coherent layer-wise means that blow up training as models grow. Subtracting the mean before and after the activation stabilizes training and unlocks clean hyperparameter transfer.
- Softmax breaks SGD, so bring Adam: When using softmax (or high-power $\text{ReLU}^p$), gradients from the two tied weight occurrences get amplified at wildly different scales, causing SGD to become numerically unstable. Because Adam normalizes updates entrywise (making it scale-invariant), it absorbs this imbalance and transfers smoothly—even up to $\text{ReLU}^{10}$.
- Complete dynamical collapse: In the proportional scaling regime, you don't just get the same optimal learning rate across model sizes—the entire training loss trajectory and internal hidden-layer statistics collapse onto a single universal curve.
- Batch size must scale too: In proportional scaling, keeping the ratio of batch size to dataset size ($\beta = B/P$) constant is strictly necessary for transfer.
Key Results
Using their derived scaling prescriptions (e.g., setting $s_1 = 1/\sqrt{N}$, $s_2 = 1/\sqrt{K}$, and scaling SGD weight learning rates as $\eta_0 K$ in the proportional regime), the authors demonstrate:
- Zero-shot LR transfer across 32x scale: Across linear, ReLU, and softmax DenseAMs, the optimal effective learning rate $\eta_0$ remains invariant as hidden width $K$ scales from $64$ to $2048$ (and $N$ from $21$ to $683$).
- Real-world data compatibility: Even though the math assumes idealized isotropic Gaussians, the exact same scaling prescriptions cleanly align optimal learning rates on anisotropic synthetic data and multi-resolution MNIST ($N=25$ up to $N=784$).
Limitations and Future Work
The authors note that their work focuses on a single-step update of a shallow DenseAM, leaving multi-step energy descent and deeper, modern architectures (like Energy Transformers) for future study. Furthermore, while they use initialization-time calculations to guess the right scaling laws, a complete analytical theory of infinite-scale training dynamics over time—and how these parameterizations affect memory storage capacity and the geometry of the learned energy landscape—remains wide open.
Summary updated