# polystep

A gradient-free method for training neural networks, including spiking networks and other models without useful gradients, that perturbs parameters within a finite radius and updates them through a weighted optimal-transport barycenter.

PolyStep trains models that lack useful gradients, such as spiking neural networks, quantized layers or those with hard routing, by evaluating finite-radius parameter perturbations and moving parameters to a weighted barycenter computed by optimal transport, rather than backpropagating. For ordinary differentiable models, standard backpropagation is usually faster.

Each optimization step samples a rotated polytope of candidate parameter sets, evaluates its vertices, computes transport weights between them, and moves toward their barycenter; an optional subspace mechanism reduces the number of coordinates searched at once, and softmax or Sinkhorn weighting controls how blocks of parameters are treated relative to one another.

It installs with pip, requires Python 3.11 and PyTorch 2.8 or newer, and includes baseline gradient-free methods for comparison, including OpenAI-ES, SPSA, MeZO, random search and CMA-ES. The method was accepted at Transactions on Machine Learning Research.

Website: https://github.com/anindex/polystep
