Computing Library › Optimization
Optimization

CMA-ES

The covariance matrix adaptation evolution strategy samples candidates from a Gaussian and reshapes that Gaussian toward better regions, needing no gradients.

A derivative-free evolution strategy

CMA-ES optimizes a function using only its values, no gradients, making it suited to noisy, black-box, or non-differentiable objectives. It maintains a multivariate Gaussian search distribution described by a mean vector, an overall step size, and a covariance matrix. Each generation samples a population of candidate points from this Gaussian, evaluates them, and updates the distribution's parameters to concentrate future samples where good points were found.

Adapting the covariance

Kronos motion — training from sim

The defining feature is covariance matrix adaptation. After ranking the sampled points by fitness, the mean moves toward a weighted average of the best ones. The covariance matrix is then updated so its shape aligns with the directions of recent successful steps, learning the local curvature of the landscape without ever computing a Hessian. This lets the search stretch along shallow valleys and shrink across steep directions, handling ill-conditioned and rotated problems well.

Evolution paths and step size

CMA-ES tracks two evolution paths, exponentially smoothed histories of the mean's movement. One drives covariance adaptation; the other controls the global step size sigma through cumulative step-size adaptation, growing sigma when successive steps are correlated (progress in a consistent direction) and shrinking it when they cancel out (circling a minimum). This decouples the scale of the search from its shape.

When to use it

CMA-ES is a leading choice for continuous black-box optimization in moderate dimensions (up to hundreds of variables), including hyperparameter tuning, controller design, and simulation-based engineering optimization where each evaluation runs a costly model. It is robust to multimodality and noise and needs little tuning. Its cost per generation grows with the square of the dimension because of the covariance matrix, so very high-dimensional problems use restricted or diagonal variants.