arXiv:2608.21304math.NAAug 2026

Manuscript Offprint

arXiv:2608.21304

Basin-Preserving Discretizations of Modern Hopfield Retrieval Dynamics: Energy Cells, Dissipation, and the Attention Limit

Francisco R. Villatoro

Abstract

The retrieval dynamics of a modern Hopfield network is the gradient flow of a log-sum-exp energy, while the attention update is its exact difference-of-convex minimization step. We study which time discretizations preserve not only energy decay and equilibria but also basins of attraction. We introduce energy cells, connected components of sublevel sets containing one attractor and no other critical point. Our main theorem shows that every finite energy cell below the escape energy is contained simultaneously in the basin of the continuous flow, every relaxed attention map Ψθ=(1−θ) id+θ attention\Psi_{\theta}=(1-\theta)\,\mathrm{id}+\theta\,\mathrm{attention} for 0<θ<20<\theta<2, and implicit Euler throughout its uniqueness regime. A parameter-uniform unit-curvature majorant yields unconditional dissipation and a monotone interpolation of each discrete step. We also derive explicit local contraction bounds near well-separated patterns, with a certified optimal slight overrelaxation; characterize proximal tunneling and overshoot beyond the preservation regimes; compare first-order error constants; establish an order barrier for scalar reparametrizations of the relaxed family; construct a second-order scalar-auxiliary-variable scheme; and extend cell preservation to damped difference-of-convex iterations in Bregman geometry, including a certified overrelaxed window under bounded asymmetry. Nine numerical campaigns test the bounds and failure mechanisms. In two-dimensional basin experiments, all observed disagreements between continuous and discrete retrieval occur above the attractor-specific numerically inferred escape level.

Keywords: modern Hopfield networks; associative memory; attention; gradient flows; time discretization; basin preservation; difference-of-convex programming.

1 Introduction

A dense associative memory, or modern Hopfield network, stores patterns ξ1,ξ2,…,ξN∈Rd\xi_{1},\xi_{2},\dots,\xi_{N}\in\mathbb{R}^{d} and retrieves one of them from a corrupted query by descending the energy E(x)=12∥x∥2−β−1log⁡∑μeβξμ⊤xE(x)=\tfrac{1}{2}\|x\|^{2}-\beta^{-1}\log\sum_{\mu}e^{\beta\xi_{\mu}^{\top}x} (Krotov and Hopfield, 2016; Demircigil et al., 2017; Ramsauer et al., 2021). The exact difference-of-convex minimization step of this energy is x↦Xsoftmax⁡(βX⊤x)x\mapsto X\operatorname{softmax}(\beta X^{\top}x), the attention update of transformers, and the observation that attention is one such step (Ramsauer et al., 2021) has made these networks a shared object of the associative memory, optimization and deep learning communities. This paper looks at the same object from numerical analysis. Retrieval is the gradient flow x˙=−∇E(x)\dot{x}=-\nabla E(x); the iterative retrieval procedures studied here, including attention and its relaxed variants, admit time-discretization interpretations of that flow; and the question a memory poses to a discretization is not merely whether energy decays or equilibria survive, but whether the basins of attraction of the stored patterns, the sets of queries from which each memory is recovered, are preserved.

Our thesis is that a well-defined part of each basin is preserved exactly, by the flow and by an entire family of discretizations at once, and that this common core is described by an object as elementary as the energy itself. An energy cell of an attractor x∗x^{\ast} is the connected component of a sublevel set {E<c}\{E<c\} containing x∗x^{\ast}; below the escape energy c∗(x∗)c^{\ast}(x^{\ast}), the threshold up to which the component contains no critical point other than x∗x^{\ast}, the cell contains no critical point but x∗x^{\ast}. The central result, Theorem 4.5, states that every such cell is contained simultaneously in the basin of the flow, in the basin of every member of the relaxed attention family Ψθ(x)=(1−θ)x+θXsoftmax⁡(βX⊤x)\Psi_{\theta}(x)=(1-\theta)x+\theta X\operatorname{softmax}(\beta X^{\top}x) for all θ∈(0,2)\theta\in(0,2), and in the basin of the implicit Euler scheme throughout its uniqueness regime, with no condition on β\beta, on the patterns, or on the step size beyond these ranges. Energy cells are common certified basin cores of the flow and its structure-preserving discretizations. Everything else in the paper either builds toward this statement, delimits it, or measures it.

The mechanism is a single inequality. The energy is the difference of the convex quadratic 12∥x∥2\tfrac{1}{2}\|x\|^{2} and the convex log-sum-exp, and this structure yields a global quadratic majorant of curvature exactly one, E(y)≤E(x)+⟨∇E(x),y−x⟩+12∥y−x∥2E(y)\leq E(x)+\langle\nabla E(x),y-x\rangle+\tfrac{1}{2}\|y-x\|^{2}, uniformly in β\beta, NN and the pattern geometry (Lemma 2.5), even though the Hessian of EE is unbounded below as β\beta grows. Explicit Euler, semi-implicit convex splitting and exponential integration of the flow all collapse into the family Ψθ\Psi_{\theta} (Proposition 2.4), whose θ=1\theta=1 member is attention and whose θ→1\theta\to 1 limits are those of the semi-implicit schemes as their step tends to infinity; the majorant gives unconditional dissipation E(Ψθ(x))≤E(x)−12θ(2−θ)∥∇E(x)∥2E(\Psi_{\theta}(x))\leq E(x)-\tfrac{1}{2}\theta(2-\theta)\|\nabla E(x)\|^{2} on θ∈(0,2)\theta\in(0,2), exact up to the Bregman remainder of the log-sum-exp (Theorem 3.2), and, evaluated along the segment between consecutive iterates, a continuous interpolant of every discrete orbit along which the energy never rises (Lemma 4.3). Cells, being connected components of sublevel sets, cannot be left by such an interpolant, and precompactness together with the vanishing of the gradient identifies the unique limit; no analyticity or Łojasiewicz argument is needed inside a cell.

The rest of the paper delimits and tests this core. Locally, near a pattern well separated from its competitors, we give explicit contraction factors for the whole family, exponentially small at θ=1\theta=1 and minimized at a certified slight overrelaxation θ⋆=2/(2−ℓ)\theta_{\star}=2/(2-\ell), and unconditional contraction for the local branch of the implicit scheme, whose infinite-step limit is the deep-equilibrium formulation of retrieval rather than attention (Section 3.3); the certified cells are shown to lie between concentric balls with radii in the ratio (1−ℓ)−1/2(1-\ell)^{-1/2} (Corollary 4.6). Two propositions exhibit the complementary mechanisms by which preservation fails the global proximal selection of the implicit Euler relation, which we distinguish carefully from its local branch, tunnels out of non-global cells beyond an explicit step threshold, at which point local minimizers cease to be its fixed points, and the explicit Euler map turns the attractor into a repeller beyond θ≈2\theta\approx 2 (Section 4.3). On accuracy and cost, an order barrier shows that no reparametrization of the family reaches second order under a verifiable non-degeneracy hypothesis, the exponential member is singled out by an error constant carried entirely by the softmax curvature, a second-order scalar-auxiliary-variable scheme is constructed with an exact modified-energy law at the cost of one attention evaluation per step and benchmarked against the classical discrete-gradient methods that dissipate the true energy exactly, and a closed-form analysis of the warm-started Picard hierarchy shows that no allocation of inner iterations certifies a better per-evaluation factor than attention (Sections 5–6). A perspective section transfers the dissipation identity and the cell-preservation theorem to damped difference-of-convex iterations in Bregman geometry, where the overrelaxed window narrows to θ<1+1/κ\theta<1+1/\kappa under an asymmetry bound κ\kappa (Section 7). Nine numerical campaigns test each falsifiable prediction (Section 8); in particular, basins computed by high-precision integration of the flow, with critical points located by Newton iteration and continuous separatrices given by the stable manifolds of the saddles, disagree with the discrete basins at 12,72712{,}727 grid nodes across four values of θ\theta, and not one of them lies below the attractor-specific numerically inferred escape level used in that campaign.

The reader interested only in the core result may read Sections 2, 3.1 and 4, which are self-contained.

References (29)