CMA-ES, the covariance matrix adaptation evolution strategy, is a stochastic, derivative-free algorithm for numerical optimization of continuous functions that samples candidate solutions from a multivariate normal distribution and adapts the mean, step size and full covariance matrix of that distribution from generation to generation. Within evolutionary computation, a branch of artificial intelligence, it is widely regarded as the state-of-the-art evolution strategy for difficult, non-separable and ill-conditioned problems of moderate dimension.
Developed mainly by Nikolaus Hansen and Andreas Ostermeier in the 1990s, CMA-ES learns the shape of the fitness landscape without computing gradients. Its update rules are closely related to a natural gradient step on the parameters of the search distribution, which explains why it is both robust and largely invariant to rotations and monotone transformations of the objective function.
How CMA-ES samples and updates its search distribution
Each generation, CMA-ES draws lambda offspring from a normal distribution with mean m, global step size sigma and covariance matrix C. It evaluates their fitness, ranks them and keeps the best mu individuals. Only the ranking is used, never the raw fitness values, which makes the method rank-based and insensitive to scaling of the objective.
The new mean is a weighted recombination of the selected individuals, with larger weights for better ranks. The covariance matrix is then updated with two complementary terms, and the step size is adapted separately. The table below summarizes the main update mechanisms.
| Mechanism | What it updates | Purpose |
|---|---|---|
| Weighted recombination | Distribution mean | Moves the search toward better regions |
| Rank-one update | Covariance matrix | Reinforces the direction of recent progress via the evolution path |
| Rank-mu update | Covariance matrix | Uses information from all selected steps in one generation |
| Cumulative step-size adaptation | Step size sigma | Lengthens or shortens steps by comparing path length with its expected value |
| Evolution paths | Accumulated mean shifts | Captures correlations between consecutive generations |
Over time, C approximates the inverse Hessian of the objective near the optimum, up to a scalar factor. In effect, CMA-ES learns a variable metric, similar to quasi-Newton methods such as BFGS, but from ranked samples instead of gradients.
Key parameters and default settings
A major practical strength of CMA-ES is that it is almost parameter-free. Learning rates and weights have carefully derived defaults that depend only on the problem dimension n, so users normally set just the initial mean and the initial step size.
| Parameter | Default or typical value | Effect |
|---|---|---|
| Population size lambda | 4 + floor(3 ln n) | Larger values improve global search but cost more evaluations |
| Parent number mu | About lambda / 2 | Controls selection pressure in recombination |
| Initial step size sigma | About 0.3 of the search range | Sets the initial exploration radius |
| Initial mean | User-chosen starting point | Determines where the search begins |
| Covariance learning rate | Roughly 2 / n squared for rank-one | Slower adaptation in high dimensions |
Because the covariance learning rates scale with one over n squared, adapting a full matrix requires on the order of n squared function evaluations. This is why CMA-ES performs best for problems with roughly 3 to a few hundred variables; beyond that, restricted variants become necessary.
Variants for restarts, constraints and large scale
Several well-established variants extend the basic algorithm to multimodal, noisy or high-dimensional problems. The most widely used ones are summarized here.
- IPOP-CMA-ES restarts the search with a doubled population size whenever progress stalls, which greatly improves performance on multimodal functions.
- BIPOP-CMA-ES alternates between large and small population regimes to balance global and local search.
- Separable CMA-ES adapts only the diagonal of C, which reduces cost to linear time per sample at the price of ignoring correlations.
- Limited-memory and low-rank variants such as LM-CMA and VD-CMA scale the idea to thousands of variables.
- MO-CMA-ES applies covariance adaptation to multi-objective optimization.
Constraint handling is not built into the original method. Common approaches include penalty functions, repair of infeasible samples and boundary transformations, each of which can distort the learned covariance if applied carelessly.
How CMA-ES compares with other evolutionary methods
CMA-ES belongs to the family of evolution strategies, but its explicit modeling of the search distribution also links it to estimation of distribution algorithms. The comparison below positions it against close neighbors in the Topic.
| Method | Search representation | Main strength | Main weakness |
|---|---|---|---|
| CMA-ES | Full covariance normal distribution | Handles ill-conditioned, rotated problems | Quadratic cost in dimension |
| Simple evolution strategy | Isotropic or diagonal mutation | Cheap and easy to implement | Slow on correlated variables |
| Differential evolution | Difference vectors of the population | Simple, good global exploration | Sensitive to control parameters |
| Genetic algorithm | Encoded chromosomes with crossover | Flexible for discrete problems | Weak on continuous ill-conditioned functions |
| Particle swarm optimization | Particles with velocities | Fast early progress | Prone to premature convergence |
On standard benchmark suites such as COCO and BBOB, CMA-ES and its restart variants are consistently among the best general-purpose black-box optimizers for moderate budgets, although specialized surrogate-based methods can win when evaluations are extremely expensive.
Limitations and practical cautions
CMA-ES is powerful but not universal. Its main limitations concern dimension, budget and problem type, and they explain most disappointing results in practice.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Converges to a poor local optimum | Population too small for a multimodal landscape | Use IPOP or BIPOP restarts |
| Very slow progress at start | Initial step size far too small | Set sigma to about a third of the range |
| Excessive runtime per generation | Dimension in the thousands | Use separable or low-rank variants |
| Erratic behavior on noisy objective | Noise disturbs ranking | Increase population or use noise handling |
The method is also unsuitable for purely discrete or combinatorial problems without a continuous encoding, and when gradients are cheap and reliable, gradient-based optimizers are usually far more efficient.
The simple explanation
Imagine searching for the lowest point in a foggy valley. You throw a handful of stones around you. You see which ones land lowest. Then you move toward them.
CMA-ES does the same with numbers. It also learns which directions are promising. Over time, its throws stretch along the valley floor and shrink across it. It needs only scores, not slopes, so it works on problems where formulas are unknown.
How it is used in practice
A robotics team needs to tune 24 parameters of a walking controller for a four-legged robot in simulation. The objective is distance walked in ten seconds without falling, which is noisy and has no usable gradient. The team starts CMA-ES from hand-tuned values with an initial step size of 0.3 in normalized units and the default population of 13 candidates per generation.
After about 6,000 simulated trials, which run overnight on a workstation, the learned covariance reveals strong correlations between hip and knee timing parameters that manual tuning had missed. The resulting gait walks roughly 40 percent farther than the hand-tuned baseline. The team then uses IPOP restarts to check that no clearly better gait family exists before transferring the controller to the physical robot.