Network, margins and energy

How does one update act on a spin pattern?

1. Threshold update and signed margin

$$H_i(s)=\sum_{j\ne i}J_{ij}s_j+h_i,\qquad f_{J,h}:\{-1,1\}^n\to\{-1,1\}^n,$$

$$f_{J,h}(s)_i=\sigma(H_i(s)),\qquad\sigma(t)=\begin{cases}+1,&t>0,\\-1,&t\le0.\end{cases}$$

The tie rule returns −1; strict storage always excludes zero fields.

Recover an image through repeated updates

An 8×8 digit has 64 pixels, hence 64 neurons and a 64×64 weight matrix.

$$a\in\{0,\ldots,16\}^{8\times8},\qquad \xi_{8r+c+1}=2\mathbf1\{a_{r,c}\ge8\}-1\quad(0\le r,c<8).$$

The public UCI digits test set contains 1,797 images. This example uses the first image of each digit; the digit label only selects the picture. [UCI digits / scikit-learn, load_digits, dataset description]

Which network is used?

For the selected spin prototype \(\xi\), choose

$$J_{ij}=\begin{cases}\xi_i\xi_j,&i\ne j,\\0,&i=j,\end{cases}\qquad h=0,\qquad\xi\in\{-1,1\}^{64}.$$

$$H_i(\xi)=63\xi_i,\qquad\xi_iH_i(\xi)=63>0.$$

This one-memory outer-product example explains the update rule; the capacity experiment samples uniform random patterns. [Hopfield (1982), outer-product rule, Eq. (2), p. 2555]

(a) Source

Starting spin pattern s⁽⁰⁾

(b) After 0 updates

(c) Goal

Stored digit ξ

Click source pixels to change the starting state. Blue outlines the last updated neuron; Play runs 20 updates per second.

$$\begin{aligned}s^{(t+1)}&=U_{i_t}(s^{(t)}),\\i_t&=1+(t\bmod64).\end{aligned}$$

Weights and last update

Couplings J (64×64)

Rows: receiving neuron i. Columns: sending neuron j.
Blue: +1; red: −1; white diagonal: 0.

Neuron’s arithmetic

Figure 1. The middle image evolves one neuron at a time; the source and goal stay fixed.

· Signed local margin

$$g_i:\{-1,1\}^n\to\mathbb R,\qquad g_i(s)=s_iH_i(s),$$

$$g_i(s)=\begin{cases}H_i(s),&s_i=+1,\\-H_i(s),&s_i=-1.\end{cases}$$

Positive common parameter scaling preserves the update and scales the margins.

2. Why symmetry produces an energy

$$E_{J,h}(s)=-\frac12s^\top Js-h^\top s,\qquad \operatorname{flip}_i(s)=s-2s_ie_i.$$

· A one-spin energy gap equals twice the local margin Proved here

$$E(\operatorname{flip}_i(s))-E(s)=2s_iH_i(s)=2g_i(s).$$

Proof

Zero diagonal removes the quadratic self-term; symmetry collects the two incident edge contributions. Thus $$\Delta_i E=-(-2s_i)\left(\sum_{j\ne i}J_{ij}s_j+h_i\right)=2g_i(s).$$

$$\begin{aligned}&g_i(s)>0\quad\forall s\in D,\ i\in[n]\\&\iff E(s)<E(\operatorname{flip}_i(s))\quad\forall s\in D,\ i\in[n].\end{aligned}$$

2.1. A stored pattern stays fixed under every update order

Q1. If a pattern is already stored, can choosing a different neuron to update change it?

A single-neuron update changes only coordinate i; all other coordinates keep their current values:

$$U_i(s)=s+\bigl(\sigma(H_i(s))-s_i\bigr)e_i,$$

Here eᵢ is the ith coordinate vector, and f updates all coordinates simultaneously from the same input.

$$f_{J,h}(s)=s\iff U_i(s)=s\quad\forall i,$$

$$f_{J,h}(s)=s\implies U_{i_t}\circ\cdots\circ U_{i_1}(s)=s\quad\forall t\ge1,\ (i_1,\ldots,i_t)\in[n]^t.$$

Every update leaves the stored pattern unchanged, so any finite sequence does too, even with repetitions or omitted neurons.

Recovery from a different starting state can depend on the order

$$J=\begin{pmatrix}0&1\\1&0\end{pmatrix},\qquad h=0,\qquad s=(+1,-1).$$

$$U_2(U_1(s))=(-1,-1),\qquad U_1(U_2(s))=(+1,+1).$$

The two orders reach different stored patterns; repeating parallel updates cycles between (+1,−1) and (−1,+1).

Changed single-neuron updates decrease energy when their fields are nonzero; a zero-field fixed point need not be a strict local energy minimum.

3. What “optimal storage” means

For nonempty \(D\), define the unnormalized spin-energy flow $$K(J,h)=\sum_{s\in D}\sum_{i=1}^n\exp\!\left(-\frac{E(\operatorname{flip}_i(s))-E(s)}2\right)=\sum_{s\in D}\sum_{i=1}^n e^{-g_i(s)}.$$

· Small flow certifies storage Proved here

$$D\text{ storable}\iff\inf_{J=J^\top,\,J_{ii}=0,\,h}K(J,h)=0,$$

$$K(J,h)<1\implies\min_{s\in D,\,i\in[n]}g_i(s)>0.$$

Proof

Every margin is linear in the shared parameters, so K is convex. If \(g_{\min}>0\), $$K(cJ,ch)\le nm\,e^{-cg_{\min}}\to0\qquad(c\to\infty).$$ A nonpositive margin contributes at least one, so a sum below one forces all margins positive.

The infimum on separable data may require diverging scale; normalizing by m changes the sufficient threshold to 1/m.

Translate the source’s MPF normalization

The source uses bit energy \(E^{\rm bit}=E/2+C\), so its translated objective is $$K_{\rm HSK}(J,h)=\sum_{s\in D}\sum_i e^{-g_i(s)/2},\qquad K(J,h)=K_{\rm HSK}(2J,2h).$$ Both objectives have the same strict feasibility criterion; their numerical scales differ.

[Hillar–Sohl-Dickstein–Koepsell (2015), Eqs. (2)–(4), Thm. 1]