entropy-stabilized
---A PyTorch optimizer implementing energy-stabilized α-β field coupling for gradient-based optimization. This approach combines adaptive moment estimation with topological field dynamics to improve performance on complex optimization landscapes.
Research Contribution
To our knowledge, this work represents the first implementation of energy-stabilized topological field dynamics in gradient-based optimization. The approach introduces several mathematical concepts not present in existing optimizers:
Topological Current Formulation: J = (α · ĝ) - (β · ĝ)
Coupled Field Evolution: Auxiliary fields evolve through differential equations
Energy Stabilization: Automatic field magnitude control via E = 0.5⟨α² + β²⟩
Topological Corrections: Parameter updates include tanh(α - β) terms
Empirical Evidence
Benchmark results on standard datasets demonstrate complexity-dependent improvements:
Dataset Standard Adam Topological Adam Improvement
MNIST 97.70% 97.59% -0.11%
Fashion-MNIST 87.97% 88.72% +0.75%
CIFAR-10 68.31% 68.57% +0.26%
This pattern suggests the algorithm provides benefits specifically where traditional optimizers face challenges - in complex optimization landscapes with multiple local minima.
Mathematical Foundation
Core Algorithm
The optimizer extends standard Adam with topological field dynamics:
1. Compute topological current
J = (α · ĝ) - (β · ĝ) # where ĝ is normalized gradient
2. Evolve auxiliary fields
α ← (1-η)α + (η/μ₀)J·β
β ← (1-η)β - (η/μ₀)J·α
3. Apply energy stabilization
E = 0.5⟨α² + β²⟩
if E ≠ target_energy: rescale_fields(α, β)
4. Final parameter update
θ ← θ - lr[adam_direction + w_topo·tanh(α - β)]
Theoretical Background
The approach combines established principles from multiple domains:
Adaptive moment estimation (proven Adam foundation)
Field theory dynamics (coupled oscillator systems)
Energy conservation principles (bounded field evolution)
Topological methods (non-local gradient corrections)
The energy stabilization mechanism ensures numerical stability while the topological fields provide exploration capabilities beyond standard gradient descent methods.
Quick Start
import torch
from topological_adam import TopologicalAdam
Replace Adam with Topological Adam
model = YourModel()
optimizer = TopologicalAdam(model.parameters(), lr=1e-3)
Standard training loop
for batch in dataloader:
optimizer.zero_grad()
loss = compute_loss(model, batch)
loss.backward()
optimizer.step()
Installation
git clone https://github.com/yourusername/topological-adam.git
cd topological-adam
pip install torch torchvision matplotlib
Configuration
Default Usage
optimizer = TopologicalAdam(model.parameters(), lr=1e-3)
Advanced Configuration
optimizer = TopologicalAdam(
model.parameters(),
lr=1e-3, # Learning rate
betas=(0.9, 0.999), # Adam momentum coefficients
eta=0.02, # Field evolution rate
mu0=0.5, # Coupling strength
w_topo=0.15, # Topological correction weight
target_energy=1e-3, # Energy stabilization target
)
Parameter Guidelines
Parameter Range Effect Recommendation
lr 1e-4 to 1e-2 Standard learning rate Start with 1e-3
eta 0.01 to 0.05 Field evolution speed 0.02 for stability
w_topo 0.05 to 0.25 Topological influence 0.15 for balance
target_energy 1e-4 to 1e-2 Field magnitude control 1e-3 for most problems
Benchmark Results
Complete Performance Analysis
Run the full benchmark suite to reproduce results:
MNIST/Fashion-MNIST: 5.762e-03 (perfectly stable)
CIFAR-10: 7.683e-03 (stable, adapted to problem complexity)
Topological Activity:
Healthy range: 0.01-0.06 across all datasets
No numerical instability observed during training
Performance Analysis
When Topological Adam Excels
Evidence suggests benefits in scenarios with:
✅ Complex optimization landscapes with multiple local minima
✅ Medium to high complexity problems (Fashion-MNIST, CIFAR-10)
✅ Non-convex loss surfaces requiring exploration
✅ Problems where standard optimizers plateau
When Standard Adam is Sufficient
⚪ Simple, convex-like problems (basic MNIST classification)
⚪ Memory-constrained environments (2× parameter overhead)
⚪ Applications where marginal improvements don't justify complexity
Computational Characteristics
Time overhead: ~1.5× standard Adam per step
Memory overhead: 2× parameter storage for auxiliary fields
Benefit threshold: Improvements typically justify overhead on complex problems
Hardware Support
Automatic Device Detection
Supports CPU, CUDA, and TPU automatically
optimizer = TopologicalAdam(model.parameters())
Fields automatically placed on correct device
Platform Compatibility
CPU: Standard CPU training
CUDA: GPU acceleration with automatic device placement
TPU: Google Cloud TPU with XLA compilation (torch-xla required)