In lieu of a hello-world blog post, I'm sharing some interactive app I built a few years ago to illustrate Evolutionary Strategies (ES) optimization as part of a seminar I prepared for my PhD.
This interactive demo implements a simple Evolution Strategies (ES) optimizer on a 2D objective function. ES is a black‑box optimization method: instead of backpropagating analytic gradients, it perturbs a search distribution, observes how rewards change, and moves the distribution’s mean in a direction that on average improves reward. It’s a great mental model for optimization as exploration + averaging (Hansen, 2006; Wierstra et al., 2008).
Controls and interaction:
Click anywhere on the canvas to set the initial mean μ; particles explore from there.
speed: sets η (the learning rate).
particles: sets n (population size via n slider).
zoom: magnifies the view; particles and objective remain aligned in world coordinates.
Click on the canvas below to try it:
0.010100² = 100001.00×
How it works
We maintain a Gaussian search distribution over inputs with mean μ∈R2 and fixed standard deviation σ:
xi=μ+σεi,εi∼N(0,I),i=1,…,n.
Each sample is evaluated on the objective f(x) to obtain rewards ri=f(xi). To stabilize updates we z‑score the rewards
r~i=srri−rˉ,
and form a Natural Evolution Strategies–style gradient estimate for the mean:
g^μ∝nσ1i=1∑nr~iεi.
The mean is updated with learning rate (speed) η:
μ←μ+ηg^μ.
Objective surface used in this demo
We optimize a synthetic multimodal function (sum/difference of Gaussians):
Sampling symmetrically around μ means that directions that tend to increase f will, on average, receive larger positive scores. After normalization, the weighted average of perturbations points toward higher reward. The step size η trades off stability and speed.
References
Hansen, N. (2006). The CMA Evolution Strategy: A Comparing Review. Towards a New Evolutionary Computation, 75–102.
Wierstra, D., Schaul, T., Glasmachers, T., Sun, Y., Peters, J., & Schmidhuber, J. (2008). Natural Evolution Strategies. Proceedings of the 2008 IEEE Congress on Evolutionary Computation.