Bayesian Generational Population-Based Training
Abstract Reinforcement learning (RL) offers the potential for training generally capable agents that can interact autonomously in the real world.
However, one key limitation is the brittleness of RL algorithms to core hyperparameters and network architecture choice.
Furthermore, non-stationarities such as evolving training data and increased agent complexity mean that different hyperparameters and architectures may be optimal at different points of training.
This motivates AutoRL, a class of methods seeking to automate these design choices.
One prominent class of AutoRL methods is Population-Based Training (PBT), which have led to impressive performance in several large scale settings.
In this paper, we introduce two new innovations in PBT-style methods.
First, we employ trust-region based Bayesian Optimization, enabling full coverage of the high-dimensional mixed hyperparameter search space.
Second, we show that using a generational approach, we can also learn both architectures and hyperparameters jointly on-the-fly in a single training run.
Leveraging the new highly parallelizable Brax physics engine, we show that these innovations lead to large performance gains, significantly outperforming the tuned baseline while learning entire configurations on the fly. Code is available at https://github.com/xingchenwan/bgpbt .
1 Introduction
Reinforcement Learning (rl) (Sutton and Barto, 2018) has proven to be a successful paradigm for training agents across a variety of domains and tasks (Kalashnikov et al., 2018;
Mnih et al., 2013;
Nguyen et al., 2021b; Silver et al., 2017), with some believing it could be enough for training generally capable agents (Silver et al., 2021).
However, a crucial factor limiting the wider applicability of rl to new problems is the notorious sensitivity of algorithms with respect to their hyperparameters (Andrychowicz et al., 2021;
Engstrom et al., 2020; Henderson et al., 2018), which often require expensive tuning.
Indeed, it has been shown that when tuned effectively, good configurations often lead to dramatically improved performance in large scale settings (Chen et al., 2018).
To address these challenges, recent work in Automated Reinforcement Learning (AutoRL) (ParkerHolder et al., 2022) has shown that rigorously searching these parameter spaces can lead to previously unseen levels of performance, even capable of breaking widely used simulators (Zhang et al., 2021).
However, AutoRL contains unique challenges, as different tasks even in the same suite are often best solved with different network architectures and hyperparameters (Furuta et al., 2021; Xu et al., 2022).
Furthermore, due to the non-stationarities present in rl (Igl et al., 2021), such as changing data distributions and the requirement for agents to model increasingly complex behaviors over time, optimal hyperparameters and architectures may not remain constant.
To address this, works have shown adapting hyperparameters through time (Jaderberg et al., 2017;
Parker-Holder et al., 2021; Paul et al., 2019; Zhang et al., 2021) and defining fixed network architecture schedules (Czarnecki et al., 2018) can be beneficial for performance.
However, architectures and hyperparameters are inherently linked (Park et al., 2019), and to date, no method combines the ability to jointly and continuously adapt both on the fly.
In this paper we focus on Population-based Training (pbt) (Jaderberg et al., 2017) methods, where a population of agents is trained in parallel, copying across stronger weights and enabling
[Figure]
adaption of hyperparameters in a single training run. This allows pbt methods to achieve impressive performance on many large-scale settings (Jaderberg et al., 2019; Liu et al., 2021). However, pbt-style methods are typically limited in scope due to two key factors: 1) they only optimize a handful of hyperparameters, either due to using random search (Jaderberg et al., 2017), or model-based methods that do not scale to higher dimensions (Parker-Holder et al., 2021, 2020); 2) pbt methods are usually restricted to the same fixed architecture since weights are copied between agents.
We seek to overcome both of these issues in this paper, and propose Bayesian Generational
Population-based Training (bg-pbt) , with an example run demonstrated in Fig.
bg-pbt is capable of tuning a significantly greater proportion of the agent’s configuration, thanks to two new ideas.
First, we introduce a new model-based hyperparameter and architecture exploration step motivated by recent advances in local Bayesian optimization (Wan et al., 2021).
Second, we take inspiration from
Stooke et al.
(2021) who showed that pbt can be particularly effective when combined with network distillation (Igl et al., 2021), in an approach known as generational learning.
As prior works in generational training (Stooke et al., 2021; Vinyals et al., 2019) show, the use of successive generations of architectures with distillation results in significantly reduced training time for new agents.
This provides us with an algorithm-agnostic framework to create agents which continuously discover their entire configuration .
Thus, for the first time, we can tune hyperparameters and architectures during one training run as part of a single unified algorithm.
We run a series of exhaustive experiments tuning both the architectures and hyperparameters for a Proximal Policy Optimization (ppo) (Schulman et al., 2017) agent in the newly introduced Brax environment suite (Freeman et al., 2021).
Brax enables massively parallel simulation of agents, making it perfect for testing population-based methods without vast computational resources.
Our agents significantly outperform both the tuned baseline and a series of prior pbt methods.
Notably, we observe that bg-pbt often discovers a schedule of networks during training—which would be infeasible to train from scratch.
Furthermore, bg-pbt discovers entirely new modes of behavior for these representative environments, which we show at https://sites.google.com/view/bgpbt .
To summarize, the main contributions of this paper are as follows:
We show for the first time it is possible to select architectures as part of a general-purpose pbt framework, using generational training with policy distillation with Neural Architecture Search (nas).
We propose a novel and efficient algorithm, bg-pbt , especially designed for high-dimensional mixed search spaces, which can select both architectures and hyperparameters on-the-fly with provable efficiency guarantees.
We show in a series of experiments our automatic architecture curricula make it possible to achieve significantly higher performance than previous methods.
2 Preliminaries
We begin by introducing the reinforcement learning framework, population-based training, which our method is based on, and the general problem setup we investigate in this paper.
Reinforcement Learning.
We model the environment as a Markov Decision Process (mdp) (Sutton and Barto, 2018), defined as a tuple 𝑀 =
( S , A , 𝑃, 𝑅, 𝜌 0 ,𝛾 ) , where S and A denote the state and action spaces respectively, 𝑃 ( 𝑠 𝑡 + 1 | 𝑠 𝑡 , 𝑎 𝑡 ) the transition dynamics, 𝑅 ( 𝑠 𝑡 , 𝑎 𝑡 ) the reward function, 𝜌
the initial state distribution, and 𝛾 ∈ ( 0 , 1 ) the discount factor.
The goal is to optimize a policy 𝜋 ( 𝑎 𝑡 | 𝑠 𝑡 ) that maximizes the expected discounted return E 𝜋,𝑃,𝜌 0 (cid:2)(cid:205) ∞ 𝑡 =
𝛾 𝑡 𝑅 ( 𝑠 𝑡 , 𝑎 𝑡 ) (cid:3) .
Given a policy 𝜋 , we may define the state value function 𝑉 𝜋 ( 𝑠 ) =
E 𝜋,𝑃 (cid:2)(cid:205) ∞
𝑡 =
𝛾 𝑡 𝑅 ( 𝑠 𝑡 , 𝑎 𝑡 )| 𝑠
= 𝑠 (cid:3) and the state-action value-function 𝑄 𝜋
( 𝑠, 𝑎 ) =
E 𝜋,𝑃 (cid:2)(cid:205) ∞
𝑡 =
𝛾 𝑡 𝑅 ( 𝑠 𝑡 , 𝑎 𝑡 )| 𝑠
= 𝑠, 𝑎 0 = 𝑎 (cid:3) .
The advantage function is then defined as the difference 𝐴
𝜋
( 𝑠, 𝑎 ) = 𝑄 𝜋 ( 𝑠, 𝑎 ) − 𝑉 𝜋 ( 𝑠 ) .
A popular algorithm for online continuous control that we use is ppo (Schulman et al., 2017).
ppo achieves state-of-the-art results for popular benchmarks (Cobbe et al., 2020) and is hugely parallelizable, making it an ideal candidate for population-based methods (Parker-Holder et al., 2020).
ppo approximates trpo (Schulman et al., 2015, 2017) and uses a clipped objective to stabilize training: L PPO [Equation] = min
[Equation]
𝜋 𝜇 (cid:19) , where 𝑔 ( 𝜃, 𝜇 ) = clip (cid:18) 𝜋 𝜃 ( 𝑎 | 𝑠 ) 𝜋 𝜇 ( 𝑎
[Equation]
𝜖 (cid:19) (1) where 𝜋 𝜇 is a previous policy and 𝜖 is the clipping parameter.
Population-Based Training.
rl algorithms, including ppo, are typically quite sensitive to their hyperparameters.
pbt (Jaderberg et al., 2017) is an evolutionary method that tunes rl hyperparameters on-the-fly.
It optimizes a population of 𝐵 agents in parallel, so that their weights and hyperparameters may be dynamically adapted within a single training run.
In the standard paradigm without architecture search, we consider two sub-routines, explore and exploit.
We train for a total of 𝑇 steps and evaluate performance every 𝑡 ready < 𝑇 steps.
In the exploit step, the weights of the worst-performing agents are replaced by those from an agent randomly sampled from the set of best-performing ones, via truncation selection .
To select new hyperparameters, we perform the explore step.
We denote the hyperparameters for the 𝑏 th agent in a population at timestep 𝑡 as z 𝑏𝑡 ∈ Z ; this defines a schedule of hyperparameters over time (cid:0) 𝑧 𝑏𝑡 (cid:1) 𝑡
= 1 ,...𝑇 .
Let 𝑓 𝑡 ( 𝑧 𝑡 ) be an objective function (e.g. the return of a rl agent) under a given set of hyperparameters at timestep 𝑡 , our goal is to maximize the final performance 𝑓 𝑇 ( 𝑧 𝑇 ) .
The original pbt uses a combination of random sampling and evolutionary search for the explore step by suggesting new hyperparameters mutated from the best-performing agents.
Population
Based Bandit (pb2) and pb2-Mix (Parker-Holder et al., 2021, 2020) improve on pbt by using Bayesian optimization (bo) to suggest new hyperparameters, relying on a time-varying Gaussian Process (gp) (Bogunovic et al., 2016; Rasmussen and Williams, 2006) to model the data observed.
We will also use gp-based bo in our method, and we include a primer of gps and bo in App. A.
Problem Setup.
We follow the notation used in Parker-Holder et al.
and frame the hyperparameter optimization problem in the lens of optimizing an expensive, time-varying, blackbox reward function 𝑓 𝑡 : Z → R .
Every 𝑡 ready steps, we observe and record noisy observations, 𝑦 𝑡 = 𝑓 𝑡 ( z 𝑡 ) + 𝜖 𝑡 , where 𝜖 𝑡 ∼ N ( 0 , 𝜎 2 I ) for some fixed variance 𝜎 2 .
We follow the typical pbt setup by defining a hyperparameter space, Z , which for the Brax (Freeman et al., 2021) implementation of ppo we follow in the paper, consists of 9 parameters: learning rate, discount factor ( 𝛾 ), entropy coefficient ( 𝑐 ), unroll length, reward scaling, batch size, updates per epoch, GAE parameter ( 𝜆 ) and clipping parameter ( 𝜖 ).
To incorporate the architecture hyperparameters, y ∈ Y , we addadditional parameters leading to a 15-dimensional joint space J
= Y × Z .
For both the policy and value networks, we add the width and depth of the Multi-layer Perceptron (mlp) and a binary flag on whether to use spectral normalization.
3 Bayesian Generational Population-Based Training (BG-PBT)
1: Input 𝐵 𝑡 data Create
Distill from a top 𝑞 % performing agent of the existing generation to new agents 13: else 14: Select new hyperparameters z for the agents whose weights have been just replaced with randomly sampled configs (if D = ∅ ) OR using the suggestions from the bo agent described conditioned on y (otherwise). We present bg-pbt in Algorithm 1 which consists of two major components.
First, a bo approach to select new hyperparameter configurations z for our agents (§3.1).
We then extend the search space to accommodate architecture search, allowing agents to choose their own networks (parameterized by y ∈ Y ) and use onpolicy distillation to transfer between different architectures (§3.2).
3.1 High-Dimensional BO Agents in Mixed-Input Configuration Space for PBT
Existing population-based methods ignore (pb2) or only partially address (pb2-Mix, which does not consider ordinal variables such as integers) the heterogeneous nature of the mixed hyperparameter space Z .
Furthermore, both previous methods are equipped with standard gp surrogates which typically scale poorly beyond lowdimensional search spaces, and are thus only used to tune a few selected hyperparameters deemed to be the most important based on human expertise.
To address these issues, bg-pbt explicitly accounts for the characteristics of typical rl hyperparameter search space by making several novel extensions to Casmopolitan (Wan et al., 2021), a state-of-the-art bo method for high-dimensional, mixed-input problems for our setting.
In this section, we outline the main elements of our design, and we refer the reader to App.
B.2 for full technical details of the approach.
Tailored Treatment of Mixed Hyperparameter Types.
Hyperparameters in rl can be continuous (e.g. discounting factor), ordinal (discrete variables with ordering, e.g. batch size) and categorical (discrete variables without ordering, e.g. activation function).
bg-pbt treats each variable type differently: we use tailored kernels for the gp surrogate, and utilize interleaved optimization for the acquisition function, alternating between local search for the categorical/ordinal variables and gradient descent for the continuous variables.
bg-pbt extends both Casmopolitan and pb2-Mix by further accommodating ordinal variables, as both previous works only considered continuous and categorical variables. We demonstrate the considerable benefits of explicitly accounting for the ordinal variables in App. F.6.
Trust Regions (tr).
trs have proven success in extending gp-based bo to higher-dimensional search spaces, which were previously intractable due to the curse of dimensionality, by limiting exploration to promising regions in the search space based on past observations (Eriksson et al., 2019; Wan et al., 2021).
In the pbt context, trs also implicitly avoid large jumps in hyperparameters, which improves training stability.
We adapt the trs used in the original Casmopolitan to the time-varying setup by defining trs around the current best configuration, and then adjusting them [Figure] [Figure] ×
[Figure]
dynamically: similar to Eriksson et al.
and Wan et al.
(2021), trs are expanded or shrunk upon consecutive “successes” or “failures”.
We define a proposed configuration to be a “success” if it appears in the top 𝑞 %-performing agents and a “failure” otherwise.
When the trs shrink below some specified minimum, a restart is triggered, which resets the gp surrogate to avoid becoming stuck at a local optimum.
We adapt the Upper Confidence Bound (ucb)-based criterion proposed in Wan et al.
(2021) which is based on a global, auxiliary gp model to the time-varying setting to re-initialize the population when a restart is triggered.
Full details are provided in App.
B.4.
Theoretical Properties.
Following Wan et al.
, we show that under typical assumptions (presented in App.
C) used for tr-based algorithms (Yuan, 1999), our proposed bg-pbt, without architecture and distillation to be introduced in §3.2, converges to the global optimum asymptotically.
Furthermore, we derive an upper bound on the cumulative regret and show that under certain conditions it achieves sublinear regret.
We split the search space into Z =
[ H , X ] (categorical/continuous parts respectively).
We note that Assumption C.3 considers the minimum tr lengths 𝐿 𝑥 min , 𝐿 ℎ min are set to be small enough so that the gp approximates 𝑓 accurately in the trs.
In practice, this assumption only holds asymptotically, i.e. when the observed datapoints in the trs goes to infinity.
We present the main result, the time-varying extension to Theorem 3.4 from Wan et al.
, and then refer to App.
C for the derivation.
Theorem 3.1.
Assume Assumptions C.2 & C.3 hold.
Let 𝑓 𝑖 :
[ H , X ] → R be a time-varying objective defined over a mixed space and 𝜁 ∈ ( 0 , 1 ) .
Suppose that: (i) there exists a class of functions 𝑔 𝑖 in the
RKHS G 𝑘 ([ H , X ]) corresponding to the kernel 𝑘 of the global gp model, such that 𝑔 𝑖 passes through all the local maximas of 𝑓 𝑖 and shares the same global maximum as 𝑓 𝑖 ; (ii) the noise at each timestep 𝜖 𝑖 has mean zero conditioned on the history and is bounded by 𝜎 ; (iii) ∥ 𝑔 𝑖 ∥ 2 𝑘 ≤ 𝐵 .
Then bg-pbt obtains a regret bound
[Equation]
with 𝐶 1 = 8 / log ( 1 + 𝜎 − 2 ) , 𝛾 ( 𝑇 ; 𝑘 ; [ H , X ]) defined in Theorem C.1 and 𝛽 𝐼 is parameter balancing exploration-exploitation as in Theorem 2 of Parker-Holder et al.
Under the same ideal conditions assumed in Bogunovic et al.
(2016); Parker-Holder et al.
(2020) where the objective does not vary significantly through time, the cumulative regret bound is sublinear with lim
𝐼 →∞ 𝑅 𝐼𝐵 𝐼 = 0, when 𝜔 → 0 and ˜ 𝑁
→ 𝐼 .
3.2 Adapting Architectures on the Fly
Now that we are equipped with an approach to optimize in high-dimensional Z , we focus on choosing network architectures .
Despite their importance in rl (Cobbe et al., 2019; Furuta et al., 2021), architectures remain underexplored as a research direction.
Adapting architectures for pbt methods is non-trivial as we further enlarge the search space, and weights cannot readily be copied across different networks.
Inspired by Stooke et al.
(2021), our key idea is that when beginning a new generation we can distill behaviors into new architectures (see Fig. 2).
Specifically:
• Starting each generation: We fill the population of 𝐵 agents by generating a diverse set of architectures for both the policy and value networks.
For the first generation, this is done via random sampling.
For subsequent generations, we use suggestions from bo and/or random search with successive halving over the architecture space Y only (refer to App.
B.3 for details); the bo is trained on observations of the best performance each architecture has achieved in previous generations.
We initialize a new generation when the evaluated return stagnates beyond a pre-set patience during training.
• Transfer between generations: Apart from the very first generation, we transfer information from the best agent(s) of the previous generation to each new agent, in a similar fashion to Stooke et al.
(2021), using on-policy distillation with a joint supervised and rl loss between different architectures as shown in Fig.
2a.
Given a learned policy 𝜋 𝑖 and value function 𝑉 𝑖 from a previous generation, the new joint loss optimized is:
[Equation]
for weights 𝛼 RL ≥ 0, 𝛼 𝑉 ≥ 0, 𝛼 𝜋 ≥ 0, and rl loss L RL taken from Equation (1).
We linearly anneal the supervised losses over the course of each generation, so that by the end, only the rl loss remains.
• During a generation: We follow standard pbt methods to evolve the hyperparameters of each agent by copying weights 𝜽 and the architecture y from a top- 𝑞 % performing agent to a bottom- 𝑞 % agent, as shown in Fig.
2b.
This creates an effect similar to successive halving (Jamieson and Talwalkar, 2016; Karnin et al., 2013) where poorly-performing architectures are quickly removed from the population in favor of more strongly-performing ones; typically at the end of a generation, 1 or 2 architectures dominate the population.
While we do not introduce new architectures within a generation, the hyperparameter suggestions are conditioned on the current policy and value architectures by incorporating the architecture parameters y as contextual fixed dimensions in the gp surrogate described in §3.1.
4 Experiments
While bg-pbt provides a framework applicable to any rl algorithm, we test our method on 7 environments from the new Brax environment suite, using ppo.
We begin by presenting a comparative evaluation of bg-pbt against standard baselines in population-based training to both show the benefit of searching over the full hyperparameter space with local bo and of automatically adapting architectures over time.
We further show that our method beats end-to-end bo, showing the advantage of dynamic schedules.
Next, we analyze these learned hyperparameter and architecture schedules using bg-pbt and we show analogies to similar trends in learning rate and batch size in supervised learning.
Finally, we perform ablations on individual components of bg-pbt.
For all population-based methods, we use a population size 𝐵 = 8 and a total budget of 150M steps.
We note that bg-pbt with architectures uses additional on-policy samples from the environment in order to distill between architectures.
We instantiate the Brax environments with an action repeat of 1.
We use 𝑡 ready of 1M for all pbt-based methods on all environments except for Humanoid and Hopper, where we linearly anneal 𝑡 ready from 5M to 1M.
The remaining hyperparameters and implementation details used in this section are listed in App.
E.
Ant HalfCheetah Humanoid Hopper
Reacher
Fetch
[Figure]
10K
R e w a r d
[Figure]
6K 8K 10K 12K 14K 150M 2K 4K 6K 8K 10K
[Figure]
1K 2K
[Figure] [Table] Comparative Evaluation of bg-pbt. We first perform a comparative evaluation of bg-pbt against standard baselines in pbt-methods and the ppo baseline provided by the Brax authors.
We show the benefit of using local bo and treating the whole rl hyperparameter space Z , by comparing bg-pbt against pbt (Jaderberg et al., 2017), pb2 (Parker-Holder et al., 2020) and Random Search (rs) using the default architecture in Brax.
In rs, we simply sample from the hyperparameter space and take the best performance found using the same compute budget as the pbt methods.
Next, we include architecture search into bg-pbt using the full space J and show significant gains in performance compared to bg-pbt without architectures; we use random search over J as a baseline.
The optimized ppo implementation from the Brax authors is provided as a sequential baseline.
We present the results in Table 1 and the training trajectories in Fig.
We show that bg-pbt significantly outperforms the rs baselines and the existing pbt-style methods in almost all environments considered.
We also observe that rs is a surprisingly strong baseline, performing on par or better than pbt and pb2 in HalfCheetah, Reacher, Fetch and UR5e — this is due to a well-known failure mode in pbt-style algorithms where they may be overly greedy in copying sub-optimal behaviors early on and then fail to sufficiently explore in weight space when the population size is modest.
bg-pbt avoids this problem by re-initializing networks each generation and distilling, which prevents collapse to suboptimal points in weight space. Experiments with Different Training Timescales.
We further show experiments with a higher budget of 300M timesteps and/or an increased population size up to 𝐵 = 24 to investigate the scalability of bg-pbt in larger-scale environments (App. F.1). Furthermore, given that bg-pbt uses additional on-policy samples in order to distill between architectures, we conduct experiments of bg-pbt with reduced training budget in App. F.2. We find that even when the maximum timesteps are roughly halved, bg-pbt still outperforms the baseline AutoRL methods.
[Table]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] Comparison Against Sequential bo. We further compare against bo in the traditional sequential setup (Table 2): for each bo iteration, the agent is trained for the full 150M timesteps before a new hyperparameter suggestion is made.
To enable bo to improve on rs, we allocate a budget of 50 evaluations, which is up to 6 × more expensive than our method and even more costly in terms of wall-clock time if vanilla, non-parallel bo is used.
We implement this baseline using SMAC (Lindauer et al., 2022) in both the Z and J search spaces (denoted BO- Z and BO- J respectively in Table 2).
While, unsurprisingly, bo improves over the rs baseline, bg-pbt still outperforms it in a majority of environments.
One reason for this is that bg-pbt naturally discovers a dynamic schedule of hyperparameters and architectures, which is strictly more flexible than a carefully tuned but still static configuration – we analyze this below.
Analysis of Discovered Hyperparameter and Architecture Schedules.
We present the hyperparameter and architecture schedules learned by bg-pbt in our main comparative evaluation on Ant in Fig.
4 (results on other environments are presented in App. F.4).
We find consistent trends across environments such as the decrease of learning rate and increase in batch sizes over time, consistent to common practices in both rl (Engstrom et al., 2020) and supervised learning, but crucially bg-pbt discovers the same without any pre-defined schedule .
We note, however, that the exact rate at which the learning rate decreases and batch size increase differs across different environments – for example, in Ant we find that the learning rate quickly drops from a relatively large value to almost the smallest possible 10 − 4 , whereas in UR5e, the schedule is much less aggressive.
This suggests that the optimal schedule is dependent on the exact environment, and a uniform, manually-defined schedule as in Engstrom et al.
(2020) may not be optimal.
We demonstrate this empirically in App.
F.7, where we compare against rs but with the learning rate following a manually-defined cosine annealing schedule. We also find that different networks are favored at different stages of training, but the exact patterns differ across environments: for Ant (Fig. 4), we find that larger networks are preferred towards the end of training, with the policy and value network widths increasing over time: Prior work has shown that larger networks like those we automatically find towards the end of training can be notoriously unstable and difficult to train from scratch (Czarnecki et al., 2018; Ota et al., 2021), which further supports our use of generational training to facilitate this.
Ablation Studies.
bg-pbt improves on existing methods by using local tr-based bo (§3.1) and nas & distillation (§3.2).
We conduct an ablation study by removing either or both components in
Table 3 (a comparison between the training trajectories in Fig. 7 may be found in App. F.3), where “No NAS” does not search architectures or distill but uses the default Brax architectures, and “No TR/NAS” further only uses a vanilla gp surrogate and is identical to pb2.
We find the tailored bo agent in §3.1 improves performance across the board.
On the importance of nas & distillation, in all environments except for Humanoid and Reacher, bg-pbt matches or outperforms “No NAS”, despite J being a more complicated search space and the “No NAS” baseline is conditioned on strongly-performing default architectures.
We also see a particularly large gain for HalfCheetah and Fetch when we include architectures, demonstrating the effectiveness of the generational training and nas in our approach.
We include additional ablation studies in App.
F.3.
5 Related Work
On-the-fly Hyperparameter Tuning.
Our work improves on previous pbt (Jaderberg et al., 2017;
Parker-Holder et al., 2020; Zhang et al., 2021) style methods; in particular, we build upon ParkerHolder et al.
(2021), using a more scalable bo step, and adding architecture search with generational learning.
Dalibard and Jaderberg (2021) introduce an approach for increasing diversity in the weight space for pbt, orthogonal to our work.
There have also been non-population-based methods for dynamic hyperparameter optimization, using bandits (Badia et al., 2020; Ball et al., 2020; Moskovitz et al., 2021; Nguyen et al., 2020; Parker-Holder et al., 2020), gradients (Flennerhag et al., 2021;
Paul et al., 2019; Xu et al., 2018; Zahavy et al., 2020) or Evolution (Tang and Choromanski, 2020) which mostly do not search over architectures.
A notable exception is Sample-efficient Automated Deep Learning (SEARL) (Franke et al., 2021), which adapts architectures within a pbt framework. However, SEARL is designed for off-policy rl and thus especially shows the benefit of shared replay buffers for efficiency, whereas our method is general-purpose.
Architecture Search.
In rl, Czarnecki et al.
(2018) showed increasing agent complexity over time could be effective, albeit with a pre-defined schedule.
Miao et al.
(2021) showed that DARTS (Liu et al., 2019) could be effective in rl, finding high performing architectures on the Procgen benchmark.
Auto-Agent-Distiller (Fu et al., 2020) deals with the problem of finding optimal architectures for compressing the model size of rl agents, and also find that using distillation between the teacher and student networks improves stability of nas in rl.
On the other hand, bo has been used as a powerful tool for searching over large architecture spaces (Kandasamy et al., 2018; Nguyen et al., 2021a; Ru et al., 2021; Wan et al., 2021, 2022; White et al., 2021).
Conversely, we only consider simple mlps and the use of spectral normalization.
There has been initial effort (Izquierdo et al., 2021) combining nas and hyperparameter optimization in sequential settings, which is distinct to our on-the-fly approach.
Generational Training and Distillation.
Stooke et al.
(2021) recently introduced generational training, using policy distillation to transfer knowledge between generations, accelerating training.
Our method is based on this idea, with changing generations.
The use of distillation is further supported by Igl et al.
(2021) who recently used this successfully to adapt to non-stationarities in reinforcement learning, however keeping hyperparameters and architectures fixed.
6 Conclusion & Discussion
In this paper, we propose bg-pbt: a new algorithm that significantly increases the capabilities of pbt methods for rl.
Using recent advances in Bayesian Optimization, bg-pbt is capable of searching over drastically larger search spaces than previous methods.
Furthermore, inspired by recent advances in generational learning, we show it is also possible to efficiently learn architectures on the fly as part of a unified algorithm.
The resulting method leads to significant performance gains across the entire Brax environment suite, achieving high performance even in previously untested environments.
We believe bg-pbt is a significant step towards truly environment agnostic
RL algorithms, while also offering a path towards open-ended learning where agents never stop tuning themselves and continuously expand their capabilities over time.
Limitations & Future Work.
We note that while our method shows a significant boost in performance by including architectures for most environments, in some environments, such as
Humanoid, we achieve better results without architecture search (Table 3).
We hypothesize this is due to the complexity of the environment and an increased sensitivity to the network architecture.
Furthermore, while we provide a theoretical guarantee for our method in Theorem 3.1 for searching purely over architectures, no such guarantees exist when we transfer between architectures across generations.
Indeed, we occasionally see poor architectures being selected, which are then discarded during truncation selection.
Therefore, an immediate future direction is to address these issues and to improve the architecture selection process.
Another limitation is that while all rl-related hyperparameters are included in the search space, certain hyperparameters of bg-pbt could also be automatically searched for, including but not limited to distillation hyperparameters, which are currently fixed, and pbt parameters such as 𝑡 ready , which could allow us to avoid myopic and greedy behavior.
Beyond these limitations, our algorithm readily transfers to other rl problems with highdimensional mixed spaces, and thus we would readily accommodate more complicated architecture search spaces (e.g. vision-based environments) and incorporate environment parameters (Paul et al., 2016) into the search space to generalize to new tasks.
Broader Impact.
We open-source our code so that practitioners in the field can accelerate their own deployment of rl systems.
However, in doing so, we should be wary of the risk of also improving malicious use of rl; in particular, down-stream applications which could have an impact on people’s security and privacy.
To mitigate these risks, we encourage research on rl governance and safe rl.
As a general purpose framework for improving any rl algorithm, our method should be part of that conversation. Acknowledgements.
XW and BR are supported by the Clarendon Scholarship at the University of Oxford. CL is funded by the Engineering and Physical Sciences Research Council (EPSRC). PB is funded through the Willowgrove Studentship.
The authors would like to thank Yee Whye Teh for detailed feedback on an early draft and the anonymous AutoML conference reviewers & the area chair for their constructive comments which helped improve the paper
A Primer on GPs and BO
Gaussian Processes.
In Bayesian Optimization (bo), Gaussian Processes, or gps, act as surrogate models for a black-box function 𝑓 which takes an input z (in our case, the hyperparameters and/or the architecture parameters) and returns an output 𝑦 = 𝑓 ( z ) + 𝜖 where 𝜖 ∼ N ( 0 , 𝜎 2 ) .
A gp defines a probability distribution over functions 𝑓 under the assumption that any finite subset {( z 𝑖 , 𝑓 ( z 𝑖 )} follows a normal distribution (Rasmussen and Williams, 2006).
Formally, a gp is denoted as 𝑓 ( z ) ∼ GP ( 𝑚 ( z ) ,𝑘 ( z , z ′ )) , where 𝑚 ( z ) and 𝑘 ( z , z ′ ) are called the mean and covariance functions respectively, i.e. 𝑚 ( z ) =
E [ 𝑓 ( z )] and 𝑘 ( z , z ′ ) =
E (cid:2) ( 𝑓 ( z ) − 𝑚
( z ))
( 𝑓 ( z ′ )
− 𝑚 ( z ′ ))
𝑇 (cid:3) .
The covariance function (kernel) 𝑘 ( z , z ′ ) can be thought of as a similarity measure relating 𝑓 ( z ) and 𝑓 ( z ′ ) .
There have been various proposed kernels which encode different prior beliefs about the function 𝑓 ( z ) (Rasmussen and Williams, 2006).
If we assume a zero mean prior 𝑚 ( z ) = 0, to predict 𝑓 ∗ = 𝑓 ( z ∗ ) at a new data point z ∗ , we have, (cid:20)
[Equation]
N (cid:18)
[Equation]
(cid:20)
[Equation]
(cid:21)(cid:19) , (3) where 𝑘 ∗∗ = 𝑘 ( z ∗ , z ∗ ) , k ∗ =
[ 𝑘 ( z ∗ , z 𝑖 )] 𝑖 ≤ 𝑡 , 𝑡 is the number of observed points for the gp, and 𝑲 = (cid:2) 𝑘 (cid:0) z 𝑖 , z 𝑗 (cid:1)(cid:3) 𝑖,𝑗 ≤ 𝑡 .
We denote our observations as { z 1 , 𝑓 1 } , { z 2 , 𝑓 2 } , ..., { z 𝑡 , 𝑓 𝑡 } and collect all past return observations as f 𝑡 = [ 𝑓 1 , ..., 𝑓 𝑡 ] ⊤ .
Then, we may combine Eq.
(3) with the fact that 𝑝 ( 𝑓 ∗ | 𝒇 ) follows a univariate Gaussian distribution N (cid:0) 𝜇 ( z ∗ ) , 𝜎 2 ( z ∗ ) (cid:1) .
Given a new configuration z ′ , the gp posterior mean and variance at z ′ may be computed as:
[Equation]
where K 𝑡 (cid:66) { 𝑘 ( 𝑧 𝑖 , 𝑧 𝑗 )} 𝑡𝑖,𝑗 = 1 and k 𝑡 (cid:66) { 𝑘 ( 𝑧 𝑖 , 𝑧 ′ 𝑡 )} 𝑡𝑖 = 1 .
Bayesian Optimization.
Bayesian optimization (bo) is a powerful sequential approach to find the global optimum of an expensive black-box function 𝑓 ( z ) without making use of derivatives.
First, a surrogate model (in our case, a gp as discussed above) is learned from the current observed data
D 𝑡 = { z 𝑖 ,𝑦 𝑖 } 𝑡𝑖 = 1 to approximate the behavior of 𝑓 ( z ) .
Second, an acquisition function is derived from the surrogate model to select new data points that maximizes information about the global optimum – a common acquisition function that we use in our paper is the Upper Confidence Bound (ucb) (Srinivas et al., 2010) criterion which balances exploitation and exploration.
Specifically, the ucb on a new, unobserved point z ′ is given by:
[Equation]
[Equation]
where 𝜇 𝑡 and 𝜎 𝑡 are the posterior mean and standard deviation given in Eq. 4 above and 𝛽 𝑡 >is a trade-off parameter between mean and variance.
At each bo iteration, we find a batch of samples that sequentially maximizes the acquisition function above.
The process is conducted iteratively until the evaluation budget is depleted, and the global optimum is estimated based on all the sampled data.
In-depth discussions about bo beyond this brief overview can be found in recent surveys (Brochu et al., 2010; Frazier, 2018; Shahriari et al., 2016).
B Bayesian Optimization for PBT
In this section, we provide specific details for the modifications to Casmopolitan to make it amenable for our setup which consists of non-stationary reward and a mixed, high-dimensional search space.
B.1 Kernel Design
We use the following time-varying kernel (Bogunovic et al., 2016; Parker-Holder et al., 2021) to measure the spatiotemporal distance between a pair of configuration vectors { z , z ′ } with continuous, ordinal and/or categorical dimensions, and whose rewards are observed at timesteps { 𝑖, 𝑗 } .
For the most general case where we model all three types of variables, we have the following kernel function:
[Equation]
(7) where x denotes the continuous and ordinal dimensions and h denotes the categorical dimensions of the configuration vector z , respectively, 𝑘 𝑥 (· , ·) is the kernel for continuous and ordinal inputs (by default Matérn 5/2), 𝑘 ( ℎ ) (· , ·) is the kernel for the categorical dimensions (by default the exponentiated overlap kernel in Wan et al.
and 𝜔 ∈ [ 0 , 1 ] controls how quickly old data is decayed and is learned jointly during optimization of the GP log-likelihood. When the search space only contains continuous/ordinal variables, we simply have 𝑘 ( z , z ′ ,𝑖, 𝑗 ) = 𝑘 𝑧 ( x , x ′ )( 1 − 𝜔 ) | 𝑖 − 𝑗 |/ 2 , and a similar simplification holds if the search space only contains categorical variables.
We improve on Parker-Holder et al.
by directly supporting ordinal variables such as integers (for e.g. batch size) and selecting them alongside categorical variables using interleaved acquisition optimization as opposed to time-varying bandits which scales poorly to large discrete spaces.
As discussed in App. A, a bo agent selects new configuration(s) by selecting those which maximize the acquisition function (in this case, the ucb acquisition function).
This is typically achieved via off-the-shelf first-order optimizers, which is challenging in a mixed-input space as the discrete (ordinal and categorical) variables lack gradients and naïvely casting them into continuous variables yields invalid solutions which require rounding.
To address this issue, Parker-Holder et al.
(2021) select h first via time-varying bandits (using the proposed TV.EXP3.M algorithm) and then select x by optimizing the BO acquisition function, conditioned on the chosen h .
This method scales poorly to spaces with a large number of categorical choices, as bandit problems generally require pulling each arm at least once.
Instead, we develop upon interleaved acquisition optimization introduced in Wan et al.
(2021) which unifies all variables under a single GP, and alternates between optimization of the continuous and discrete variables: [Table]
Compared to the approach in Wan et al.
(2021), we include ordinal variables, which are optimized alongside the categorical variables via local search during acquisition optimization but are treated like continuous variables by the kernel.
During acquisition, we define adjacent ordinals to be the neighboring values.
For example, for an integer variable with a valid range [ 1 , 5 ] and current value 3, its neighboring values are 2 and 4.
This allows us to exploit the natural ordering for ordinal variables whilst still ensuring that suggested configurations remain local and only explore valid neighboring solutions. B.3 Suggesting New Architectures
At the start of each generation for the full bg-pbt method, we have to suggest a pool of new architectures.
For the first generation, we simply use random sampling across the joint space J to fill up the initial population. For subsequent generations, we use a combination of bo and random sampling to both leverage information already gained from the architectures and allow sufficient exploration. For the bo, at the start of the 𝑖 -th generation, we first fit a gp model solely in the architecture space Y , by using the architectures from the 𝑖 − 1-th generation as the training data. Since these network architectures are trained with different hyperparameters during the generation, we use the best return achieved on each of these architectures as the training targets.
We then run bo on this gp to obtain the suggestions for new architectures for the subsequent generation.
In practice, to avoid occasional instability in the distillation process, we find it beneficial to select a number of architectures larger than 𝐵 : we then start the distillation for all the agents, but use successive halving (Karnin et al., 2013) such that only 𝐵 agents survive and are distilled for the full budget allocated.
By doing so, we trade a modest increase in training steps for greatly improved stability in distillation.
B.4 Details on Trust Regions
To define trust regions for our time-varying objective, we again consider the most general case where the search space contains both categorical and continuous/ordinal dimensions.
Given the configuration z ∗ 𝑡 =
[ h ∗ 𝑡 , x ∗ 𝑡 ] = arg max z 𝑡 ( 𝑓 𝑡 ) with the best return at time 𝑡 , we may define the trust region centered around z ∗ 𝑡 :
[Equation]
for categorical [Equation] for continuous or ordinal [Equation]
where 𝛿 (· , ·) is the Kronecker delta function, 𝐿 ℎ ∈ [ 0 , 1 ] is the trust region radius defined in terms of normalized Hamming distance over the categorical variables, 𝐿 𝑥 is the trust region radius defining a hyperrectangle over the continuous and ordinal variables, and { ˜ ℓ 𝑖 = ℓ 𝑖𝑑𝑥 (cid:205) 𝑑𝑥𝑖 = 1 ℓ 𝑖 } 𝑑 𝑥 𝑖
= 1 are the normalized lengthscales { ℓ 𝑖 } learned by the GP surrogate over the continuous/ordinal dimensions.
This means that the more sensitive hyperparameters, i.e. those with smaller learned lengthscales, will automatically be assigned smaller trust region radii.
For the restart of trust regions when either or both of the trust regions defined fall below some pre-defined threshold, we adapt the ucb-based criterion proposed in Wan et al.
(2021) to the time-varying setting to re-initialize the population when a restart is triggered.
For the 𝑖 -th restart, we consider a global, auxiliary GP model trained on a subset of observed configurations and returns 𝐷 ∗ 𝑖 − 1 =
{ z ∗ 𝑗 , 𝑓 ∗ 𝑗 } 𝑖𝑗 = 1 and denote 𝜇 𝑔 ( z ; 𝐷 ∗ 𝑖 − 1 ) and 𝜎 2 𝑔 ( z ; 𝐷 ∗ 𝑖 − 1 ) as the posterior mean and variance of the auxiliary GP.
The new trust region center is given by the configuration z ( 0 )
𝑖 that maximizes the UCB score: z ( 0 ) 𝑖
[Equation]
) where 𝛽 𝑖 is the UCB trade-off parameter.
In the original Casmopolitan, 𝐷 ∗ consists of the best configurations in all previous restarts 1 , ...,𝑖 − 1, which is invalid for the time-varying setting.
Instead, we construct 𝐷 ∗ 𝑖 − 1 using the following:
[Equation]
where D 𝑗 denotes the set of previous configurations evaluated during the 𝑗 -th restart and 𝜇 𝑇 (·) denotes the posterior mean of the time-varying GP surrogate at the present timestep 𝑡 = 𝑇 .
Thus, instead of simply selecting the configurations of each restart that led to the highest observed return, we select the configurations that would have led to the highest return if they were evaluated now , according to the GP surrogate.
Such a configuration preserves the convergence property of bg-pbt (without distillation and architecture search) shown in Theorem 3.1 and proven below in App.
C. C Theoretical Guarantees C.1 Bound on the Maximum Information Gain
We start by deriving the maximum information gain, which extends the result presented in Wan et al.
(2021) for the time-varying setting.
Note that this result is defined over the number of local restarts 𝐼 .
Theorem C.1.
Let 𝛾 ( 𝐼 ; 𝑘 ; 𝑉 ) : =
max 𝐴 ⊆
𝑉, | 𝐴 |≤ 𝐼 12 log | I + 𝜎 − 2 [ 𝑘 ( v , v ′ )] v , v
′ ∈ 𝐴 | be the maximum information gain achieved by sampling 𝐼 points in a gp defined over a set 𝑉 with a kernel 𝑘 .
Denote the constant 𝜂 : =
(cid:206)
𝑑 ℎ 𝑗 = 1 𝑛 𝑗 .
Then we have, for the time-varying mixed kernel 𝑘 ,
[Equation]
where the time steps { 1 , ..., 𝐼 } are split into into 𝐼 / ˜ 𝑁 blocks of length ˜ 𝑁 , such that the function 𝑓 𝑡 does not vary significantly within each block.
Proof.
Following the proof used in Bogunovic et al.
, we split the time steps { 1 , ..., 𝐼 } into 𝐼 / ˜
𝑁 blocks of length ˜ 𝑁 , such that within each block the function 𝑓 𝑖 does not vary significantly.
Then, we have that the maximum information gain of the time-varying kernel Bogunovic et al. (2016)) is bounded by
[Equation]
where 𝜔 ∈ [ 0 , 1 ] is the forgetting-remembering trade-off parameter, and we consider the kernel for time 1 − 𝑘 𝑡𝑖𝑚𝑒 ( 𝑡, 𝑡 ′ ) ≤ 𝜔 | 𝑡 − 𝑡 ′ | .
We denote ˜ 𝛾 ˜ 𝑁 as the maximum information gain for the time-invariant kernel counterpart in each block length of ˜ 𝑁 .
Next, by using the bounds for the (time-invariant) mixed kernel in Wan et al.
(2021) that ˜ 𝛾 ˜ 𝑁 ≤ O (cid:0) ( 𝜆𝜂 + 1 − 𝜆 ) 𝛾
( 𝐼 ; 𝑘 𝑥 ; X ) + ( 𝜂 + 2 − 2 𝜆 ) log 𝐼 (cid:1) , we get the new time-varying bound 𝛾 ( 𝐼 ; 𝑘 ; [ H , X ])
⪅ 𝐼 ˜ 𝑁 (cid:16) 𝜆𝜂𝛾 ( 𝐼 ; 𝑘 𝑥 ; X )
+ ( 𝜂 − 2 𝜆 ) log 𝐼 + 𝜎 − 2 𝑓 ˜ 𝑁 3 𝜔 (cid:17) where we have suppressed the constant term for simplicity.
C.2 Proof of Local Convergence in Each Trust Region
Assumption C.2.
The time-varying objective function 𝑓 𝑡 ( z ) is bounded in [ H , X ] , i.e. ∃ 𝐹 𝑙 , 𝐹 𝑢 ∈ R : ∀ z ∈
[ H , X ] , 𝐹 𝑙 ≤ 𝑓 𝑡 ( z ) ≤ 𝐹 𝑢 , ∀ 𝑡 ∈ [ 1 , ...,𝑇 ] .
Assumption C.3.
Let us denote 𝐿 ℎ min , 𝐿 𝑥 min and 𝐿 ℎ 0 , 𝐿 𝑥 0 be the minimum and initial tr lengths for the categorical and continuous variables, respectively.
Let us also denote 𝛼 𝑠 as the shrinking rate of the trs.
The local gp approximates 𝑓 𝑡 , ∀ 𝑡 ≤ 𝑇 accurately within any tr with length 𝐿 𝑥 ≤ max (cid:0) 𝐿 𝑥 min / 𝛼 𝑠 , 𝐿 𝑥 0 (⌈( 𝐿 ℎ min + 1 )/ 𝛼 𝑠 ⌉− 1 )/ 𝐿 ℎ 0 (cid:1) and 𝐿 ℎ ≤ max (cid:0) ⌈( 𝐿 ℎ min + 1 )/ 𝛼 𝑠 ⌉− 1 , ⌈ 𝐿 ℎ 0 𝐿 𝑥 min /( 𝛼 𝑠 𝐿 𝑥 0 )
⌉ (cid:1) .
Theorem C.4.
Given Assumptions C.2 & C.3, after a restart, bg-pbt converges to a local maxima after a finite number of iterations or converges to the global maximum.
Proof.
We may apply the same proof by contradiction used in Wan et al.
(2021) for our time-varying setting, given the assumptions C.2 and C.3.
For completeness, we summarize it below.
We show that our algorithm converges to (1) to a global maximum of 𝑓 (if does not terminate after a finite number of iterations) or (2) a local maxima of 𝑓 (if terminated after a finite number of iterations).
Case 1: when 𝑡 → ∞ and the tr lengths 𝐿 ℎ and 𝐿 𝑥 have not shrunk below 𝐿 ℎ min and 𝐿 𝑥 min .
From the algorithm description, the tr is shrunk after fail_tol consecutive failures.
Thus, if after 𝑁 min = fail_tol × 𝑚 iterations where 𝑚 = max (⌈ log 𝛼 𝑒 ( 𝐿 ℎ 0 / 𝐿 ℎ min )⌉ , ⌈ log 𝛼 𝑒 ( 𝐿 𝑥 0 / 𝐿 𝑥 min )⌉) , there is no success, bg-pbt terminates.
This means, for case (1) to occur, bg-pbt needs to have at least one improvement per 𝑁 min iterations.
Let consider the increasing series { 𝑓 ( z 𝑘 )} ∞ 𝑘 = 1 where 𝑓 ( z 𝑘 ) =
max 𝑡 = ( 𝑘 − 1 ) 𝑁 min + 1 ,...,𝑘𝑁 min { 𝑓 ( z 𝑡 )} and 𝑓 ( z 𝑖 ) is the function value at iteration 𝑡 .
Thus, using the monotone convergence theorem (Bibby, 1974), this series converges to the global maximum of the objective function 𝑓 given that 𝑓 ( z ) is bounded (Assumption C.2).
Case 2: when bg-pbt terminates after a finite number of iterations, bg-pbt converges to a local maxima of 𝑓 ( z ) given Assumption C.3.
Let us remind that bg-pbt terminates when either the continuous tr length ≤ 𝐿 𝑥 min or the categorical tr length ≤ 𝐿 ℎ min .
Let 𝐿 𝑠 be the largest tr length that after being shrunk, the algorithm terminates, i.e., ⌊ 𝛼 𝑠 𝐿 𝑠 ⌋ ≤ 𝐿 ℎ min .
1 Due to ⌊ 𝛼 𝑠 𝐿 𝑠 ⌋ ≤ 𝛼 𝑠 𝐿 𝑠 <
⌊ 𝛼 𝑠 𝐿 𝑠 ⌋ + 1, we have 𝐿 𝑠 <
( 𝐿 ℎ min + 1 )/
𝛼 𝑠 .
Because 𝐿 𝑠 is an integer, we finally have 𝐿 𝑠 ≤ ⌈( 𝐿 ℎ min + 1 )/
𝛼 𝑠 ⌉ − 1.
This means that 𝐿 𝑠 = ⌈( 𝐿 ℎ min + 1 )/
𝛼 𝑠 ⌉ − 1 is the largest tr length that after being shrunk, the algorithm terminates.
We may apply a similar argument for the largest tr length (before terminating) for the continuous 𝐿 𝑥 min / 𝛼 𝑠 .
In our mixed space setting, we have two separate trust regions for categorical and continuous variables.
When one of the tr reaches its terminating threshold ( 𝐿 𝑥 min / 𝛼 𝑠 or ⌈( 𝐿 ℎ min + 1 )/
𝛼 𝑠 ⌉ − 1), the length of the other one is ( ⌈ 𝐿 ℎ 0 𝐿 𝑥 min /( 𝛼 𝑠 𝐿 𝑥 0 )
⌉ (cid:1) or 𝐿 𝑥 0 (⌈( 𝐿 ℎ min + 1 )/ 𝛼 𝑠 ⌉− 1 )/ 𝐿 ℎ 0 ).
Based on Assumption C.3, the gp can accurately fit a tr with continuous length 𝐿 𝑥 ≤ max (cid:0) 𝐿 𝑥 min / 𝛼 𝑠 , 𝐿 𝑥 0 (⌈( 𝐿 ℎ min + 1 )/ 𝛼 𝑠 ⌉− 1 )/ 𝐿 ℎ 0 (cid:1) and 𝐿 ℎ ≤ max (cid:0) ⌈( 𝐿 ℎ min + 1 )/
𝛼 𝑠 ⌉ − 1 , ⌈ 𝐿 ℎ 0 𝐿 𝑥 min /( 𝛼 𝑠 𝐿 𝑥 0 )⌉ (cid:1) .
Thus, if the current tr center is not a local maxima, bg-pbt can find a new data point whose function value is larger than the function value of current tr center.
This process occurs iteratively until a local maxima is reached, and bg-pbt terminates.
C.3 Proof of Theorem 3.
Proof.
Under the time-varying setting, at the 𝑖 -th restart, we first fit the global time-varying gp model on a subset of data 𝐷 ∗ 𝑖 − 1 =
{ z ∗ 𝑗 , 𝑓 ( z ∗ 𝑗 )} 𝑖 − 1 𝑗 = 1 , where z ∗ 𝑗 is the local maxima found after the 𝑗 -th restart, or, a random data point, if the found local maxima after the 𝑗 -th restart is same as in the previous restart.
Let z ∗∗ 𝑖 = arg max ∀ z ∈[ H , X ] 𝑓 𝑡 ( z ) 2 be the global optimum location at time step 𝑖 .
Let 𝜇 𝑔𝑙 ( z ; 𝐷 ∗ 𝑖 − 1 ) and 𝜎 2 𝑔𝑙 ( z ; 𝐷 ∗ 𝑖 − 1 ) be the posterior mean and variance of the global gp learned from 𝐷 ∗ 𝑖 − 1 .
Then, at the 𝑖 -th restart, we select the following location z ( 0 ) 𝑖 as the initial centre of the new tr:
[Equation]
where 𝛽 𝑖 is the trade-off parameter in pb2 (Parker-Holder et al., 2020).
We follow Wan et al.
(2021) to assume that at the 𝑖 -th restart, there exists a function 𝑔 𝑖 ( z ) : (a) lies in the RKHS G 𝑘 ([ H , X ]) and ∥ 𝑔 𝑖 ∥ 2 𝑘 ≤ 𝐵 , (b) shares the same global maximum z ∗ with 𝑓 , and, (c) passes through all the local maxima of 𝑓 and any data point z ′ in D ∗ 𝑖 − 1 ∪ { z ( 0 ) 𝑖 } which are not local maxima (i.e. 𝑔 𝑖 ( z ′ )
=
𝑓 ( z ′ ) , ∀ z ′ ∈
𝐷 ∗ 𝑖 − 1 ∪ { z ( 0 ) 𝑖 } ).
In other words, the function 𝑔 𝑖 ( z ) is a function that passes through the maxima of 𝑓 whilst lying in the RKHS G 𝑘
[ H , X ]) and satisfying ∥ 𝑔
𝑖 ∥ 2 𝑘 ≤ 𝐵 .
Using 𝛽 𝑖 defined in Theorem 2 in Srinivas et al.
(2010) for function 𝑔 𝑖 , ∀ 𝑖 , ∀ 𝑧 ∈
[ H , X ] , we have,
[Equation]
In particular, with probability 1 − 𝜁 , we have that,
[Equation]
Thus, ∀ 𝑖 , with probability 1 − 𝜁
we have
[Equation]
Since 𝑔 𝑖 ( z ( 0 ) 𝑖 )
=
𝑓 ( z ( 0 ) 𝑖 ) , and 𝑔 𝑖 ( z ∗∗ 𝑖 ) =
𝑓 ( z ∗∗ 𝑖 ) , hence, 𝑓 𝑖 ( z ∗∗ 𝑖 ) − 𝑓
( z ( 0 ) 𝑖 ) ≤ 2 √︁ 𝛽 𝑖 𝜎 𝑔𝑙 ( z ( 0 ) 𝑖 ; 𝐷 ∗ 𝑖 − 1 ) with probability 1 − 𝜁 .
With z ∗ 𝑖 as the local maxima found by bg-pbt at the 𝑖 -th restart.
As 𝑓 ( z ( 0 ) 𝑖 ) ≤ 𝑓 ( z ∗ 𝑖 ) , we have,
[Equation]
Let z 𝑖,𝑏 be the point chosen by our algorithm at iteration 𝑖 and batch element 𝑏 , we follow ParkerHolder et al.
(2020) to define the time-varying instantaneous regret as 𝑟 𝑖,𝑏 = 𝑓 𝑖
( z ∗∗ 𝑖 ) − 𝑓 𝑖
( z 𝑖,𝑏 ) .
Then, the time-varying batch instantaneous regret over 𝐵 points is as follows
[Equation]
Using Equation (13) and Theorem 2 in Parker-Holder et al.
(2020), we bound the cumulative batch regret over 𝐼 restarts and 𝐵 parallel agents
[Equation]
[Equation] where 𝐶 1 = 32 / log ( 1 + 𝜎 2 𝑓 ) , 𝛽 𝐼 is the explore-exploit hyperparameter defined in Theorem 2 in
Parker-Holder et al.
and 𝛾 ( 𝐼𝐵 ; 𝑘 ; [ H , X ]) ⪅ 𝐼𝐵 ˜ 𝑁 (cid:16) 𝜆𝜂𝛾 ( 𝐼 ; 𝑘 𝑥 ; X ) + ( 𝜂 − 2 𝜆 ) log 𝐼𝐵 + 𝜎 − 2 𝑓 ˜ 𝑁 3 𝜔 (cid:17) is the maximum information gain defined over the mixed space of categorical and continuous [ H , X ] in the time-varying setting defined in Theorem C.1.
We note that given Theorem 3.1, if we use the squared exponential kernel over the continuous variables, 𝛾 ( ˜ 𝑁𝐵 ; 𝑘 ; X ) =
O ( (cid:2) log ˜ 𝑁𝐵 (cid:3) 𝑑 + 1 ) (Srinivas et al., 2010), the bound becomes 𝑅 𝐼𝐵 ≤
[Equation]
𝑓 ˜
[Equation]
[Equation] (cid:17)
[Equation]
2 where ˜ 𝑁 ≤ 𝐼 , 𝐵 ≪ 𝑇 and 𝜔 ∈ [ 0 , 1 ] .
D Full PPO Hyperparameter Search Space
We list the full search space for PPO in Table 4.
The architecture and hyperparameters form the full 15-dimensional mixed search space.
For methods that do not search in the architecture space (e.g., pbt, pb2, random search baselines in Z , and the partial bg-pbt in Ablation Studies that uses §3. only), the last 6 dimensions are fixed to the default architecture used in Brax: a policy network with 4 hidden layers each containing 32 neurons, and a value network with 5 hidden layers each containing 256 neurons.
By default, spectral normalization is disabled in both networks.
E Implementation Details
We list the hyperparameters for our method bg-pbt in Table 5.
Since bg-pbt uses the Casmopolitan bo agent, it also inherits the default hyperparameters from Wan et al.
(2021) which are used in all our experiments (Table 6).
We refer the readers to App.
B.5 of Wan et al. (2021) which examines the sensitivity of these hyperparameters. Note that in our current instantiation, we use 𝛼 𝑉 = so we only transfer policy networks across generations, since we found the value function was
[Table]
[Table]
less informative.
We linearly anneal the coefficients for the supervised loss 𝛼 𝑉 and 𝛼 𝜋 from their original value to 0 over the course of the distillation phase.
This means we smoothly transition to a pure RL loss over the initial part of each new generation
[Table] Our method is built using the PyTorch version of the Brax (Freeman et al., 2021) codebase at https://github.com/google/brax/tree/main/brax .
The codebase is open-sourced under the
Apache 2.0 License.
The Brax environments are often subject to change, for full transparency, our evaluation is performed using the 0.10.0 version of the codebase. We ran all our experiments on
Nvidia Tesla V100 GPUs and used a single GPU for all experiments. We note that the PPO baseline used in Table 1 is implemented in a different framework (JAX) to ours, which has some differences in network weight initialization.
The hyperparameters for the PPO baseline are tuned via grid-search on a reduced hyperparameter search space (Freeman et al., 2021).
Since no hyperparameters were provided for the Hopper environment, we use the default in Freeman et al.
For all experiments, we use 𝑇 max = 150 𝑀 , population size (number of parallel agents) 𝐵 =and 𝑞 = 12 .
5 (percentage of the agents that are replaced at each pbt iteration – in this case, at each iteration, the single worst-performing agent is replaced).
For all environments except for Humanoid and Hopper, we use a fixed 𝑡 ready = 1 𝑀 . To avoid excessive sensitivity to initialization, at the beginning of training for all pbt-based methods (pb2, pbt and bg-pbt) we initialize withagents and train for 𝑡 ready steps and choose the top- 𝐵 agents as the initializing population. For the full bg-pbt, to trigger distillations and hence a new generation, we set a patience of 20 (i.e., if the evaluated return fails to improve after 20 consecutive 𝑡 ready steps, a new generation is started).
Since starting new generations can be desirable even if the training has not stalled, we introduce a second
[Table]
criterion to also start a new generation after 40M steps.
Thus, a new generation is started when either criterion is met (40M steps since last distillation, or 20 consecutive failures in improving the evaluated return).
For distillation at the start of every generation (all except initial), we begin distillation with 24 agents (4 suggested by bo and the rest from random sampling, see App.
B.3 for details).
We then use successive halving to only distill 𝐵 of them using the full budget of 30M steps with the rest terminated early.
For the Humanoid and Hopper environments, we observed that PBT-style methods performed poorly across the board (See App.
F for detailed results): in particular, on Hopper we notice that agents often learn a sub-optimal mode where it only learns to stand up (hence collecting the reward associating with simply surviving) but not to move.
On Humanoid, we find that agents often learn a mode where the humanoid does not use its knee joint – in both cases, the agents seem to get stuck in stable but sub-optimal modes which use fewer degrees-of-freedom than they are capable of exploiting.
This behavior was ameliorated by linearly annealing the interval 𝑡 ready from 5M to 1M as a function of timesteps to not encourage myopic behavior at the start.
Since the increase in 𝑡 ready at the initial stage of training will lead to more exploratory behaviors, we increase the threshold before triggering a new generation at 60M for these two environments.
F Additional Experiments F.1 Scalability with Increased Training Budget and/or 𝐵
[Figure]
For more complicated large-scale environments, pbt is often used with a much larger population size than what we present in this paper ( 𝐵 = 8).
In this section, we investigate whether bg-pbt benefits from increased parallelism by increasing the number of agents to 𝐵 = 24 and training for much longer.
In this instance, we use the Hopper environment as a testbed as it is amongst the most challenging in the current version of Brax and is particularly well suited to pbt-style methods. We show the results in Fig. 5: for a 𝑡 max of 150M, there is a small improvement over the 𝐵 = 8 results presented in the main text; whereas there is a significant benefit from jointly scaling up 𝐵 , 𝑡 max and 𝑡 ready as exemplified by the 300M_10M result.
F.2 Effects of Reduced Training Budget
We additionally conduct experiments on bg-pbt with the maximum timesteps roughly halved from the default 150M used in the main experiments to remove the effect of the additional samples used during distillation.
We show the results in Fig.
6, where bg-pbt_s denotes bg-pbt run for roughly 75M steps.
Compared to the training setup outlined in App.
E, to further reduce the training cost, we also reduce the number of initializing population to 12, reduce the distillation timesteps to 20M and allow for only one generation of distillation.
The results show that bg-pbt still performs well with results on par with or exceeding previous baselines using the full budget.
[Figure]
F.3 Components of bg-pbt
[Figure]
We show the training trajectories of bg-pbt and the variant of bg-pbt without neural architecture search and distillation in Fig.
We also perform additional ablation studies on components of bg-pbt on Ant and HalfCheetah in Fig.
The modifications to bg-pbt we consider are:
No NAS/TR pbt without tr-based bo or nas.
This is identical to the pb2 baseline described in the main text.
No NAS bg-pbt with tr-based bo in Sec.
3.1 but without nas or distillation. 3.
Random Arch bg-pbt with tr-based bo and distillation, but at the start of each generation, the architectures are selected randomly instead using bo+rs followed by the successive halving strategy described in App.
B.3.
Static Arch bg-pbt with tr-based bo and distillation, but without nas: all agents are started with the same default architectures for both the policy and value networks, and at the start of a new generation we distill across identical architectures.
The results further demonstrate the benefit of introducing both tr-based bo and NAS to PBT-style methods in bg-pbt.
The results in Fig.
8 also highlight the importance of having architecture diversity for distillation to be successful – for both environments, removing the architecture variability ( Static Arch ) led to a significant drop in performance, which in some cases even under-performed the baseline without any distillation.
In contrast, simply initializing the new agents with random architectures performed surprisingly well ( Random Arch ).
This provides more even evidence that optimal architectures at different stages of training may vary, and thus should also vary dynamically through time.
[Figure]
F.4 Hyperparameter and Architecture Schedules Learned on Additional Environments
Supplementary to Fig.
4, we show the hyperparameter and architectures schedules learned by bg-pbt in Fig.
9 for additional environments where architecture search improves performance.
We see similar trends to the schedules learned for the Ant environment. [Figure] F.5 Hopper and Humanoid Results with Constant 𝑡 ready = 1 𝑀 For our main evaluation, we linearly anneal 𝑡 ready through time.
We show why this is necessary in Table 7 by evaluating the PBT-style methods with a constant 𝑡 ready = 1M as with the other environments.
We observe a considerable decrease in evaluated return compared to the results in Table 1. [Table] F.6 Ablations on Explicit Treatment of Ordinal Variables
For bg-pbt, we extended Casmopolitan (Wan et al., 2021) by further accommodating for ordinal variables (i.e., discrete variables with ordering, such as integer variables for the width of a multilayer perceptron).
In this section, we show the empirical benefits of this over treating them as categorical variables (the default in Wan et al.
We consider 3 Brax environments (Fig. 10), where we further compare the full bg-pbt with a variant of bg-pbt where we use the original Casmopolitan by treating the ordinal variables (log 2 -batch size, widths and depths of the value and policy MLPs, unroll length, number of updates per epoch) as categorical variables.
It is clear that the ordinal treatment in our case results in better performance in all 3 environments.
[Figure]
bg-pbtCat) that treats ordinal variables as categorical.
F.7 Comparison Against Random Search with Manually Defined Learning Rate Schedule
We compare against random search that uses an equivalent amount of compute resources, but with a manually defined learning rate schedule, in Table 8.
Specifically, we use random search for all hyperparameters in either the joint search space ( J ) or the hyperparameter search space ( Z ) defined in Table 1, with the exception that instead of using flat learning rates, we search for an initial learning rate which is cosine annealed to 10 − 8 by the end of the training.
We find that in Ant and HalfCheetah where the bg-pbt discovered schedules are similar to the manual cosine schedules, RS-Anneal significantly outperforms regular RS, but when the discovered schedules deviate from the manual design in the case of UR5e, we find the margin of improvement to be much smaller.
This shows that there is unlikely to be an optimal manual schedule for all environments, further demonstrating the desirable flexibility of bg-pbt in adapting to different environments.
[Table]
Furthermore, in all environments
[Table]
bg-pbt still outperforms RS
[Table]
with or without manual learning rate scheduling.
This is particularly notable as previous pbt-style methods were often known to under-perform random search, especially with small population sizes.