# Guided evolutionary strategies: escaping the curse of dimensionality in random search

## Authors

• 14 publications
• 14 publications
• 30 publications
• 51 publications
• ### Improving Gradient Estimation in Evolutionary Strategies With Past Descent Directions

Evolutionary Strategies (ES) are known to be an effective black-box opti...
10/11/2019 ∙ by Florian Meier, et al. ∙ 24

• ### Meta Reinforcement Learning with Distribution of Exploration Parameters Learned by Evolution Strategies

In this paper, we propose a novel meta-learning method in a reinforcemen...
12/29/2018 ∙ by Yiming Shen, et al. ∙ 0

06/18/2020 ∙ by Anton Dereventsov, et al. ∙ 0

Stein variational gradient decent (SVGD) has been shown to be a powerful...
06/07/2018 ∙ by Jun Han, et al. ∙ 0

• ### CoNES: Convex Natural Evolutionary Strategies

We present a novel algorithm – convex natural evolutionary strategies (C...
07/16/2020 ∙ by Sushant Veer, et al. ∙ 6

• ### Effective Reinforcement Learning through Evolutionary Surrogate-Assisted Prescription

There is now significant historical data available on decision making in...
02/13/2020 ∙ by Olivier Francon, et al. ∙ 9

• ### Truncated Back-propagation for Bilevel Optimization

Bilevel optimization has been recently revisited for designing and analy...
10/25/2018 ∙ by Amirreza Shaban, et al. ∙ 0

## Code Repositories

### guided-evolutionary-strategies

Guided Evolutionary Strategies

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Optimization in machine learning often involves minimizing a cost function where the gradient of the cost with respect to model parameters is known. When gradient information is available, first-order methods such as gradient descent are popular due to their ease of implementation, memory efficiency, and convergence guarantees (Sra et al., 2012). When gradient information is not available, however, we turn to zeroth-order optimization methods, including random search methods such as evolutionary strategies (Rechenberg, 1973; Nesterov & Spokoiny, 2011; Choromanski et al., 2018; Salimans et al., 2017).

However, what if only partial gradient information is available? That is, what if one has access to surrogate gradients that are correlated with the true gradient, but may be biased in some unknown fashion? Naïvely, there are two extremal approaches to optimization with surrogate gradients. On one hand, you could ignore the surrogate gradient information entirely and perform zeroth-order optimization, using methods such as evolutionary strategies to estimate a descent direction. These methods exhibit poor convergence properties when the parameter dimension is large (Duchi et al., 2015). On the other hand, you could directly feed the surrogate gradients to a first-order optimization algorithm. However, bias in the surrogate gradients will interfere with optimizing the target problem (Tucker et al., 2017)

. Ideally, we would like a method that combines the complementary strengths of these two approaches: we would like to combine the unbiased descent direction estimated with evolutionary strategies with the low-variance estimate given by the surrogate gradient. In this work, we propose a method for doing this called guided evolutionary strategies (Guided ES).

The critical assumption underlying Guided ES is that we have access to surrogate gradient information, but not the true gradient. This scenario arises in a wide variety of machine learning problems, which typically fall into two categories: cases where the true gradient is unknown or not defined, and cases where the true gradient is hard or expensive to compute. Examples of the former include: models with discrete stochastic variables (where straight through estimators (Bengio et al., 2013; van den Oord et al., 2017) or Concrete/Gumble-Softmax methods (Maddison et al., 2016; Jang et al., 2016) are commonly used) and learned models in reinforcement learning (e.g. for Q functions (Watkins & Dayan, 1992; Mnih et al., 2013, 2015; Lillicrap et al., 2015) or value estimation (Mnih et al., 2016)). For the latter, examples include optimization using truncated backprop through time (Rumelhart et al., 1985; Williams & Peng, 1990; Wu et al., 2018). Surrogate gradients also arise in situations where the gradients are explicitly modified during training, as in feedback alignment (Lillicrap et al., 2014) and related methods (Nøkland, 2016; Gilmer et al., 2017).

The key idea in Guided ES is to keep track of a low-dimensional subspace, defined by the recent history of surrogate gradients during optimization, which we call the guiding subspace. We then perform a finite difference random search (as in evolutionary strategies) preferentially within this subspace. By concentrating our search samples in a low-dimensional subspace where the true gradient has non-negative support, we dramatically reduce the variance of the search direction.

Our contributions in this work are:

• a new method for combining surrogate gradient information with random search,

• an analysis of the bias-variance tradeoff underlying the technique (§3.3),

• a scheme for choosing optimal hyperparameters for the method (§3.4), and

• applications to example problems (§4).

## 2 Related Work

This work builds upon a random search method known as evolutionary strategies (Rechenberg, 1973; Nesterov & Spokoiny, 2011), or ES for short, which generates a descent direction via finite differences over random perturbations of parameters. ES has seen a resurgence in popularity in recent years (Salimans et al., 2017; Mania et al., 2018; Ha, 2018; Ha & Schmidhuber, 2018; Houthooft et al., 2018; Cui et al., 2018). Our method can primarily be thought of as a modification to ES where we augment the search distribution using surrogate gradients.

Extensions of ES that modify the search distribution use natural gradient updates in the search distribution (Wierstra et al., 2008) or construct non-Gaussian search distributions (Glasmachers et al., 2010)

. The idea of using gradients in concert with evolutionary algorithms was proposed by

Lehman et al. (2017b), who use gradients of a network with respect to its inputs (as opposed to parameters) to augment ES. Other methods for adapting the search distribution include covariance matrix adaptation ES (CMA-ES) (Hansen, 2016), which uses the recent history of descent steps to adapt the distribution over parameters, or variational optimization (Staines & Barber, 2012)

, which optimizes the parameters of a probability distribution over model weights. Guided ES, by contrast, adapts the search distribution using surrogate gradient information. In addition, we never need to work with or compute a full

covariance matrix. Finally, Hansen (2011) proposes a modification to CMA-ES that accommodates external information by directly injecting candidate solutions into the algorithm. By contrast, the algorithm proposed here augments the search distribution itself.

## 3 Guided evolutionary strategies

### 3.1 Vanilla ES

We wish to minimize a function over a parameter space in -dimensions (), where is either unavailable or uninformative. A popular approach is to estimate a descent direction with stochastic finite differences (commonly referred to as evolutionary strategies (Rechenberg, 1973) or random search (Rastrigin, 1963)). Here, we use antithetic sampling (Owen, 2013) (using a pair of function evaluations at and ) to reduce variance. This estimator is defined as:

 g=β2σ2PP∑i=1ϵi(f(x+ϵi)−f(x−ϵi)), (1)

where , and is the number of sample pairs. We will set to one for all experiments, and when analyzing optimal hyperparameters. The overall scale of the estimate () and variance of the perturbations () are constants, to be chosen as hyperparameters. This estimate solely relies on computing function evaluations. However, it tends to have high variance, thus requiring a large number of samples to be practical, and scales poorly with the dimension . We refer to this estimator as vanilla evolutionary strategies (or vanilla ES) in subsequent sections.

### 3.2 Guided search

, either from prior knowledge or gleaned from previous iterates during optimization. To formalize this, we assume we are given a set of vectors which may correspond to biased or corrupted gradients. That is, these vectors are correlated (but need not be perfectly aligned) with the true gradient. If we are given a single vector or surrogate gradient for a given parameter iterate, we can generate a subspace by keeping track of the previous

surrogate gradients encountered during optimization. We use to denote an orthonormal basis for the subspace spanned by these vectors (i.e., ).

We leverage this information by changing the distribution of in eq. (1) to with

 Σ=αnIn+1−αkUUT,

where and are the subspace and parameter dimensions, respectively, and is a hyperparameter that trades off variance between the full parameter space and the subspace. Setting recovers the vanilla ES estimator (and ignores the guiding subspace), but as we show choosing can result in significantly improved performance. The other hyperparameter is the scale in (1), which controls the size of the estimated descent direction. The parameter controls the overall scale of the variance, and will drop out of the analysis of the bias and variance below, due to the factor in (1). In practice, if is stochastic, then increasing will dampen noise in the gradient estimate, while decreasing reduces the error induced by third and higher-order terms in the Taylor expansion of below. For an exploration of the effects of in ES, see Lehman et al. (2017a).

Samples of can be generated efficiently as where and . Our estimator requires 2 function evaluations in addition to the cost of computing the surrogate gradient. Furthermore, it may be possible to parallelize the forward pass computations.

Figure 1a depicts the geometry underlying our method. Instead of the true gradient (blue arrow), we are given a surrogate gradient (white arrow) which is correlated with the true gradient. We use this to form a guiding distribution (denoted with white contours) and use this to draw samples (white dots) which we use as part of a random search procedure. (Figure 1b demonstrates the performance of the method on a toy problem, and is discussed in §4.1.)

For the purposes of analysis, suppose exists. We can approximate the function in the local neighborhood of using a second order Taylor approximation: . For the remainder of §3, we take this second order Taylor expansion to be exact. By substituting this expression into (1), we see that our estimate is equal to

 g =βσ2PP∑i=1(ϵiϵTi)∇f(x). (2)

Note that even terms in the expansion cancel out in the expression for due to antithetic sampling.

Importantly, regardless of the choice of and , the Guided ES estimator always provides a descent direction in expectation. The mean of the estimator in eq. (2) is which corresponds to the gradient multiplied by a positive semi-definite (PSD) matrix, thus the update remains a descent direction. This desirable property ensures that trades off variance for “safe” bias. That is, the bias will never produce an ascent direction when we are trying to minimize .

Algorithm 1 provides pseudocode for guided evolutionary strategies. Note that computation of the loss at the perturbed parameters (the inner loop) may be done in parallel. The computational and memory costs of using Guided ES to compute parameter updates, compared to standard (vanilla) ES and gradient descent, are outlined in Appendix D.

### 3.3 Tradeoff between variance and safe bias

As we have alluded to, there is a bias-variance tradeoff lurking within our estimate . In particular, by emphasizing the search in the full space (i.e., choosing close to 1), we reduce the bias in our estimate at the cost of increased variance. Emphasizing the search along the guiding subspace (i.e., choosing close to 0) will induce a bias in exchange for a potentially large reduction in variance, especially if the subspace dimension is small relative to the parameter dimension . Below, we analytically and numerically characterize this tradeoff.

The alignment between the -dimensional orthonormal guiding subspace () and the true gradient () is a key quantity for understanding the bias-variance tradeoff. We characterize this alignment using a -dimensional vector of uncentered correlation coefficients , whose elements are the correlation between the gradient and every column of . That is, . This correlation varies between zero (if the gradient is orthogonal to the subspace) and one (if the gradient is fully contained in the subspace).

We define the normalized bias of the Guided ES gradient estimate as (see Appendix A.1):

 ~b =(βαn−1)2+(β2(1−α)2k2+2β(1−α)k(βαn−1))∥ρ∥22 (3)

where again is a scale factor and is part of the parameterization of the covariance matrix that trades off variance in the full parameter space for variance in the guiding subspace (). We see that the normalized squared bias consists of two terms: the first is a contribution from the search in the full space and is thus independent of , whereas the second depends on the squared norm of the uncentered correlation, .

Similarly, we can compute the normalized variance as (see Appendix A.2):

 ~v =β2(α2n2+αn)+β2((1−α)2k2+2α(1−α)kn+(1−α)k)∥ρ∥22. (4)

Equations (3) and (4) quantify the bias and variance of our estimate as a function of the subspace and parameter dimensions ( and ), the parameters of the distribution ( and ), and the correlation . Note that for simplicity we have set the number of pairs of function evaluations, , to one. As increases, the variance will decrease linearly, at the cost of extra function evaluations.

### 3.4 Choosing optimal hyperparameters by minimizing error in the estimate

The expressions for the normalized bias and variance depend on the subspace and parameter dimensions ( and , respectively), the hyperparameters of the guiding distribution ( and ) and the uncentered correlation between the true gradient and the subspace (). All of these quantities except for the correlation are known or defined in advance.

To choose optimal hyperparameters, we minimize the sum of the normalized bias and variance, (equivalent to the expected normalized squared error in the gradient estimate, ). This objective becomes:

 ~b+~v= (5) [2β2α2n2+(β2−2β)αn+1]+[2β2(1−α)2k2+4β2α(1−α)kn+(β2−2β)(1−α)k]∥ρ∥22,

subject to the feasibility constraints and .

As further motivation for this hyperparameter objective, in the simple case that then minimizing eq. (3.4) also results in the hyperparameters that cause SGD to most rapidly descend . See Appendix C for a derivation of this relationship.

We can solve for the optimal tradeoff () and scale () hyperparameters as a function of , , and . Figure 3a shows the optimal value for the tradeoff hyperparameter () in the 2D plane spanned by the correlation () and ratio of the subspace dimension to the parameter dimension . Remarkably, we see that for large regions of the plane, the optimal value for is either 0 or 1. In the upper left (blue) region, the subspace is of high quality (highly correlated with the true gradient) and small relative to the full space, so the optimal solution is to place all of the weight in the subspace, setting to zero (therefore ). In the bottom right (orange) region, we have the opposite scenario, where the subspace is large and low-quality, thus the optimal solution is to place all of the weight in the full space, setting to one (equivalent to vanilla ES, ). The strip in the middle is an intermediate regime where the optimal is between 0 and 1.

We can also derive an expression for when this transition in optimal hyperparameters occurs. To do this, we use the reparameterization . This allows us to express the objective in (3.4) as a least squares problem , subject to a non-negativity constraint (), where and depend solely on the problem data , , and (see Appendix B.1 for details). In addition, is always a positive semi-definite matrix, so the reparameterized problem is convex. We are particularly interested in the point where the non-negativity constraint becomes tight. Formulating the Lagrange dual of this problem and solving for the KKT conditions allows us to identify this point using the complementary slackness conditions (Boyd & Vandenberghe, 2004). This yields the equations and (see Appendix B.2), which are shown in Figure 2a, and line up with the numerical solution. Figure 2b further demonstrates this tradeoff. For fixed , we plot four curves for ranging from 1 to 30. As increases, the optimal hyperparameters sweep out a curve from to .

In practice, the correlation between the gradient and the guiding subspace is typically unknown. However, we find that ignoring and setting and works well (these are the values used for all experiments in this paper). A direction for future work would be to estimate the correlation online, and to use this to choose hyperparameters by minimizing eq. (3.4).

## 4 Applications

We first test our method on a toy problem where we control the bias of the surrogate gradient explicitly. We generated random quadratic problems of the form where the entries of and

were drawn independently from a standard normal distribution, but rather than allow the optimizers to use the true gradient, we (for illustrative purposes) added a random bias to generate surrogate gradients. Figure

1

b compares the performance of stochastic gradient descent (SGD) with standard (vanilla) evolutionary strategies (ES), CMA-ES, and Guided ES. For this, and all of the results in this paper, we set the hyperparameters as

and , as described above.

We see that Guided ES proceeds in two phases: it initially quickly descends the loss as it follows the biased gradient, and then transitions into random search. Vanilla ES and CMA-ES, however, do not get to take advantage of the information available in the surrogate gradient, and converge more slowly. We see this also in the plot of the uncentered correlation () between the true gradient and the surrogate gradient in Figure 1c. Further experimental details are provided in Appendix E.1. This is exactly the transition discussed in §3.4, where as varies we move from the regime where we want to only search in the subspace to the regime where we want to ignore the subspace (diagrammed in Figure 2a). Although we know in this case, we find the practical choice of fixing the hyperparameters (discussed in §3.4) independently of works well.

### 4.2 Unrolled optimization

Another application where surrogate gradients are available is in unrolled optimization. Unrolled optimization refers to taking derivatives through an optimization process. For example, this approach has been used to optimize hyperparameters (Domke, 2012; Maclaurin et al., 2015; Baydin et al., 2017), to stabilize training (Metz et al., 2016)

, and even to train neural networks to act as optimizers

(Andrychowicz et al., 2016; Wichrowska et al., 2017; Li & Malik, 2017; Lv et al., 2017). Taking derivatives through optimization with a large number of steps is costly, so a common approach is to instead choose a small number of unrolled steps, and use that as a target for training. However, Wu et al. (2018) recently showed that this approach yields biased gradients.

To demonstrate the utility of Guided ES here, we trained multi-layer perceptrons (MLP) to predict the learning rate for a target problem, using as input the eigenvalues of the Hessian at the current iterate. Figure 3a shows the bias induced by unrolled optimization, as the number of optimization steps ranges from one iteration (orange) to 15 (blue). We compute the surrogate gradient of the parameters in the MLP using the loss after one SGD step. Figure 3b, we show the absolute value of the difference between the optimal learning rate and the MLP prediction for different optimization algorithms. Further experimental details are provided in Appendix E.2.

### 4.3 Synthesizing gradients for a guiding subspace

Next, we explore using Guided ES in the scenario where the surrogate gradient is not provided, but instead we train a model to generate surrogate gradients (we call these synthetic gradients). In real-world applications, training a model to produce synthetic gradients is the basis of model-based and actor-critic methods in RL (Lillicrap et al., 2015; Heess et al., 2015) and has been applied to decouple training across neural network layers (Jaderberg et al., 2016) and to generate policy gradients (Houthooft et al., 2018). A key challenge with such an approach is that early in training, the model generating the synthetic gradients is untrained, and thus will produce biased gradients. In general, it is unclear during training when following these synthetic gradients will be beneficial.

We define a parametric model,

(an MLP), which provides synthetic gradients for the target problem . The target model is trained online to minimize mean squared error against evaluations of . Figure 4 compares vanilla ES, Guided ES, and the Adam optimizer (Kingma & Ba, 2014). We show training curves for these methods in Figure 4a, and the correlation between the synthetic gradient and true gradients for Guided ES in Figure 4b. Despite the fact that the quality of the synthetic gradients varies wildly during optimization, Guided ES consistently makes progress on the target problem. Further experimental details are provided in Appendix E.3.

## 5 Discussion

We have introduced guided evolutionary strategies (Guided ES), an optimization algorithm which combines the benefits of first-order methods and random search, when we have access to surrogate gradients that are correlated with the true gradient. We analyzed the bias-variance tradeoff inherent in our method analytically, and demonstrated the generality of the technique by applying it to unrolled optimization, synthetic gradients, and training neural networks with discrete variables.

#### Acknowledgements

The authors would like to thank Alex Alemi and Ben Poole for discussions, and Roy Frostig, Katherine Lee, Benjamin Eysenbach, and Brian Cheung for comments on the manuscript.

## Appendix A Derivation of the bias and variance of the Guided ES update

### a.1 Bias

We can evaluate the squared norm of the bias of our estimate as

 ∥Bias(g)∥22 =(E[g]−∇f(x))T(E[g]−∇f(x)) =∇f(x)T(βΣ−I)2∇f(x). (6)

We additionally define the normalized squared bias, , as the squared norm of the bias divided by the squared norm of the true gradient (this quantity is independent of the overall scale of the gradient).

 ∥E[g]−∇f(x)∥22 =∇f(x)T(βΣ−I)2∇f(x),

where and the covariance is given by: . This expression reduces to (recall that is orthonormal, so ):

 ∥Bias∥22 =∥∇f(x)∥22[β2α2n2−2βαn+1+(β2(1−α)2k2+2β2α(1−α)kn−2β1−αk)∥ρ∥22]
 ~b =(βαn−1)2+(β2(1−α)2k2+2β(1−α)k(βαn−1))∥ρ∥22 (7)

where again is a scale factor and is part of the parameterization of the covariance matrix that trades off variance in the full parameter space for variance in the guiding subspace (). We see that the normalized squared bias consists of two terms: the first is a contribution from the search in the full space and is thus independent of , whereas the second depends on the squared norm of the uncentered correlation, .

### a.2 Variance

In addition to the bias, we are also interested in the variance of our estimate. First, we state a useful identity. Suppose , then

 E[ϵϵTϵϵT]=tr(Σ)Σ+2Σ2.

We can see this by observing that the entry of is

 E[∑jϵiϵ2jϵk] =∑jE[ϵiϵ2jϵk] =∑jE[ϵ2j]E[ϵiϵk]+2∑jE[ϵiϵj]E[ϵjϵk],

by Isserlis’ theorem, and then we recover the identity by rewriting the terms in matrix notation.

We use total variance (i.e., ) to quantify the variance of our estimator:

 total variance≡tr(Var(g)) =tr(E[ggT]−E[g]E[g]T)=E[gTg]−E[g]TE[g] =β2∇f(x)TE[ϵϵTϵϵT]∇f(x)−β2∇f(x)TΣTΣ∇f(x)

Using the identity above, we can express the total variance as:

 total variance =β2∇f(x)T(tr(Σ)Σ+2Σ2)∇f(x)−β2∇f(x)TΣ2∇f(x) =β2∇f(x)T(tr(Σ)Σ+Σ2)∇f(x)

Since the trace of the covariance matrix is 1, we can expand the quantity as:

 tr(Σ)Σ+Σ2 =Σ+Σ2 =[α2n2+αn]I+[(1−α)2k2+2α(1−α)kn+1−αk]UUT

Thus the expression for the total variance reduces to:

 total variance =∥∇f(x)∥22β2(α2n2+αn+[(1−α)2k2+2α(1−α)kn+1−αk]∥ρ∥22),

and dividing by the norm of the gradient yields the expression for the normalized variance (eq. (4) in the main text).

Figure 5 explores the tradeoff between normalized bias and variance for different settings of the relevant hyperparameters ( and ) for example values of , , and . Figure 5c shows the sum of the normalized bias plus variance, the global minimum of which (blue star) can be used to choose optimal values for the hyperparameters, discussed in the next section.

## Appendix B Optimal hyperparameters

### b.1 Reparameterization

We wish to minimize the sum of the normalized bias and variance, eq. (3.4) in the main text. First, we use a reparameterization by using the substitution and . This substitution yields:

 ~b+~v=[2θ21n2+(θ0+θ1−2)θ0n+1]+[2θ22k2+4θ0θ1kn+(θ0+θ1−2)θ1k]∥ρ∥22,

which is quadratic in . Therefore, we can rewrite the problem as: , where and are given by:

 A=⎛⎜ ⎜ ⎜⎝2n2+1n12(4∥ρ∥22kn+∥ρ∥22k+1n)12(4∥ρ∥22kn+∥ρ∥22k+1n)(2k2+1k)∥ρ∥22⎞⎟ ⎟ ⎟⎠,b=⎛⎜⎝1n∥ρ∥22k⎞⎟⎠ (8)

Note that and depend on the problem data (, , and ), and that is a positive semi-definite matrix (as and are non-negative integers, and is between 0 and 1). In addition, we can express the constraints on the original parameters ( and ) as a non-negativity constraint in the new parameters ().

### b.2 KKT conditions

The optimal hyperparameters are defined (see main text) as the solution to the minimization problem:

 minimizeθ12∥Aθ−b∥22subject toθ⪰0 (9)

where are the hyperparameters to optimize, and and are specified in eq. (8).

The Lagrangian for (9) is given by , and the corresponding dual problem is:

 maximizeλinfθ12∥Aθ−b∥22−λTθsubject toλ⪰0 (10)

Since the primal is convex, we have strong duality and the Karush-Kuhn-Tucker (KKT) conditions guarantee primal and dual optimality. These conditions include primal and dual feasibility, that the gradient of the Lagrangian vanishes (), and complimentary slackness (which ensures that for each inequality constraint, either the constraint is satisfied or = 0).

Solving the condition on the gradient of the Langrangian for yields that the lagrange multipliers are simply the residual . Complimentary slackness tells us that , for all . We are interested in when this constraint becomes tight. To solve for this, we note that there are two regimes where each of the two inequality constraints is tight (the blue and orange regions in Figure 2a). These occur for the solutions (when the first inequality is tight) and (when the second inequality is tight). To solve for the transition point, we solve for the point where the constraint is tight and the lagrange multiplier () equals zero. We have two inequality constraints, and thus will have two solutions (which are the two solid curves in Figure 2a). Since the lagrange multiplier is the residual, these points occur when and .

The first solution yields the upper bound:

 (Aθ(1))1−b1 =0 12(1n+∥ρ∥22k+4∥ρ∥22kn)(kk+2) =1n ∥ρ∥22(n+4n) =k+4n ∥ρ∥2 =√k+4n+4

And the second solution yields the lower bound:

 (Aθ(2))2−b2 =0 12(1n+∥ρ∥22k+4∥ρ∥22kn)(nn+2) =∥ρ∥22k k+n∥ρ∥22+4∥ρ∥22 =∥ρ∥22(2n+4) ∥ρ∥2 =√kn

These are the equations for the lines separating the regimes of optimal hyperparameters in Figure 2.

## Appendix C Alternative motivation for optimal hyperparameters

Choosing hyperparameters which most rapidly descend the simple quadratic loss in eq. (11) is equivalent to choosing hyperparameters which minimize the expected square error in the estimated gradient, as is done in §3.4. This provides further support for the method used to choose hyperparameters in the main text. Here we derive this equivalence.

Assume a loss function of the form

 f(x) =12∥x∥22, (11)

and that updates are performed via gradient descent with learning rate 1,

 x ←x−g.

The expected loss after a single training step is then

 Eg[f(x−g)] =12Eg[∥x−g∥22]. (12)

For this problem, the true gradient is simply . Substituting this into eq. (12), we find

 Eg[f(x−g)] =12Eg[∥∇f(x)−g∥22].

Up to a multiplicative constant, this is exactly the expected square error between the descent direction and the gradient used as the objective for choosing hyperparameters in §3.4.

## Appendix D Computational and memory cost

Here, we outline the computational and memory costs of Guided ES and compare them to standard (vanilla) evolutionary strategies and gradient descent. As elsewhere in the paper, we define the parameter dimension as and the number of pairs of function evaluations (for evolutionary strategies) as . We denote the cost of computing the full loss as , and (for Guided ES and gradient descent), we assume that at every iteration we compute a surrogate gradient which has cost . Note that for standard training of neural networks with backpropogation, these quantities have similar cost (), however for some applications (such as unrolled optimization discussed in §4.2) these can be very different.

## Appendix E Experimental details

Below, we give detailed methods used for each of the experiments from §4. For each problem, we specify a desired loss function that we would like to minimize (), as well as specify the method for generating a surrogate or approximate gradient ().

Our target problem is linear regression,

, where is a random matrix and is a random -dimensional vector. The elements of and were drawn IID from a standard Normal distribution. We chose and for this problem. The surrogate gradient was generated by adding a random bias (drawn once at the beginning of optimization) and noise (resampled at every iteration) to the gradient. These quantities were scaled to have the same norm as the gradient. Thus, the surrogate gradient is given by: , where and are unit norm random vectors that are fixed (bias) or resampled (noise) at every iteration.

The plots in Figure 1b show the loss suboptimality (), where is the minimum of for a particular realization of the problem. The parameters were initialized to the zeros vector and optimized for 10,000 iterations. Figure 1b shows the mean and spread (std. error) over 10 random seeds. For each optimization algorithm, we performed a coarse grid search over the learning rate for each method, scanning 17 logarithmically spaced values over the range . The learning rates chosen were: 5e-3 for gradient descent, 0.2 for guided and vanilla ES, and 1.0 for CMA-ES. For the two evolutionary strategies algorithms, we set the overall variance of the perturbations as and used pair of samples per iteration. The subspace dimension for Guided ES was set to . The results were not sensitive to the choices for , , or .

### e.2 Unrolled optimization

We define the target problem as the loss of a quadratic after running steps of gradient descent. The quadratic has the same form as described above, , but with and

. The learning rate for the optimizer was taken as the output of a multilayer perceptron (MLP), with three hidden layers containing 32 hidden units per layer and with rectified linear (ReLU) activations after each hidden layer. The inputs to the MLP were the 10 eigenvalues of the Hessian,

, and the output was a single scalar that was passed through a softplus nonlinearity (to ensure a positive learning rate). Note that the optimal learning rate for this problem is , where and are the minimum and maximum eigenvalues of , respectively.

The surrogate gradients for this problem were generated by backpropagation through the optimization process, but by unrolling only

optimization steps (truncated backprop). Figure 3b shows the distance between the MLP predicted learning rate and the optimal learning rate , during the course of optimization of the MLP parameters. That is, Figure 3b shows the progress on the meta-optimization problems (optimizing the MLP to predict the learning rate) using the three different algorithms (SGD, vanilla ES, and guided ES).

As before, the mean and spread (std. error) over 10 random seeds are shown, and the learning rate for each of the three methods was chosen by a grid search over the range . The learning rates chosen were 0.3 for gradient descent, 0.5 for guided ES, and 10 for vanilla ES. For the two evolutionary strategies algorithms, we set the variance of the perturbations to and used pair of samples per iteration. The results were not sensitive to the choices for , , or .

### e.3 Synthesizing gradients for a guiding subspace

Here, the target problem consisted of a mean squared error objective, , where

was random sampled from a uniform distribution between [-1, 1]. The surrogate gradient was defined as the gradient of a model,

, with inputs and parameters . We parameterize this model using a multilayered perceptron (MLP) with two 64-unit hidden layers and relu activations. The surrogate gradients were taken as the gradients of with respect to : .

The model was optimized online during optimization of by minimizing the mean squared error with the (true) function observations: . The data used to train were randomly sampled in batches of size 512 from the most recent 8192 function evaluations encountered during optimization. This is equivalent to uniformly sampling from a replay buffer, a strategy commonly used in reinforcement learning. We performed one update per update with Adam with a learning rate of 1e-4.

The two evolutionary strategies algorithms inherently generate samples of the function during optimization. In order to make a fair comparison when optimizing with the Adam baseline, we similarly generated function evaluations for training the model by sampling points around the current iterate from the same distribution used in vanilla ES (Normal with ). This ensures that the amount and spread of training data for (in the replay buffer) when optimizing with Adam is similar to the data in the replay buffer when training with vanilla or guided ES.

Figure 4

a shows the mean and spread (standard deviation) of the performance of the three algorithms over 10 random instances of the problem. We set

and used pair of samples per iteration. For Guided ES, we used a subspace dimension of . The results were not sensitive to the number of samples , but did vary with , as this controls the spread of the data used to train , thus we tuned with a coarse grid search.

### e.4 Autoencoders with discrete latent variables

We trained a vector quantized variational autoencoder (VQ-VAE) as defined in

van den Oord et al. (2017) on MNIST. Our encoder and decoder networks were both fully connected neural networks with 64 hidden units per layer and ReLU nonlinearities. For the vector quantization, we used a small codebook (twelve codebook vectors). The dimensionality of the codebook and latent variables was 16, and we used 10 latent variables. To train the encoder weights, van den Oord et al. (2017) proposed using a straight through estimator Bengio et al. (2013) to bypass the discretization in the vector quantizer. Here, we use this as the surrogate gradient passed to Guided ES. Since the gradients are correct (unbiased) for the decoder and embedding weights, we do not use Guided ES on those variables, instead using first-order methods (Adam) directly. For training with vanilla ES or Guided ES, we used pairs of function evaluations per iteration to reduce variance (note that these can be done in parallel).