gradient-free-snn-evolution-strategies

star 1

Low-rank evolution strategies for gradient-free spiking neural network training. EGGROLL method reduces memory from O(mn) to O(r(m+n)) enabling on-chip learning without surrogate gradients. Key benefits: 2.23x speedup, neuromorphic hardware compatibility, no backpropagation infrastructure. Use when: (1) training SNNs on neuromorphic chips, (2) avoiding surrogate gradient approximation, (3) needing gradient-free optimization for discrete spike thresholds, (4) scaling evolution strategies to large weight matrices. Activation: gradient-free SNN training, evolution strategies, neuromorphic on-chip learning, low-rank factorization, EGGROLL, N-MNIST benchmark, LIF neurons.

hiyenwong By hiyenwong schedule Updated 6/3/2026

name: gradient-free-snn-evolution-strategies description: "Low-rank evolution strategies for gradient-free spiking neural network training. EGGROLL method reduces memory from O(mn) to O(r(m+n)) enabling on-chip learning without surrogate gradients. Key benefits: 2.23x speedup, neuromorphic hardware compatibility, no backpropagation infrastructure. Use when: (1) training SNNs on neuromorphic chips, (2) avoiding surrogate gradient approximation, (3) needing gradient-free optimization for discrete spike thresholds, (4) scaling evolution strategies to large weight matrices. Activation: gradient-free SNN training, evolution strategies, neuromorphic on-chip learning, low-rank factorization, EGGROLL, N-MNIST benchmark, LIF neurons." license: Complete terms in LICENSE.txt metadata: arxiv_id: "2605.30361" published: "2026-06-01" authors: "Author names from paper" tags: [spiking-neural-networks, evolution-strategies, gradient-free, neuromorphic, low-rank, EGGROLL, on-chip-learning]

Gradient-Free SNN Training via Low-Rank Evolution Strategies

EGGROLL (Evolutionary Gradient-free Rolling Low-rank) method for training SNNs without backpropagation or surrogate gradients, enabling on-chip learning on neuromorphic hardware.

Problem Statement

Spiking Neural Networks (SNNs) offer compelling energy efficiency on neuromorphic hardware, yet training remains challenging:

  • Discrete spike threshold is non-differentiable
  • Surrogate-gradient methods approximate derivatives but impose backpropagation infrastructure incompatible with on-chip learning
  • Evolution Strategies (ES) are natural gradient-free alternatives but computational cost scales with number of parameters (O(mn) per generation)

Solution: Low-rank factorization of ES perturbations reduces memory from O(mn) to O(r(m+n)), making ES practical for large weight matrices.

EGGROLL Method

Core Concept

Traditional ES generates full-rank perturbation matrices:

θ_t+1 = θ_t + α · (1/N) Σ_i ε_i · F(θ_t + σε_i)
where ε_i ∈ ℝ^(m×n) (full matrix perturbation)

EGGROLL factorizes perturbations into low-rank form:

ε_i ≈ U_i · V_i^T  where U ∈ ℝ^(m×r), V ∈ ℝ^(n×r)
Memory: O(mr + nr) vs O(mn)

Algorithm

def eggroll_evolution_step(weights, rank_r, sigma, alpha, fitness_fn):
    """
    EGGROLL low-rank ES step
    
    Parameters:
        weights: Current weight matrix [m, n]
        rank_r: Low-rank dimension (r << m, n)
        sigma: Perturbation scale
        alpha: Learning rate
        fitness_fn: Fitness function (e.g., accuracy)
    
    Returns:
        updated_weights: New weight matrix
    """
    # Sample N perturbation pairs
    perturbations = []
    for i in range(N):
        U_i = random_normal([m, r])  # Low-rank factor 1
        V_i = random_normal([n, r])  # Low-rank factor 2
        epsilon_i = U_i @ V_i.T       # Reconstruct perturbation
        perturbations.append(epsilon_i)
    
    # Evaluate fitness with perturbations
    rewards = []
    for epsilon_i in perturbations:
        perturbed_weights = weights + sigma * epsilon_i
        reward = fitness_fn(perturbed_weights)
        rewards.append(reward)
    
    # Weighted update (centered ES)
    reward_centered = rewards - mean(rewards)
    weighted_update = alpha * (1/N) * sum(reward_centered[i] * perturbations[i])
    
    updated_weights = weights + weighted_update
    return updated_weights

Memory and Speed Comparison

Method Per-Generation Memory Wall-Clock Time Test Accuracy (N-MNIST)
Full-rank ES O(mn) Baseline ~79%
EGGROLL (r=10) O(r(m+n)) = O(10(m+n)) 2.23x faster 79.21%
EGGROLL (r=5) O(5(m+n)) ~2.5x faster 78.5%
EGGROLL (r=1) O(m+n) ~3x faster 76%

Key insight: Clear accuracy-speed tradeoff controlled by rank r. Higher rank preserves more optimization capacity but costs more memory.

Implementation Pipeline

Step 1: SNN Architecture Setup

# Leaky Integrate-and-Fire (LIF) neuron
class LIFNeuron:
    def __init__(self, threshold=1.0, decay=0.9):
        self.threshold = threshold
        self.decay = decay
    
    def forward(self, input_current, membrane_potential):
        # Membrane potential update
        membrane_potential = self.decay * membrane_potential + input_current
        
        # Spike generation
        spike = (membrane_potential >= self.threshold).float()
        membrane_potential = membrane_potential * (1 - spike)  # Reset
        
        return spike, membrane_potential

Step 2: EGGROLL Training Loop

def train_snn_with_eggroll(model, data, rank_r, generations=100):
    """
    Train SNN using EGGROLL
    
    Parameters:
        model: SNN with LIF neurons
        data: Training dataset (N-MNIST)
        rank_r: Low-rank dimension
        generations: Number of ES generations
    
    Returns:
        trained_model: Optimized SNN
        trajectory: Fitness history
    """
    trajectory = []
    
    for gen in range(generations):
        # Evaluate current fitness
        fitness = evaluate_on_nmnist(model, data)
        trajectory.append(fitness)
        
        # Apply EGGROLL update to all weight matrices
        for layer_name, weights in model.weights.items():
            m, n = weights.shape
            updated = eggroll_evolution_step(
                weights, rank_r,
                sigma=0.02, alpha=0.1,
                fitness_fn=lambda w: evaluate_layer_fitness(model, w, data)
            )
            model.weights[layer_name] = updated
    
    return model, trajectory

Step 3: N-MNIST Benchmark

N-MNIST (Neuromorphic-MNIST) evaluation:

  • Event-based version of MNIST
  • Temporal spike trains (not static images)
  • Standard benchmark for SNN performance

EGGROLL results: 79.21% test accuracy with 2.23x speedup relative to full-rank ES.

Neuromorphic Hardware Compatibility

Why EGGROLL Works On-Chip

  1. No backpropagation infrastructure: ES only requires forward passes
  2. No gradient computation: Discrete spike threshold handled naturally
  3. Local operations: Perturbation sampling can be parallelized across cores
  4. Memory-efficient: Low-rank factorization fits hardware constraints

Hardware Considerations

Hardware EGGROLL Suitability Considerations
Intel Loihi Excellent Built-in plasticity + local computation
BrainChip Akida Excellent On-chip learning support
SpiNNaker 2 Good Parallel ES evaluation across cores
FPGA-based Excellent Custom low-rank factorization circuits

Applications

Use Case 1: On-Chip SNN Learning

When training directly on neuromorphic hardware:

# Neuromorphic deployment pattern
snn_model = create_lif_network()
trained_model = train_snn_with_eggroll(
    snn_model, data,
    rank_r=10,  # Balance accuracy/memory
    generations=200
)
deploy_to_loihi(trained_model)

Use Case 2: Surrogate Gradient Alternative

When avoiding gradient approximation artifacts:

  • Surrogate gradients: Approximate derivative as smooth function (e.g., sigmoid)
  • EGGROLL: No derivative needed, direct fitness evaluation
  • Use when surrogate approximation introduces systematic errors

Use Case 3: Large-Scale SNN Training

When scaling to large weight matrices:

# Full-rank ES (infeasible)
weights = [1000, 5000]  # Memory per gen: O(5M parameters)
# Memory requirement: ~40MB per generation

# EGGROLL with r=10
# Memory per gen: O(10 * (1000 + 5000)) = O(60k)
# Memory requirement: ~480KB per generation (83x reduction)

Tradeoff Analysis

Rank Selection Guide

Rank r Memory Reduction Speedup Accuracy Impact Recommended Use
r=1 Maximum (O(m+n)) ~3x ~3% drop Hardware-constrained
r=5 High (~80x) ~2.5x ~1% drop Memory-limited deployment
r=10 Moderate (~40x) 2.23x None (79.21%) Balanced choice
r=20 Low (~20x) ~1.5x Optimal Research/experiments

Recommendation: Start with r=10, adjust based on hardware constraints and accuracy requirements.

Comparison with Other Methods

Method Gradient-Free On-Chip Compatible Memory Efficiency Accuracy
Backprop + Surrogate No No High Highest
Full-rank ES Yes Yes Low (O(mn)) Good
EGGROLL Yes Yes High (O(r(m+n))) Good
Hebbian Learning Yes Yes High Moderate

Pitfalls

  1. Rank too low: r=1 may cause significant accuracy drop (~3%). Test with r≥5 for production use.

  2. Perturbation scale (sigma): Too large → unstable optimization. Too small → slow convergence. Start with σ=0.02.

  3. Learning rate (alpha): ES requires careful tuning. α=0.1 is good starting point. Higher values may overshoot.

  4. Generation count: EGGROLL converges slower than backprop. Use 100-200 generations for N-MNIST.

  5. Fitness evaluation cost: Each generation requires N forward passes (typically N=100-500). Parallelize across cores.

  6. Centered vs uncentered ES: Centered (reward-mean) improves convergence. Always subtract mean reward before update.

  7. Architecture-specific tuning: LIF parameters (threshold, decay) interact with EGGROLL. Fix neuron params before ES tuning.

Experimental Setup Details

N-MNIST evaluation:

  • Standard neuromorphic benchmark
  • 60,000 training samples, 10,000 test samples
  • Event-based temporal data (not static frames)
  • Metric: Classification accuracy

LIF neuron parameters:

  • Threshold: 1.0 (spike generation)
  • Decay: 0.9 (membrane leak)
  • Reset: Hard reset (set to 0 after spike)

EGGROLL hyperparameters:

  • Rank r: 10 (balanced)
  • Sigma: 0.02 (perturbation scale)
  • Alpha: 0.1 (learning rate)
  • Generations: 100-200

References

  • arXiv:2605.30361 — EGGROLL source paper
  • N-MNIST benchmark — Neuromorphic MNIST dataset
  • Evolution Strategies literature — OpenAI ES, Natural ES
  • Surrogate gradient methods — SNN training approximation
  • Neuromorphic hardware — Loihi, Akida, SpiNNaker

Related Skills

  • snn-training-methods — Comprehensive SNN training survey
  • surrogate-gradient-learning — Gradient approximation for SNNs
  • lif-neuron-dynamics — Leaky Integrate-and-Fire implementation
  • neuromorphic-hardware-deployment — On-chip deployment patterns
  • evolution-strategies-optimization — General ES methodology
Install via CLI
npx skills add https://github.com/hiyenwong/ai_collection --skill gradient-free-snn-evolution-strategies
Repository Details
star Stars 1
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator