Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install hiyenwong-ai-collection-collection-skills-kernel-hopfield-attractor-geometrygit clone https://github.com/hiyenwong/ai_collection.gitcp ai_collection/SKILL.MD ~/.claude/skills/hiyenwong-ai-collection-collection-skills-kernel-hopfield-attractor-geometry/SKILL.md---
name: kernel-hopfield-attractor-geometry
description: "Geometric analysis of attractor boundaries and storage capacity limits in kernel Hopfield networks trained with Kernel Logistic Regression (KLR). Covers attractor basin geometry, Ridge of Optimization, morphing analysis, SNR vs Cover's theorem, and dynamical stability. Activation: kernel Hopfield, KLR associative memory, attractor basin geometry, Ridge of Optimization, morphing analysis Hopfield, storage capacity Hopfield, SNR analysis Hopfield, Cover's theorem associative memory, crosstalk noise Hopfield, kernel Hopfield attractor, kernel logistic regression memory."
category: neural-networks
---
# Kernel Hopfield Attractor Geometry
> Geometric analysis of attractor boundaries and storage capacity limits in kernel Hopfield networks trained with Kernel Logistic Regression (KLR), revealing that the ultimate storage limit is constrained by dynamical instability against crosstalk noise rather than geometric separability.
## Metadata
| Field | Value |
|-------|-------|
| **Source** | arXiv: 2605.00366 [cs.NE, cs.LG] |
| **Title** | Geometric analysis of attractor boundaries and storage capacity limits in kernel Hopfield networks |
| **Authors** | Akira Tamamori |
| **Published** | 2026-05-01 |
| **Category** | Neural & Evolutionary Computing, Machine Learning |
| **Domain** | Associative Memory, Hopfield Networks, Kernel Methods |
## Core Concepts
### Kernel Logistic Regression (KLR) Hopfield Networks
KLR-trained Hopfield networks replace classical Hebbian weight construction with weights learned via Kernel Logistic Regression in feature space. This approach fundamentally changes the energy landscape:
- **Weight construction**: Weights are derived from KLR coefficients rather than outer-product Hebbian sums
- **Feature space**: Patterns are mapped to a high-dimensional kernel feature space where they become more linearly separable
- **Energy function**: The network dynamics follow a modified energy landscape shaped by the KLR objective
- **Exemplar-based memory**: The network functions as a highly localized, exemplar-based retrieval system rather than a distributed one
### Storage Capacity Results
The paper establishes two key capacity benchmarks:
| Data Type | Storage Capacity (P/N) | Notes |
|-----------|----------------------|-------|
| Random sequences | ≈ 16 | Unstructured, high-noise regime |
| Structured data (CIFAR-10) | ≈ 20 | Image embeddings with inherent structure |
These capacities significantly exceed classical Hopfield network limits (P/N ≈ 0.14) and even modern dense associative memory models. The capacity gap between random and structured data reveals that **intrinsic data structure provides additional stability** against crosstalk noise.
### Attractor Basin Geometry and the "Ridge of Optimization"
A central finding is the **Ridge of Optimization** — a narrow region in parameter space where the network operates at peak retrieval performance:
- Attractors along the Ridge are separated by **sharp, phase-transition-like boundaries**
- These boundaries manifest as **steep effective potential barriers** between basins
- Near the Ridge, the system exhibits **critical slowing down** — dynamics become slower as the system approaches the boundary
- The Ridge represents the optimal trade-off between storage density and retrieval stability
### Morphing Analysis for Boundary Detection
Phenomenological morphing experiments reveal the geometry of attractor boundaries:
1. **Morphing protocol**: Create interpolated states between stored patterns
2. **Dynamics tracking**: Evolve morphed states under network dynamics
3. **Boundary identification**: Locate points where the flow field switches basins
4. **Potential barrier estimation**: Measure the steepness of the effective potential at boundaries
The morphing analysis reveals that boundaries are not gradual transitions but **sharp discontinuities** resembling phase transitions in physical systems.
### SNR Analysis vs Cover's Theorem
The paper contrasts two frameworks for understanding storage limits:
| Framework | What it Measures | Conclusion |
|-----------|-----------------|------------|
| **Cover's Theorem** | Geometric separability in feature space | Suggests much higher capacity should be possible |
| **SNR Analysis** | Signal-to-noise ratio of retrieval dynamics | Predicts the observed capacity limit |
**Key insight**: The ultimate storage limit is **NOT** caused by insufficient geometric separability (Cover's theorem suggests the feature space can separate far more patterns). Instead, it is caused by the **loss of dynamical stability against crosstalk noise** — the retrieved state becomes dynamically unstable even though it remains geometrically separable.
This distinction is critical for system design:
- Adding more kernel dimensions improves separability but does NOT raise the capacity limit
- The bottleneck is in the **dynamics**, not the **geometry**
- Optimal design focuses on **dynamical stability** (weight regularization, energy landscape shaping)
### Dynamical Stability vs Geometric Separability
The fundamental mechanism of capacity limitation:
```
Geometric Separability (Cover's theorem)
↓ patterns remain linearly separable in feature space
↓ this condition holds well beyond observed capacity
Dynamical Stability (SNR analysis) ← ACTUAL LIMIT
↓ crosstalk noise accumulates with stored patterns
↓ fixed points lose their attracting power
↓ retrieval fails despite geometric separability
```
## Implementation Guide
### Prerequisites
- Python 3.9+ with NumPy, SciPy
- Scikit-learn for kernel methods and data handling
- CIFAR-10 dataset (for structured data experiments)
- Matplotlib/Seaborn for attractor landscape visualization
### Step-by-Step Implementation
#### Step 1: KLR-Based Weight Construction
```python
import numpy as np
from sklearn.kernel_approximation import RBFSampler
from sklearn.linear_model import LogisticRegression
def build_klr_hopfield_weights(X_stored, gamma=1.0, C=1.0):
"""
Build Hopfield network weights using Kernel Logistic Regression.
Args:
X_stored: (P, N) matrix of stored patterns
gamma: RBF kernel bandwidth
C: Logistic regression regularization
Returns:
W: (N, N) weight matrix for Hopfield dynamics
klr_model: Fitted KLR model for analysis
"""
P, N = X_stored.shape
# Map to kernel feature space
rbf = RBFSampler(gamma=gamma, n_components=N)
phi_X = rbf.fit_transform(X_stored)
# For each pattern, train binary classifier (pattern vs all others)
W = np.zeros((N, N))
for i in range(P):
y = np.zeros(P)
y[i] = 1.0
clf = LogisticRegression(C=C, solver='lbfgs', max_iter=1000)
clf.fit(phi_X, y)
W += np.outer(clf.coef_.flatten(), X_stored[i])
return W / P, clf
```
#### Step 2: Network Dynamics Simulation
```python
def hopfield_dynamics(W, x_init, steps=100, temperature=0.0):
"""
Simulate KLR-Hopfield network dynamics.
Args:
W: (N, N) weight matrix
x_init: (N,) initial state
steps: number of update steps
temperature: for stochastic updates (0.0 = deterministic)
Returns:
trajectory: (steps+1, N) state trajectory
"""
x = x_init.copy()
trajectory = [x.copy()]
for _ in range(steps):
h = W @ x # local field
if temperature > 0:
# Stochastic update
probs = 1.0 / (1.0 + np.exp(-2 * h / temperature))
x = 2 * (np.random.rand(len(x)) < probs).astype(float) - 1
else:
# Deterministic update (synchronous)
x = np.sign(h)
trajectory.append(x.copy())
return np.array(trajectory)
```
#### Step 3: Storage Capacity Measurement
```python
def measure_storage_capacity(N, data_type='random', gamma=1.0, n_trials=50):
"""
Measure P/N storage capacity for given network size and data type.
Returns capacity ratio where retrieval success drops below 90%.
"""
capacities = []
for trial in range(n_trials):
for P_ratio in np.arange(2, 25, 1):
P = int(P_ratio * N)
if data_type == 'random':
X = np.random.randn(P, N)
elif data_type == 'structured':
# e.g., CIFAR-10 embeddings
X = load_structured_data(P, N)
X = X / np.linalg.norm(X, axis=1, keepdims=True)
W, _ = build_klr_hopfield_weights(X, gamma=gamma)
# Test retrieval from noisy initial states
success_count = 0
for i in range(min(P, 20)):
x_noisy = X[i] + 0.3 * np.random.randn(N)
traj = hopfield_dynamics(W, x_noisy, steps=50)
if np.dot(traj[-1], X[i]) > 0.9:
success_count += 1
if success_count / min(P, 20) < 0.9:
capacities.append(P_ratio)
break
return np.mean(capacities)
```
#### Step 4: Morphing Analysis for Boundary Detection
```python
def morphing_analysis(W, pattern_a, pattern_b, n_steps=50):
"""
Perform morphing analysis between two stored patterns.
Creates interpolated states and tracks which attractor they converge to.
Reveals the location and sharpness of basin boundaries.
"""
alphas = np.linspace(0, 1, n_steps)
results = []
for alpha in alphas:
# Create morphed state
x_morph = (1 - alpha) * pattern_a + alpha * pattern_b
x_morph = x_morph / np.linalg.norm(x_morph)
# Evolve under dynamics
traj = hopfield_dynamics(W, x_morph, steps=100)
final = traj[-1]
# Measure attraction to each pattern
overlap_a = np.dot(final, pattern_a) / np.linalg.norm(final)
overlap_b = np.dot(final, pattern_b) / np.linalg.norm(final)
results.append({
'alpha': alpha,
'overlap_a': overlap_a,
'overlap_b': overlap_b,
'converged_to_a': overlap_a > overlap_b
})
return results
def find_boundary(results, threshold=0.5):
"""
Locate the basin boundary from morphing results.
Returns alpha value where convergence switches from pattern A to B.
"""
for i, r in enumerate(results):
if r['overlap_a'] < threshold:
return i / len(results)
return 1.0
```
#### Step 5: SNR Analysis
```python
def snr_analysis(W, X_stored, pattern_idx):
"""
Compute Signal-to-Noise Ratio for a stored pattern.
Signal: contribution from the target pattern
Noise: crosstalk from all other stored patterns
"""
x = X_stored[pattern_idx]
h = W @ x
# Signal component (aligned with target)
signal = np.dot(h, x)
# Noise component (orthogonal to target)
projection = signal * x / np.dot(x, x)
noise = h - projection
noise_power = np.linalg.norm(noise)
return signal / (noise_power + 1e-10)
def snr_vs_capacity(N, P_ratios):
"""
Plot SNR as function of storage load P/N.
Shows where SNR drops below stability threshold.
"""
results = []
for P_ratio in P_ratios:
P = int(P_ratio * N)
X = np.random.randn(P, N)
X = X / np.linalg.norm(X, axis=1, keepdims=True)
W, _ = build_klr_hopfield_weights(X)
snrs = [snr_analysis(W, X, i) for i in range(P)]
results.append({
'P_N': P_ratio,
'mean_snr': np.mean(snrs),
'min_snr': np.min(snrs),
'snr_std': np.std(snrs)
})
return results
```
### Ridge of Optimization Search
```python
def find_ridge_of_optimization(X_stored, gamma_range, C_range):
"""
Search parameter space for the Ridge of Optimization.
The Ridge is the narrow region where retrieval accuracy is maximized
just before the onset of dynamical collapse.
"""
grid = []
for gamma in gamma_range:
for C in C_range:
W, _ = build_klr_hopfield_weights(X_stored, gamma=gamma, C=C)
accuracy = 0
for i in range(len(X_stored)):
x_noisy = X_stored[i] + 0.3 * np.random.randn(len(X_stored[0]))
traj = hopfield_dynamics(W, x_noisy, steps=50)
if np.dot(traj[-1], X_stored[i]) > 0.9:
accuracy += 1
accuracy /= len(X_stored)
grid.append({
'gamma': gamma, 'C': C, 'accuracy': accuracy
})
# Find peak accuracy region
grid = sorted(grid, key=lambda x: x['accuracy'], reverse=True)
return grid[:10] # Top 10 configurations on the Ridge
```
## Pitfalls and Limitations
### Known Limitations
1. **Exemplar-based locality**: KLR networks store memories as highly localized exemplars. This is optimal for precise retrieval but may struggle with generalization to novel, unseen variations.
2. **Kernel choice sensitivity**: Storage capacity depends strongly on kernel bandwidth (gamma). Poor gamma selection can drastically reduce effective capacity.
3. **Critical slowing down near boundaries**: When operating near the Ridge of Optimization, retrieval dynamics become slower. This is a trade-off — maximum capacity comes with slower convergence.
4. **Crosstalk noise accumulation**: Even with KLR's superior separability, crosstalk noise scales with the number of stored patterns. This is the fundamental capacity bottleneck.
5. **Structured vs random gap**: The ≈4 P/N gap between random and structured data capacity reveals that the method is sensitive to data geometry. Real-world deployment must account for the structure of target data.
6. **Phase-transition boundaries**: The sharp boundaries between attractors mean that small perturbations near boundaries can cause catastrophic retrieval failure (wrong attractor basin).
### Common Implementation Mistakes
1. **Ignoring normalization**: Patterns must be normalized before storage. Unnormalized patterns lead to uneven basins and biased retrieval.
2. **Synchronous vs asynchronous updates**: The paper assumes specific update dynamics. Switching to asynchronous (random-order) updates can change basin geometry.
3. **Over-regularization**: Excessive C regularization in KLR reduces the effective kernel separation, lowering capacity below theoretical limits.
4. **Insufficient morphing resolution**: When performing morphing analysis, use at least 50 interpolation steps to resolve the sharp phase-transition boundaries. Coarse sampling will miss the boundary.
5. **Confusing geometric with dynamical limits**: Don't add more kernel dimensions expecting higher capacity — the limit is dynamical (SNR/crosstalk), not geometric (Cover's theorem).
## Applications
### Associative Memory Systems
- **High-capacity pattern retrieval**: Store 16-20× more patterns than classical Hopfield networks
- **Content-addressable memory**: Retrieve complete patterns from partial or noisy cues
- **Robust retrieval systems**: Operate near the Ridge of Optimization for maximum capacity with acceptable stability
### Image and Embedding Retrieval
- **Image database search**: Use CIFAR-10-level embeddings for rapid approximate nearest-neighbor retrieval
- **Feature space organization**: The KLR weight structure naturally organizes similar items nearby in the energy landscape
- **Multi-modal memory**: Store heterogeneous data types in a unified attractor landscape
### Optimization and Search
- **Landscape-informed optimization**: Use the attractor geometry to guide search away from basin boundaries
- **Parameter tuning**: The Ridge of Optimization provides a principled target for hyperparameter selection
- **Early stopping detection**: Critical slowing down signals proximity to basin boundaries, useful for adaptive algorithms
### Theoretical Neuroscience
- **Memory capacity modeling**: The SNR vs geometric separability distinction informs theories of biological memory limits
- **Attractor network design**: Insights into how biological networks might balance storage density with retrieval stability
- **Phase transitions in neural dynamics**: The sharp basin boundaries parallel observed critical phenomena in neural systems
## Best Practices
1. **Always measure SNR alongside retrieval accuracy** — SNR provides early warning of approaching the capacity limit before retrieval fails catastrophically.
2. **Use morphing analysis to map basin boundaries** before deploying at high storage loads. Understanding the boundary geometry helps set safe operating margins.
3. **Operate slightly below the Ridge peak** — the steep potential barriers mean that small parameter drift can push the system into the unstable regime. A 5-10% capacity margin provides robustness.
4. **Validate with both random and structured data** — the P/N ≈ 16 vs ≈ 20 gap means capacity estimates from random data are conservative for structured domains.
5. **Monitor convergence speed** — critical slowing down is a real-time diagnostic for proximity to basin boundaries. If retrieval takes significantly longer, the system is near capacity.
6. **Use Cover's theorem as an upper bound reference** — it tells you what's geometrically possible; the gap between Cover's bound and actual capacity quantifies the dynamical stability cost.
## Related Skills
- **kernel-hopfield-associative-memory**: Foundational skill for KLR-trained Hopfield network construction and basic retrieval operations
- **neuro-attractor-landscape-working-memory**: General attractor landscape analysis for working memory models and dynamical systems
- **dense-associative-memory**: Modern Hopfield networks with exponential interaction functions
- **energy-based-models**: General framework for energy-based neural architectures
- **kernel-methods-ml**: Broader kernel method techniques applicable to KLR weight construction
- **storage-capacity-analysis**: General methodology for measuring and analyzing neural network storage limits
- **phase-transitions-neural-systems**: Analysis of critical phenomena and phase transitions in neural dynamics
## Resources
- **arXiv Paper**: https://arxiv.org/abs/2605.00366
- **PDF**: https://arxiv.org/pdf/2605.00366
- **Cover's Theorem**: Cover, T.M. (1965). "Geometrical and Statistical Properties of Systems of Linear Inequalities with Applications in Pattern Recognition"
- **Classical Hopfield Networks**: Hopfield, J.J. (1982). "Neural networks and physical systems with emergent collective computational abilities"
- **Kernel Logistic Regression**: Keerthi, S.S. et al. (2005). "A Modified Finite Newton Method for Fast Solution of Large Scale Linear SVMs"
---
_Last updated: 2026-05-05_