---
title: 'HRECM: Stability Approach for OIM Training'
url: https://www.emergentmind.com/topics/hamiltonian-regularized-eigenvalue-contrastive-method-hrecm
type: topic
---

# HRECM: Stability Approach for OIM Training

Searching arXiv for the specified paper and closely related work on oscillator Ising machines and associative memory.
Hamiltonian-Regularized Eigenvalue Contrastive Method (HRECM) is a training method for oscillator Ising machines (OIMs) introduced in “Training oscillator Ising machines to assign the dynamic stability of their equilibrium points” [2507.14386]. It is designed for Hopfield-like associative memory in a setting where all binary $0/\pi$ equilibrium points (EPs) already exist by construction, and learning therefore focuses on assigning their dynamic stability rather than ensuring their existence. The method exploits a connection between the largest eigenvalue of a state-dependent matrix $D(s)$, which governs the local stability of a binary EP, and the Ising Hamiltonian $H(s)$. On that basis, HRECM combines an eigenvalue contrastive objective with a Hamiltonian-based regularizer, using Hamiltonian Gibbs sampling to identify difficult negative states and to approximate gradients for coupling training [2507.14386].

## 1. Conceptual setting and motivation

HRECM arises in the context of OIMs, which are networks of coupled phase oscillators whose binary phase configurations $\theta_i \in \{0,\pi\}$ encode Ising spins $s_i \in \{+1,-1\}$ through the correspondence
\[
s_i=\begin{cases}
+1,& \theta_i=0\\
-1,& \theta_i=\pi.
\end{cases}
\]
In this representation, every $0/\pi$ configuration is an EP of the OIM dynamics [2507.14386].

The key motivation is the distinction between structural stability and dynamic stability. In the formulation considered for OIMs, all $0/\pi$ EPs are structurally stable for any symmetric coupling matrix $J$ with $J_{ii}=0$, meaning that training does not create or destroy those EPs. Instead, the coupling matrix changes only their dynamic stability. This differs from classical Hopfield networks, where weight design must jointly manage both EP existence and EP stability, producing a capacity–stability trade-off as the number of stored patterns grows. In OIMs, the existence–stability competition is mitigated because the existence of all $0/\pi$ EPs is guaranteed by structure, so training can focus solely on spectral criteria for dynamic stability [2507.14386].

This framing suggests that OIM-based associative memory can be cast as a stability assignment problem over a fixed binary state space. HRECM operationalizes that perspective by learning couplings that make designated binary EPs asymptotically stable and non-designated EPs unstable.

## 2. Oscillator Ising machine formulation

The OIM dynamics are given by
\[
\dot \theta_{i} = -K\sum_{j=1}^N J_{ij}\sin(\theta_{i}-\theta_{j})-K_{\rm s}\sin(2\theta_{i}),
\]
where $N$ is the number of oscillators, $K, K_{\rm s}>0$ are scalar parameters, and $J \in \mathbb{R}^{N\times N}$ is symmetric with zero diagonal [2507.14386].

A Lyapunov-like energy is defined as
\[
E(\theta)=-K\sum_{i=1}^N\sum_{j=1}^N J_{ij}\cos(\theta_{i}-\theta_{j})-K_{\rm s}\sum_{i=1}^N\cos(2\theta_{i}),
\]
and this energy is nonincreasing along OIM trajectories. For binary phase states $\theta \in \{0,\pi\}^N$, the energy reduces, up to the constant $-N K_{\rm s}$ and scaling by $2K$, to the Ising Hamiltonian
\[
H(s) = -\sum_{i<j} J_{ij} s_{i}s_{j}.
\]
The binary encoding satisfies $s_i s_j = \cos(\theta_i-\theta_j)$ on $0/\pi$ states [2507.14386].

The paper notes that every $\theta^\star \in \{0,\pi\}^N$ is a structurally stable EP. It also notes the existence of $\pm \pi/2$ EPs, but those are dynamically unstable and are not the focus of the method. Within the associative-memory interpretation, the relevant state space is therefore the family of binary $0/\pi$ EPs, each corresponding to an Ising spin configuration [2507.14386].

## 3. Stability criterion and its relation to Hamiltonian energy

For a binary EP $\theta^\star$, equivalently a spin vector $s \in \{+1,-1\}^N$, the linearization yields a symmetric Jacobian
\[
A(\theta^\star)=K D(\theta^\star)-2K_{\rm s} I_N,
\]
where $D(\theta^\star)=D(s)$ has entries
\[
D_{ii}(s) = -\sum_{j=1}^N J_{ij} s_i s_j,\qquad
D_{ij}(s) = J_{ij} s_i s_j \quad (i\ne j).
\]
Because $A(\theta^\star)$ is symmetric, asymptotic stability is equivalent to negative definiteness of $A(\theta^\star)$ [2507.14386].

Let $\lambda_N(D(s))$ denote the largest eigenvalue of $D(s)$. The asymptotic stability condition is
\[
A(\theta^\star) \prec 0
\quad\Longleftrightarrow\quad
\frac{K_{\rm s}}{K} > \frac{\lambda_N(D(\theta^\star))}{2}.
\]
This makes $\lambda_N(D(s))$ the central quantity for stability assignment: smaller values imply that stability can be obtained for a smaller ratio $K_{\rm s}/K$ [2507.14386].

For a desired set of patterns $S_{\rm d}=\{s_d^\star\}_{d=1}^m$ within the full binary state set $S$, the paper gives a “perfect associative memory” separation condition:
\[
\max_{s^\star_{d} \in S_{\rm d}} \lambda_N(D(s^\star_d))
<
\min_{s\in S \setminus S_{\rm d}} \lambda_N(D(s)).
\]
If this strict inequality holds, one can choose $K_{\rm s}/K$ between the two sides so that all desired EPs are stable and all other binary EPs are unstable [2507.14386].

A central theoretical result, stated as Theorem 1, links $\lambda_N(D(s))$ to the Ising Hamiltonian:
\[
\max\left\{0,\frac{2H(s)}{N}\right\}
\le \lambda_N\!\bigl(D(s)\bigr)
\le
\frac{2+2\sqrt{(\kappa N-1)(N-1)}}{N}\,H(s) + d,
\]
with
\[
\kappa = \max_{s \in S}\left\{\frac{\mathrm{tr}\bigl(\hat D(s)^2\bigr)}{\mathrm{tr}^2\bigl(\hat D(s)\bigr)}\right\},
\quad
d = c\sqrt{(\kappa N-1)(N-1)},
\quad
\hat D(s) = D(s)+cI_N,
\]
and $c$ chosen such that $c > -\tfrac{2H(s)}{N}$ for all $s \in S$ [2507.14386].

The paper interprets these bounds as indicating that $\lambda_N(D(s))$ is approximately, or roughly linearly, correlated with $H(s)$. States with smaller Hamiltonian tend to have smaller $\lambda_N(D(s))$, and thus tend to be more stable for fixed $K_{\rm s}/K$. This relation is the basis for Hamiltonian regularization and for the use of Hamiltonian Gibbs sampling to search for low-eigenvalue negative states.

## 4. HRECM objective and optimization mechanics

The goal of HRECM is to learn a symmetric zero-diagonal coupling matrix $J$ such that desired EPs have small $\lambda_N(D(s))$ and non-desired EPs have large $\lambda_N(D(s))$ [2507.14386].

The objective is
\[
\max_{J_{ij}} \; L
\;=\;
\Bigl[\min_{s\in S\setminus S_{\mathrm{d}}} \lambda_N\bigl(D(s)\bigr)\Bigr]
\;-\;
\Bigl[\max_{s^\star_d\in S_{\mathrm{d}}} \lambda_N\bigl(D(s^\star_d)\bigr)\Bigr]
\;+\;
\alpha \, P(S_{\mathrm d}),
\]
where $\alpha>0$ is a regularization factor and
\[
P(S_{\mathrm d}) \;=\; \sum_{s^\star_d\in S_{\mathrm d}} \frac{\exp\{-H(s^\star_d)\}}{Z},
\qquad
Z = \sum_{s\in S} \exp\{-H(s)\}.
\]
The first two terms form the eigenvalue contrastive component, enlarging the gap between the smallest negative-state eigenvalue and the largest desired-state eigenvalue. The third term is a Hamiltonian regularizer that biases the model distribution toward the desired patterns [2507.14386].

The paper explicitly notes that HRECM does not use a hinge or margin-based loss; it maximizes the contrastive eigenvalue gap directly. It also notes that the formulation imposes symmetry and zero-diagonal structure on $J$, and does not add explicit norm penalties [2507.14386].

For a fixed binary state $s$, the largest-eigenvalue function $\lambda_N(D(s))$ is locally Lipschitz and may be nondifferentiable when the top eigenvalue has multiplicity. The method therefore adopts the Clarke generalized gradient and uses a rank-1 selection based on a top eigenvector $v(s)$:
\[
\frac{\partial \lambda_N\bigl(D(s)\bigr)}{\partial J_{ij}}
\;\approx\;
v(s)^{\!\top}\,\frac{\partial D(s)}{\partial J_{ij}}\,v(s).
\]
Using the structure of $D(s)$, this becomes
\[
v(s)^{\!\top}\,\frac{\partial D(s)}{\partial J_{ij}}\,v(s)
\;=\;
-\bigl(v_i - v_j\bigr)^2\, s_i s_j.
\]
This expression gives a closed-form surrogate gradient for the eigenvalue term [2507.14386].

Let
- $s^{\min} \in \arg\min_{s\in S\setminus S_d} \lambda_N(D(s))$,
- $s^{\max} \in \arg\max_{s\in S_d} \lambda_N(D(s))$,

with associated normalized top eigenvectors $v^{\min}$ and $v^{\max}$. The gradient surrogate for the full objective is
\[
\Delta J_{ij}
\;=\;
\frac{\partial L}{\partial J_{ij}}
\;\approx\;
(v^{\min})^{\!\top}\frac{\partial D(s^{\min})}{\partial J_{ij}}v^{\min}
\;-\;
(v^{\max})^{\!\top}\frac{\partial D(s^{\max})}{\partial J_{ij}}v^{\max}
\;+\;
\alpha\,\frac{\partial P(S_d)}{\partial J_{ij}},
\]
which yields
\[
\Delta J_{ij}
\;\approx\;
-\bigl(v^{\min}_i - v^{\min}_j\bigr)^2\, s^{\min}_i s^{\min}_j
\;+\;
\bigl(v^{\max}_i - v^{\max}_j\bigr)^2\, s^{\max}_i s^{\max}_j
\;+\;
\alpha\,\frac{\partial P(S_d)}{\partial J_{ij}}.
\]
For the regularizer, the paper uses the approximation
\[
\frac{\partial P(S_d)}{\partial J_{ij}}
\;\approx\;
\left< s_i s_j \right>_{S_{\rm d}}
\;-\;
\left< s_i s_j \right>_{S^-},
\]
which is the standard Boltzmann machine “data minus model” gradient form [2507.14386].

## 5. Sampling strategy and training procedure

Exact computation of
\[
s^{\min}=\arg\min_{s\in S\setminus S_d}\lambda_N(D(s))
\]
is infeasible for large $N$, since it would require exhaustive search over exponentially many non-desired binary states. HRECM addresses this by using Hamiltonian Gibbs sampling. Because Theorem 1 suggests that low-$H(s)$ states tend to have low $\lambda_N(D(s))$, the method samples candidate negatives from the model distribution $p(s)\propto \exp\{-H(s)\}$ and selects
\[
\hat s^{\min} \;=\; \arg\min_{s\in S^-} \lambda_N\bigl(D(s)\bigr),
\]
where $S^-=\{s_k^-\}_{k=1}^n$ is a sampled set of negatives [2507.14386].

The Gibbs update used for sampling is
\[
p(s_k=+1) = \frac{1}{1+\exp\{-2\sum_{j}J_{kj}s_j\}},
\]
which is the standard Ising or Boltzmann single-spin update under
\[
H(s) = -\sum_{i<j} J_{ij} s_i s_j.
\]
The paper uses these model samples for two purposes: to locate hard negative states with small $\lambda_N(D(s))$, and to estimate the model expectation term in the Hamiltonian regularizer gradient [2507.14386].

Using the sampled minimizer $\hat s^{\min}$ and its associated eigenvector $\hat v^{\min}$, the approximate full gradient becomes
\[
\Delta J_{ij}
\;\approx\;
-\bigl(\hat v^{\min}_i - \hat v^{\min}_j\bigr)^2\, \hat s^{\min}_i \hat s^{\min}_j
\;+\;
\bigl(v^{\max}_i - v^{\max}_j\bigr)^2\, s^{\max}_i s^{\max}_j
\;+\;
\alpha\Bigl(\left< s_i s_j \right>_{S_{\rm d}} - \left< s_i s_j \right>_{S^-}\Bigr).
\]
The training update is then
\[
J_{ij}\leftarrow J_{ij} + \epsilon\,\Delta J_{ij},
\]
with symmetry and zero diagonal enforced after each step [2507.14386].

Algorithm 1 in the paper consists of the following stages: choosing $\alpha$ and the learning rate $\epsilon$, specifying desired patterns $\{s_d^\star\}_{d=1}^m$, and initializing a symmetric zero-diagonal $J$; drawing $n$ Gibbs samples; selecting $\hat s^{\min}$ from the sampled negatives and $s^{\max}$ from the desired set according to largest-eigenvalue criteria; computing the three gradient terms; updating $J$; and iterating until a stopping criterion is met [2507.14386].

The computational profile is dominated by sampling and eigenpair estimation. Each Gibbs sweep has $O(N^2)$ cost under all-to-all couplings, and the largest eigenvalue and eigenvector for sampled $D(s)$ matrices can be computed with power iteration or Lanczos, at roughly $O(n\cdot N^2 \cdot T_{\rm pow})$ for the negatives and $O(m\cdot N^2 \cdot T_{\rm pow})$ for the desired patterns. The tractability argument depends on using $n \ll 2^N$ rather than exhaustive enumeration [2507.14386].

## 6. Stability assignment for associative memory

The trained coupling matrix is not itself the final memory mechanism. Rather, HRECM is used to shape the spectrum of $D(s)$ so that a suitable ratio
\[
\gamma = \frac{K_{\rm s}}{K}
\]
can be chosen after training. The required condition is
\[
\max_{s^\star_{d} \in S_{\rm d}} \lambda_N(D(s^\star_d)) \;<\; 2\gamma \;<\; \min_{s\in S \setminus S_{\rm d}} \lambda_N(D(s)).
\]
When such a $\gamma$ exists, all desired EPs are asymptotically stable and all other $0/\pi$ EPs are unstable [2507.14386].

This construction yields a Hopfield-like associative memory in which the stored patterns are precisely those desired binary EPs assigned stability by the learned couplings. The paper states that larger stability margins, meaning larger spectral gaps between the two sides of the inequality, typically increase basins of attraction and retrieval robustness. This suggests that HRECM is not only a binary classifier over EPs but also a mechanism for shaping attractor geometry through spectral separation [2507.14386].

A common misconception in this setting is that training must encode desired patterns by ensuring that those states are equilibrium points. In the OIM formulation used here, that is not the case: all binary $0/\pi$ states are EPs already. What training changes is which of those EPs are stable. This is the principal conceptual distinction between HRECM-trained OIMs and conventional Hopfield constructions [2507.14386].

## 7. Empirical results, limitations, and related implications

The paper reports three numerical experiments. In the first, with $N=20$ and $m=15$ desired patterns, training uses $\alpha = 0.8$, $\epsilon = 0.01$, $n = 500$ samples per iteration, and iteration counts $T \in \{1, 100, 300, 2000\}$. Over training, the $\lambda_N(D(s))$ values for desired patterns monotonically move down and eventually become the smallest 15 among all $2^N$ binary EPs, producing a clear separation in the $(H(s), \lambda_N(D(s)))$ plane. This enables selection of $K_{\rm s}/K$ so that desired EPs are stable and all others unstable [2507.14386].

The second experiment is a regularization ablation over $N \in \{10,15,20,25\}$ and $m=5,\ldots,30\}$, comparing $\alpha=1$ against $\alpha=0$ with $\epsilon=0.01$, $T=5000$, and $n=500$. The metric is the spurious rate
\[
R_{\rm s}=\frac{a}{2^{N-1}},
\]
where $a$ is the number of spurious $0/\pi$ EPs with $\lambda_N$ smaller than at least one desired EP, counting $\theta$ and $\theta+\pi\cdot \mathbf{1}$ as one. The reported result is that regularization with $\alpha=1$ yields equal or lower $R_s$ than $\alpha=0$, with the advantage marked when $m>N$ [2507.14386].

The third experiment studies scaling for $N=20,\ldots,70$ and $m=15,\ldots,70$, again with $\alpha=1$, $\epsilon=0.01$, $T=5000$, and $n=500$. Because exhaustive enumeration is impractical, the paper estimates
\[
R_{\rm s}=\frac{a}{b},
\]
where $b$ is the number of distinct binary EPs obtained from 20,000 Hamiltonian Gibbs samples after training, and $a$ counts sampled spurious EPs with $\lambda_N$ below at least one desired EP. For fixed $N$, $R_s$ increases with $m$; for fixed $m$, $R_s$ increases as $N$ decreases. The paper interprets this as consistent with the task becoming harder when relative load is higher [2507.14386].

Several limitations are identified. Scalability is constrained because each training iteration requires eigenpair computations and, when many negatives are sampled, eigensolvers dominate the cost. The eigenvalue–Hamiltonian link is inequality-based and qualitative rather than exact, so Gibbs sampling may fail to recover the true worst negative states, even though Theorem 1 supports the heuristic that lower $H(s)$ tends to correspond to lower $\lambda_N(D(s))$. The method is also dynamics-specific: it relies on the OIM sinusoidal coupling model and its particular Jacobian structure, so extension to other oscillator models would require a new stability–energy analysis [2507.14386].

The paper also identifies possible improvements, including faster eigensolvers such as Lanczos, minibatched or parallel sampling, adaptive $\alpha$, and explicit spectral margins. These are not part of HRECM as presented, but they indicate plausible directions for extending the method within the broader program of training oscillator-based associative memories [2507.14386].

Source: https://www.emergentmind.com/topics/hamiltonian-regularized-eigenvalue-contrastive-method-hrecm