A brain-inspired neural architecture with self-organizing sparse hierarchical connectivity.
RSGN implements a novel neural network architecture that:
- Embeds computational nodes in learned hyperbolic space
- Uses distance-based connectivity that naturally enforces sparsity
- Employs input-dependent ignition for dynamic routing
- Combines fast gradient descent with slow Hebbian structural learning
pip install torch numpy matplotlib seaborn jupyterRSGN/
├── src/
│ ├── __init__.py # Package exports
│ ├── model.py # Core RSGN architecture
│ ├── hyperbolic.py # Hyperbolic geometry operations
│ ├── hebbian.py # Hebbian structural learning
│ └── utils.py # Data generation and baselines
├── analysis/
│ └── rsgn_experiments.ipynb # Main experiments notebook
├── tests/ # Unit tests
└── examples/ # Usage examples
import torch
from src.model import RSGClassifier
from src.hebbian import HebbianLearner
from src.utils import generate_hierarchical_data, create_dataloaders
# Generate data
X, y = generate_hierarchical_data(num_samples=5000, seq_len=32, dim=64, num_classes=10)
train_loader, val_loader = create_dataloaders(X, y)
# Create model
model = RSGClassifier(
num_classes=10,
num_nodes=256,
dim_input=64,
dim_hidden=128,
num_steps=5
)
# Training with Hebbian learning
hebbian = HebbianLearner(model.rsg)
optimizer = torch.optim.AdamW(model.parameters(), lr=1e-3)
criterion = torch.nn.CrossEntropyLoss()
for epoch in range(50):
for batch_x, batch_y in train_loader:
optimizer.zero_grad()
logits, alpha = model(batch_x)
loss = criterion(logits, batch_y)
loss.backward()
optimizer.step()
# Hebbian structural update
hebbian.update(alpha.detach(), reward=-loss.item())The core network with:
- Node positions in Poincare ball (hyperbolic space)
- Distance-based connection weights
- Soft-threshold activation dynamics
- Local inhibition for competition
Manages slow structural learning:
- Co-activation strengthens affinities
- Position drift toward correlated nodes
- Threshold adaptation for sparsity control
- Periodic pruning and sprouting
Open and run the Jupyter notebook:
cd analysis
jupyter notebook rsgn_experiments.ipynbThis generates:
- Performance comparison tables
- Training curves
- Architecture visualizations
- Ablation study results
@article{hays2026rsgn,
title = {Resonant Sparse Geometry Networks},
doi = {10.48550/ARXIV.2601.18064},
url = {https://arxiv.org/abs/2601.18064},
author = {Hays, Hasi},
publisher = {arXiv},
year = {2026},
copyright = {Creative Commons Attribution 4.0 International}
}MIT License