I MPROVING G ENERALIZATION IN M ETA R EINFORCEMENT L EARNING USING L EARNED O BJECTIVES
A BSTRACT
Biological evolution has distilled the experiences of many learners into the general learning algorithms of humans.
Our novel meta reinforcement learning algorithm MetaGenRL is inspired by this process.
MetaGenRL distills the experiences of many complex agents to meta-learn a low-complexity neural objective function that decides how future individuals will learn.
Unlike recent meta-RL algorithms, MetaGenRL can generalize to new environments that are entirely different from those used for meta-training.
In some cases, it even outperforms humanengineered RL algorithms.
MetaGenRL uses off-policy second-order gradients during meta-training that greatly increase its sample efﬁciency.
I NTRODUCTION
The process of evolution has equipped humans with incredibly general learning algorithms.
They enable us to solve a wide range of problems, even in the absence of a large number of related prior experiences.
The algorithms that give rise to these capabilities are the result of distilling the collective experiences of many learners throughout the course of natural evolution.
By essentially learning from learning experiences in this way, the resulting knowledge can be compactly encoded in the genetic code of an individual to give rise to the general learning capabilities that we observe today.
In contrast, Reinforcement Learning (RL) in artiﬁcial agents rarely proceeds in this way.
The learning rules that are used to train agents are the result of years of human engineering and design, (e.g. Williams (1992);
Wierstra et al.
Mnih et al.
; Lillicrap et al.
(2016); Schulman et al.
(2015a)).
Correspondingly, artiﬁcial agents are inherently limited by the ability of the designer to incorporate the right inductive biases in order to learn from previous experiences.
Several works have proposed an alternative framework based on meta reinforcement learning (Schmidhuber, 1994; Wang et al., 2016; Duan et al., 2016;
Finn et al., 2017; Houthooft et al., 2018; Clune, 2019).
Meta-RL distinguishes between learning to act in the environment (the reinforcement learning problem) and learning to learn (the meta-learning problem).
Hence, learning itself is now a learning problem, which in principle allows one to leverage prior learning experiences to meta-learn general learning rules that surpass human-engineered alternatives.
However, while prior work found that learning rules could be meta-learned that generalize to slightly different environments or goals (Finn et al., 2017; Plappert et al., 2018; Houthooft et al., 2018), generalization to entirely different environments remains an open problem.
In this paper we present MetaGenRL 1 , a novel meta reinforcement learning algorithm that metalearns learning rules that generalize to entirely different environments.
MetaGenRL is inspired by the process of natural evolution as it distills the experiences of many agents into the parameters of an objective function that decides how future individuals will learn.
Similar to Evolved Policy
Gradients (EPG; Houthooft et al.
, it meta-learns low complexity neural objective functions that can be used to train complex agents with many parameters.
However, unlike EPG, it is able to meta-learn using second-order gradients, which offers several advantages as we will demonstrate.
We evaluate MetaGenRL on a variety of continuous control tasks and compare to RL 2 (Wang et al., 2016; Duan et al., 2016) and EPG in addition to several human engineered learning algorithms.
Compared to RL 2 we ﬁnd that MetaGenRL does not overﬁt and is able to train randomly initialized agents using meta-learned learning rules on entirely different environments.
Compared to EPG we ﬁnd that MetaGenRL is more sample efﬁcient, and outperforms signiﬁcantly under a ﬁxed budget of environment interactions.
The results of an ablation study and additional analysis provide further insight into the beneﬁts of our approach.
P RELIMINARIES
Notation We consider the standard MDP Reinforcement Learning setting deﬁned by a tuple e = ( S, A, P, ρ 0 , r, γ, T ) consisting of states S , actions A , the transition probability distribution P :
S ×
A × S → R + , an initial state distribution ρ 0 : S → R + , the reward function r : S ×
A → [ − R max , R max ] , a discount factor γ , and the episode length T .
The objective for the probabilistic policy π φ : S ×
A → R + parameterized by φ is to maximize the expected discounted return: E
[Equation]
γ t r t ] , where s 0 ∼ ρ 0 ( s 0 ) , a t ∼ π φ ( a t | s t ) , s t +1 ∼ P ( s t +1 | s t , a t ) , r t = r ( s t , a t ) , (1) with τ = ( s 0 , a 0 , r 0 , s 1 , ..., s T − 1 , a T − 1 , r T − 1 ) .
Human Engineered Gradient Estimators
A popular gradient-based approach to maximizing Equation 1 is REINFORCE (Williams, 1992).
It directly differentiates Equation 1 with respect to φ using the likelihood ratio trick to derive gradient estimates of the form:
[Equation]
Although this basic estimator is rarely used in practice, it has become a building block for an entire class of policy-gradient algorithms of this form.
For example, a popular extension from Schulman et al.
(2015b) combines REINFORCE with a Generalized Advantage Estimate (GAE) to yield the following policy gradient estimator:
[Equation]
where A ( τ, V, t ) is the GAE and V : S → R is a value function estimate.
Several recent other extensions include TRPO (Schulman et al., 2015a), which discourages bad policy updates using trust regions and iterative off-policy updates, or PPO (Schulman et al., 2017), which offers similar beneﬁts using only ﬁrst order approximations.
Parametrized Objective Functions
In this work we note that many of these human engineered policy gradient estimators can be viewed as speciﬁc implementations of a general objective function
L that is differentiated with respect to the policy parameters:
[Equation]
Hence, it becomes natural to consider a generic parametrization of L that, for various choices of parameters α , recovers some of these estimators.
In this paper, we will consider neural objective functions where L α is implemented by a neural network.
Our goal is then to optimize the parameters α of this neural network in order to give rise to a new learning algorithm that best maximizes Equation 1 on an entire class of (different) environments.
M ETA -L EARNING N EURAL O BJECTIVES
In this work we propose MetaGenRL , a novel meta reinforcement learning algorithm that metalearns neural objective functions of the form L α ( τ, π φ , V ) .
MetaGenRL makes use of value functions and second-order gradients, which makes it more sample efﬁcient compared to prior work (Duan et al., 2016;
Wang et al., 2016; Houthooft et al., 2018).
More so, as we will demonstrate,
MetaGenRL meta-learns objective functions that generalize to vastly different environments.
Critic
Policy
Environment
Q ( i ) θ ( s , a ) π ( i ) ϕ
( s )
A neural objective function that implements an RL algorithm
L α ( τ , π ϕ , V )
α ← α + ∇ α Q ( s ,
π ϕ ′  ( s ))
ϕ ← ϕ − ∇ ϕ L α i ∈ 1… N e
( i )
Replay Buffer
B ( i ) with ϕ ′  = ϕ −∇ ϕ L α
Interact
Store
Meta Learning
Learning
Our key insight is that a differentiable critic Q θ : S ×
A → R can be used to measure the effect of locally changing the objective function parameters α based on the quality of the corresponding policy gradients.
This enables a population of agents to use and improve a single parameterized objective function L α through interacting with a set of (potentially different) environments.
During evaluation (meta-test time), the meta-learned objective function can then be used to train a randomly initialized RL agent in a new environment.
3. F ROM DDPG TO G RADIENT -B ASED M ETA -L EARNING OF N EURAL O BJECTIVES
We will formally introduce MetaGenRL as an extension of the DDPG actor-critic framework (Silver et al., 2014; Lillicrap et al., 2016).
In DDPG, a parameterized critic of the form Q θ : S ×
A → R transforms the non-differentiable RL reward maximization problem into a myopic value maximization problem for any s t ∈ S .
This is done by alternating between optimization of the critic Q θ and the (here deterministic) policy π φ .
The critic is trained to minimize the TD-error by following:
[Equation]
, where y t =
r t + γ
[Equation]
π
[Equation]
and the dependence of y t on the parameter vector θ is ignored.
The policy π φ is improved to increase the expected return from arbitrary states by following the gradient ∇ φ (cid:80) s t Q
θ ( s t , π φ ( s t )) .
Both gradients can be computed entirely off-policy by sampling trajectories from a replay buffer.
MetaGenRL builds on this idea of differentiating the critic Q θ with respect to the policy parameters.
It incorporates a parameterized objective function L α that is used to improve the policy (i.e. by following the gradient ∇ φ L α ), which adds one extra level of indirection: The critic Q θ improves
L α , while L α improves the policy π φ .
By ﬁrst differentiating with respect to the objective function parameters α , and then with respect to the policy parameters φ , the critic can be used to measure the effect of updating π φ using L α on the estimated return 2 :
[Equation]
This constitutes a type of second order gradient ∇ α ∇ φ that can be used to meta-train L α to provide better updates to the policy parameters in the future.
In practice we will use batching to optimize Equation 6 over multiple trajectories τ .
Similarly to the policy-gradient estimators from Section 2, the objective function L α ( τ, x ( φ ) , V ) receives as inputs an episode trajectory τ = ( s 0: T − 1 , a 0: T − 1 , r 0: T − 1 ) , the value function estimates of a probabilistic policy π φ ( a t | s t ) the following becomes an expectation under π φ and a reparam- eterizable form is required (Williams, 1988; Kingma & Welling, 2014; Rezende et al., 2014). Here we focus on learning deterministic target policies.
Require: p ( e ) a distribution of environments
P ⇐ { ( e 1 ∼ p ( e ) , φ 1 , θ 1 , B 1 ← ∅ ) , . . . }
(cid:46) Randomly initialize population of agents
Randomly initialize objective function L α while L α has not converged do for e, φ, θ, B ∈ P do (cid:46)
For each agent i in parallel if extend replay buffer B then
Extend B using π φ in e
Sample trajectories from B
Update critic Q θ using TD-error
Update policy by following ∇ φ L α
Compute objective function gradient ∆ i for agent i according to Equation
Sum gradients (cid:80) i ∆ i to update L α
V , and an auxiliary input x ( φ ) (previously π φ ) that can be differentiated with respect to the policy parameters.
The latter is critical to be able to differentiate with respect to φ and in the simplest case it consists of the action as predicted by the policy.
While Equation 6 is used for meta-learning L α , the objective function L α itself is used for policy learning by following ∇ φ L α ( τ, x ( φ ) , V ) .
See Figurefor an overview.
MetaGenRL consists of two phases: During meta-training, we alternate between critic updates, objective function updates, and policy updates to meta-learn an objective function L α as described in Algorithm 1.
During meta-testing in Algorithm 2, we take the learned objective function L α and keep it ﬁxed while training a randomly initialized policy in a new environment to assess its performance.
We note that the inputs to L α are sampled from a replay buffer rather than solely using on-policy data.
If L α were to represent a REINFORCE-type objective then it would mean that differentiating L α yields biased policy gradient estimates.
In our experiments we will ﬁnd that the gradients from L α work much better in comparison to a biased off-policy REINFORCE algorithm, and to an importance-sampled unbiased REINFORCE algorithm, while also improving over the popular on-policy REINFORCE and PPO algorithms.
3. P ARAMETRIZING THE O BJECTIVE F UNCTION
We will implement L α using an LSTM (Gers et al., 2000; Hochreiter & Schmidhuber, 1997) that iterates over τ in reverse order and depends on the current policy action π φ ( s t ) (see Figure 2).
At every time-step L α receives the reward r t , taken action a t , predicted action by the current policy π φ ( s t ) , the time t , and value function estimates V t , V t +1 3 .
At each step the LSTM outputs the objective value l t , all of which are summed to yield a single scalar output value that can be differentiated with respect to φ .
In order to accommodate varying action dimensionalities across different environments, both π φ ( s t ) and a t are ﬁrst convolved and then averaged to obtain an action embedding that does not depend on the action dimensionality.
Additional details, including suggestions for more expressive alternatives are available in Appendix B.
By presenting the trajectory in reverse order to the LSTM (and L α correspondingly), it is able to assign credit to an action a t based on its future impact on the reward, similar to policy gradient estimators. More so, as a general function approximator using these inputs, the LSTM is in principle able to learn different variance and bias reduction techniques, akin to advantage estimates, generalized advantage estimates, or importance weights 4 . Due to these properties, we expect the class of objective functions that is supported to somewhat relate to a REINFORCE (Williams, 1992) estimator that uses generalized advantage estimation (Schulman et al., 2015b).
Require:
A test environment e , and an objective function L α
Randomly initialize π φ , V θ , B ← ∅ while π φ has not converged do if extend replay buffer B then
Extend B using π φ in e
Sample trajectories from B
Update V θ using TD-error
Update policy by following ∇ φ L α
LSTM !
l t !
a t , π ϕ ( s t ) conv !
r t , V t , V t +1 , t
3. G ENERALITY AND E FFICIENCY OF M ETA G EN RL
MetaGenRL offers a general framework for meta-learning objective functions that can represent a wide range of learning algorithms.
In particular, it is only required that both π φ and L α can be differentiated w.r.t.
to the policy parameters φ .
In the present work, we use this ﬂexibility to leverage population-based meta-optimization, increase sample efﬁciency through off-policy secondorder gradients, and to improve the generalization capabilities of meta-learned objective functions.
Population-Based A general objective function should be applicable to a wide range of environments and agent parameters.
To this extent MetaGenRL is able to leverage the collective experience of multiple agents to perform meta-learning by using a single objective function L α shared among a population of agents that each act in their own (potentially different) environment.
Each agent locally computes Equation 6 over a batch of trajectories, and the resulting gradients are combined to update L α .
Thus, the relevant learning experience of each individual agent is compressed into the objective function that is available to the entire population at any given time.
Sample Efﬁciency
An alternative to learning neural objective functions using a population of agents is through evolution as in EPG (Houthooft et al., 2018).
However, we expect meta-learning using second-order gradients as in MetaGenRL to be much more sample efﬁcient.
This is due to off-policy training of the objective function L α and its subsequent off-policy use to improve the policy.
Indeed, unlike in evolution there is no need to train multiple randomly initialized agents in their entirety in order to evaluate the objective function, thus speeding up credit assignment.
Rather, at any point in time, any information that is deemed useful for future environment interactions can directly be incorporated into the objective function.
Finally, using the formulation in Equationone can measure the effects of improving the policy using L α for multiple steps by increasing the corresponding number of gradient steps before applying Q θ , which we will explore in Section 5.2.3.
Meta-Generalization
The focus of this work is to learn general learning rules that during testtime can be applied to vastly different environments.
A strict separation between the policy and the learning rule, the functional form of the latter, and training across many environments all contribute to this.
Regarding the former, a clear separation between the policy and the learning rule as in
MetaGenRL is expected to be advantageous for two reasons.
Firstly, it allows us to specify the number of parameters of the learning rule independent of the policy and critic parameters.
For example, our implementation of L α uses only 15 K parameters for the objective function compared to 384 K parameters for the policy and critic.
Hence, we are able to only use a short description length for the learning rule.
A second advantage that is gained is that the meta-learner is unable to directly change the policy and must, therefore, learn to make use of the objective function.
This makes it difﬁcult for the meta-learner to overﬁt to the training environments.
R ELATED WORK
Among the earliest pursuits in meta-learning are meta-hierarchies of genetic algorithms (Schmidhuber, 1987) and learning update rules in supervised learning (Bengio et al., 1990).
While the former introduced a general framework of entire meta-hierarchies, it relied on discrete non-differentiable programs.
The latter introduced local update rules that included free parameters, which could be learned using gradients in a supervised setting.
Schmidhuber (1993) introduced a differentiable self-referential RNN that could address and modify its own weights, albeit difﬁcult to learn.
Hochreiter et al.
(2001) introduced differentiable meta-learning using RNNs to scale to larger problem instances.
By giving an RNN access to its prediction error, it could implement its own metalearning algorithm, where the weights are the meta-learned parameters, and the hidden states the subject of learning.
This was later extended to the RL setting (Wang et al., 2016; Duan et al., 2016;
Santoro et al., 2016; Mishra et al., 2018) (here refered to as RL 2 ).
As we show empirically in our paper, meta-learning with RL 2 does not generalize well.
It lacks a clear separation between policy and objective function, which makes it easy to overﬁt on training environments.
This is exacerbated by the imbalance of O ( n 2 ) meta-learned parameters to learn O ( n ) activations, unlike in MetaGenRL.
Many other recent meta-learning algorithms learn a policy parameter initialization that is later ﬁnetuned using a ﬁxed reinforcement learning algorithm
(Finn et al., 2017; Schulman et al., 2017; Grant et al., 2018; Yoon et al., 2018).
Different from MetaGenRL, these approaches use second order gradients on the same policy parameter vector instead of using a separate objective function.
Albeit in principle general (Finn & Levine, 2018), the mixing of policy and learning algorithm leads to a complicated way of expressing general update rules.
Similar to RL 2 , adaptation to related tasks is possible, but generalization is difﬁcult (Houthooft et al., 2018).
Objective functions have been learned prior to MetaGenRL.
Houthooft et al.
(2018) evolve an objective function that is later used to train an agent.
Unlike MetaGenRL, this approach is extremely costly in terms of the number of environment interactions required to evaluate and update the objective function.
Most recently, Bechtle et al.
introduced learned loss functions for reinforcement learning that also make use of second-order gradients, but use a policy gradient estimator instead of a Q-function.
Similar to other work, their focus is only on narrow task distributions.
Learned objective functions have also been used for learning unsupervised representations (Metz et al., 2019), DDPG-like meta-gradients for hyperparameter search (Xu et al., 2018), and learning from human demonstrations (Yu et al., 2018).
Concurrent to our work, Alet et al. (2020) uses techniques from architecture search to search for viable artiﬁcial curiosity objectives that are composed of primitive objective functions. Li & Malik (2016; 2017) and Andrychowicz et al. (2016) conduct meta-learning by learning optimizers that update parameters φ by modulating the gradient of some ﬁxed objective function L : ∆ φ = f α ( ∇ φ L ) where α is learned.
They differ from MetaGenRL in that they only modulate the gradient of a ﬁxed objective function L instead of learning L itself.
Another connection exists to meta-learned intrinsic reward functions (Schmidhuber, 1991a; Dayan & Hinton, 1993; Wiering & Schmidhuber, 1996;
Singh et al., 2004; Niekum et al., 2011; Zheng et al., 2018; Jaderberg et al., 2019).
Choosing ∇
φ L α = ˜ ∇ φ (cid:80) Tt =1 ¯ r t ( τ ) , where ¯ r t is a meta-learned reward and ˜ ∇ θ is a gradient estimator (such as a value based or policy gradient based estimator) reveals that meta-learning objective functions includes meta-learning the gradient estimatior ˜ ∇ itself as long as it is expressible by a gradient ∇ θ on an objective L α .
In contrast, for intrinsic reward functions, the gradient estimator ˜ ∇ is normally ﬁxed.
Finally, we note that positive transfer between different tasks (reward functions) as well as environments (e.g. different Atari games) has been shown previously in the context of transfer learning (Kistler et al., 1997; Parisotto et al., 2015; Rusu et al., 2016; 2019; Nichol et al., 2018) and meta-critic learning across tasks (Sung et al., 2017).
In contrast to this work, the approaches that have shown to be successful in this domain rely entirely on human-engineered learning algorithms.
E XPERIMENTS
We investigate the learning and generalization capabilities of MetaGenRL on several continuous control benchmarks including HalfCheetah (Cheetah) and Hopper from MuJoCo (Todorov et al., 2012), and LunarLanderContinuous (Lunar) from OpenAI gym
(Brockman et al., 2016).
These environments differ signiﬁcantly in terms of the properties of the underlying system that is to be controlled, and in terms of the dynamics that have to be learned to complete the environment.
Hence, by training meta-RL algorithms on one environment and testing on other environments they provide a reasonable measure of out-of-distribution generalization. [Table]
In our experiments [Table] we will mainly compare to EPG and to RL 2 to evaluate the efﬁcacy of our approach.
We will also compare to several ﬁxed model-free RL algorithms to measure how well the algorithms meta-learned by MetaGenRL compare to these handcrafted alternatives.
Unless otherwise mentioned, we will meta-train MetaGenRL using 20 agents that are distributed equally over the indicated training environments 5 .
Meta-learning uses clipped double-Q learning, delayed policy & objective updates [Table] and target policy smoothing from TD3 (Fujimoto et al., 2018).
We will allow for 600 K environment interactions per agent during meta-training and then meta-test the objective function for 1 M interactions.
Further details are available in Appendix B.
5. C OMPARISON TO P RIOR
W ORK
Evaluating on previously seen environments We meta-train MetaGenRL on Lunar and compare its ability to train a randomly initialized agent at test-time (i.e. using the learned objective function and keeping it ﬁxed) to DDPG, PPO, and on- and off-policy REINFORCE (both using GAE) across multiple seeds.
Figure 3a shows that MetaGenRL markedly outperforms both the REINFORCE baselines and PPO.
Compared to DDPG, which ﬁnds the optimal policy, MetaGenRL performs only slightly worse on average although the presence of outliers increases its variance.
In particular, we ﬁnd that some meta-test agents get ‘stuck’ for some time before reaching the optimal policy (see
Section A.2 for additional analysis).
Indeed, when evaluating only the best meta-learned objective function that was obtained during meta-training (MetaGenRL (best objective func) in Figure 3a) we are able to observe a strong reduction in variance and even better performance.
We also report results (Figure 3a) when meta-training MetaGenRL on both Lunar and Cheetah , and compare to EPG and RL 2 that were meta-trained on these same environments 6 .
For MetaGenRL we were able to obtain similar performance to meta-training on only Lunar in this case.
In contrast, for EPG it can be observed that even one billion environment interactions is insufﬁcient to ﬁnd a good objective function (in Figure 3a quickly dropping below -300).
Finally, we ﬁnd that RLreaches the optimal policy after 100 million meta-training iterations, and that its performance is unaffected by additional steps during testing on Lunar .
We note that RL 2 does not separate the policy and the learning rule and indeed in a similar ‘within distribution’ evaluation, RL 2 was found successful (Wang et al., 2016; Duan et al., 2016). seeds. [Figure]
Table 1 provides a similar comparison for two other environments.
Here we ﬁnd that in general
MetaGenRL is able to outperform the REINFORCE baselines and PPO, and in most cases (except for Cheetah ) performs similar to DDPG 7 .
We also ﬁnd that MetaGenRL consistently outperforms
EPG, and often RL 2 .
For an analysis of meta-training on more than two environments we refer to
Appendix A
[Figure] Generalization to vastly different environments We evaluate the same objective functions learned by MetaGenRL, EPG and the recurrent dynamics by RL 2 on Hopper , which is signiﬁcantly different compared to the meta-training environments.
Figure 3b shows that the learned objective function by MetaGenRL continues to outperform both PPO and our implementations of REINFORCE, while the best performing conﬁguration is even able to outperform DDPG.
When comparing to related meta-RL approaches, we ﬁnd that MetaGenRL is signiﬁcantly better in this case.
The performance of EPG remains poor, which was expected given what was observed on previously seen environments.
On the other hand, we now ﬁnd that the RL 2 baseline fails completely (resulting in a ﬂat low-reward evaluation), suggesting that the learned learning rule that was previously found to be successful is in fact entirely overﬁtted to the environments that were seen during meta-training.
We were able to observe similar results when using different train and test environment splits as reported in Table 1, and in Appendix A.
5. A NALYSIS 5.2. M ETA -T RAINING P ROGRESSION OF O BJECTIVE F UNCTIONS
Previously we focused on test-time training randomly initialized agents using an objective function that was meta-trained for a total of 600 K steps (corresponding to a total of 12 M environment interactions across the entire population).
We will now investigate the quality of the objective functions during meta-training.
Figure 4 displays the result of evaluating an objective function on Hopper at different intervals during meta-training on Cheetah and Lunar .
Initially ( 28 K steps) it can be seen that due to lack of meta-training there is only a marginal improvement in the return obtained during test time.
However, after only meta-training for 86 K steps we ﬁnd (perhaps surprisingly) that the meta-trained [Figure] × 2 meta-test seeds. objective function is already able to make consistent progress in optimizing a randomly initialized agent during test-time.
On the other hand, we observe large variances at test-time during this phase of meta-training.
Throughout the remaining stages of meta-training we then observe an increase in convergence speed, more stable updates, and a lower variance across seeds.
5.2. A BLATION STUDY
We conduct an ablation study of the neural objective function that was described in Section 3.2.
In particular, we assess the dependence of L α on the value estimates V t , V t +1 and on the time component that could to some extent be learned.
Other ablations, including limiting access to the action chosen or to the received reward, are expected to be disastrous for generalization to any other environment (or reward function) and therefore not explored.
Dependence on t We use a parameterized objective function of the form L α ( a t , r t , V t , π φ ( s t ) | t ∈ 0 , ..., T − 1) as in Figure 2 except that it does not receive information about the time-step t at each step.
Although information about the current time-step is required in order to learn (for example) a generalized advantage estimate (Schulman et al., 2015b), the LSTM could in principle learn such time tracking on it own, and we expect only minor effects on meta-training and during meta-testing.
Indeed in Figure 5b it can be seen that the neural objective function performs well without access to t , although it converges slower on Cheetah during meta-training (Figure 5a).
Dependence on V
We use a parameterized objective function of the form L α ( a t , r t , t, π φ ( s t ) | t ∈ 0 , ..., T − 1) as in Figure 2 except that it does not receive any information about the value estimates at time-step t .
There exist reinforcement learning algorithms that work without value function estimates (eg.
Williams (1992); Schmidhuber & Zhao (1998)), although in the absence of an alternative baseline these often have a large variance.
Similar results are observed for this ablation in Figure 5a [Figure] during meta-training where a possibly large variance appears to affect meta-training.
Correspondingly during test-time (Figure 5b) we do not ﬁnd any meaningful training progress to take place.
In contrast, we ﬁnd that we can remove the dependence on one of the value function estimates, i.e. remove V t +1 but keep V t , which during some runs even increases performance.
5.2. M ULTIPLE GRADIENT STEPS
We analyze the effect of making multiple gradient updates to the policy using L α before applying the critic to compute second-order gradients with respect to the objective function parameters as in Equation 6.
While in previous experiments we have only considered applying a single update, multiple gradient updates might better capture long term effects of the objective function.
At the same time, moving further away from the current policy parameters could reduce the overall quality of the second-order gradients.
Indeed, in Figure 6 it can be observed that using 3 gradient steps already slightly increases the variance during test-time training on Hopper and Cheetah after metatraining on LunarLander and Cheetah .
Similarly, we ﬁnd that further increasing the number of gradient steps to 5 harms performance.
C ONCLUSION
We have presented MetaGenRL, a novel off-policy gradient-based meta reinforcement learning algorithm that leverages a population of DDPG-like agents to meta-learn general objective functions.
Unlike related methods the meta-learned objective functions do not only generalize in narrow task distributions but show similar performance on entirely different tasks while markedly outperforming REINFORCE and PPO.
We have argued that this generality is due to MetaGenRL’s explicit separation of the policy and learning rule, the functional form of the latter, and training across multiple agents and environments.
Furthermore, the use of second order gradients increases MetaGenRL’s sample efﬁciency by several orders of magnitude compared to EPG (Houthooft et al., 2018).
In future work, we aim to further improve the learning capabilities of the meta-learned objective functions, including better leveraging knowledge from prior experiences.
Indeed, in our current implementation, the objective function is unable to observe the environment or the hidden state of the (recurrent) policy.
These extensions are especially interesting as they may allow more complicated curiosity-based (Schmidhuber, 1991b; 1990; Houthooft et al., 2016; Pathak et al., 2017) or model-based (Schmidhuber, 1990; Weber et al., 2017; Ha & Schmidhuber, 2018) algorithms to be learned.
To this extent, it will be important to develop introspection methods that analyze the learned objective function and to scale MetaGenRL to make use of many more environments and agents. A CKNOWLEDGEMENTS
We thank Paulo Rauber, Imanol Schlag and the anonymous reviewers for their feedback.
This work was supported by the ERC Advanced Grant (no: 742870) and computational resources by the Swiss
National Supercomputing Centre (CSCS, project: s978).
We also thank NVIDIA Corporation for donating a DGX-1 as part of the Pioneers of AI Research Award and to IBM for donating a Minsky machine.
A A DDITIONAL R ESULTS A. A LL T RAINING AND T EST R EGIMES
In the main text, we have shown several combinations of meta-training, and testing environments.
We will now show results for all combinations, including the respective human engineered baselines.
[Figure]
Hopper On Hopper (Figure 7)
we ﬁnd that MetaGenRL works well, both in terms of generalization to previously seen environments, and to unseen environments.
The PPO, REINFORCE, RL 2 , and EPG baselines are outperformed signiﬁcantly.
Regarding RL 2 we observe that it is only able to obtain reward when Hopper was included during meta-training, although its performance is generally poor.
Regarding EPG, we observe some learning progress during meta-testing on Hopper after meta-training on Cheetah and Hopper (Figure 7a), although it drops back down quickly as test-time training proceeds.
In contrast, when meta-testing on Hopper after meta-training on Cheetah and Lunar (Figure 7b) no test-time training progress is observed at all.
Cheetah Similar results are observed in Figure 8 for Cheetah , where MetaGenRL outperforms
PPO and REINFORCE signiﬁcantly.
On the other hand, it can be seen that DDPG notably outperforms MetaGenRL on this environment. It will be interesting to further study these differences in the future to improve the expressibility of our approach.
Regarding RL 2 and EPG only within distribution generalization results are available due to Cheetah having larger observations and / or action spaces compared to Hopper and Lunar .
We observe that RL 2 performs similar to our earlier ﬁndings on Hopper but signiﬁcantly improves in terms of within-distribution generalization (likely due to greater overﬁtting, as was consistently observed for other splits). EPG shows initially more promise on within distribution generalization (Figure 8a), but ends up like before.
Lunar On Lunar (Figure 9) we ﬁnd that MetaGenRL is only marginally better compared to the REINFORCE and PPO baselines in terms of within distribution generalization and worse in terms of out of distribution generalization.
Analyzing this result reveals that although many of the runs train rather well, some get stuck during the early stages of training without or only delayed recovering.
These outliers lead to a seemingly very large variance for MetaGenRL in Figure 9b.
We will provide a more detailed analysis of this result in Section A.2. If we focus on the best performing objective function then we observe competitive performance to DDPG (Figure 9a).
Nonetheless, we notice that the objective function trained on Hopper generalizes worse to Lunar , despite our earlier result that objective functions trained on Lunar do in fact generalize well to Hopper .
MetaGenRL is still able to outperform both RL 2 and EPG in terms of out of distribution generalization.
We do note [Figure] [Figure] that EPG is able to meta-learn objective functions that are able to improve to extent
Comparing ﬁnal scores An overview of the ﬁnal scores that were obtained for MetaGenRL in comparison to the human engineered baselines is shown in Table 2.
It can be seen that MetaGenRL outperforms PPO and off-/on-policy REINFORCE in most conﬁgurations while DDPG with TD tricks remains stronger on two of the three environments.
Note that DDPG is currently not among the representable algorithms by MetaGenRL.
A. S TABILITY OF L EARNED O BJECTIVE F UNCTIONS
In the results presented in Figure 9 on Lunar we observed a seemingly large variance for MetaGenRL that was due to outliers.
Indeed, when analyzing the individual runs meta-trained on Lunar and tested on Lunar we found that that one of the runs converged to a local optimum early on during [Table] training and was unable to recover from this afterwards.
On the other hand, we also observed that runs can be ‘stuck’ for a long time to then make very fast learning progress.
It suggests that the objective function may sometimes experience difﬁculties in providing meaningful updates to the policy parameters during the early stages of training.
We have further analyzed this issue by evaluating one of the objective functions at several intervals throughout meta-training in Figure 10.
From the meta-training curve (bottom) it can be seen that meta-training in Lunar converges very early.
This means that from then on, updates to the objective function will be based on mostly converged policies.
As the test-time plots show, these additional updates appear to negatively affect test-time performance.
We hypothesize that the objective function essentially ‘forgets’ about the early stages of training a randomly initialized agent, by only incorporating information about good performing agents.
A possible solution to this problem would be to keep older policies in the meta-training agent population or use early stopping.
Finally, if we exclude four random seeds (of 12), we indeed ﬁnd a signiﬁcant reduction in the variance (and increase in the mean) of the results observed for MetaGenRL (see Figure 11).
A. A BLATION OF A GENT P OPULATION S IZE AND U NIQUE E NVIRONMENTS
In our experiments we have used a population of 20 agents during meta-training to ensure diversity in the conditions under which the objective function needs to optimize. The size of this population is a crucial parameter for a stable meta-optimization.
Indeed, in Figure 12 it can be seen that metatraining becomes increasingly unstable as the number of agents in the population decreases.
Using a similar argument, one would expect to gain from increasing the number of distinct environments (or agents) during meta-training. In order to verify this, we have evaluated two additional
[Figure]
[Figure] [Figure]
settings: Meta-training on Cheetah & Lunar & Walker & Ant with 20 and 40 agents respectively. Figure 13 shows the result of meta-testing on Hopper for these experiments (also see the ﬁnal results reported for 40 agents in Table 2).
Unexpectedly, we ﬁnd that increasing the number of distinct environments does not yield a signiﬁcant improvement and, in fact, sometimes even decrease performance.
One possibility is that this is due to the simple form of the objective function under consideration, which has no access to the environment observations to efﬁciently distinguish between them. Another possibility is that MetaGenRL’s hyperparameters require additional tuning in order to be compatible with these setups.
B E XPERIMENT D ETAILS
In the following we describe all experimental details regarding the architectures used, meta-training, hyperparameters, and baselines.
The code to reproduce our experiments is available at http: //louiskirsch.com/code/metagenrl .
B. N EURAL O BJECTIVE F UNCTION A RCHITECTURE
Neural Architecture
In this work we use an LSTM to implement the objective function (Figure 2).
The LSTM runs backwards in time over the state, action, and reward tuples that were encountered during the trajectory τ under consideration.
At each step t the LSTM receives as input the reward r t , value estimates of the current and previous state V t , V t +1 , the current timestep t and ﬁnally the action that was taken at the current timestep a t in addition to the action as determined by the current policy π φ ( s t ) .
The actions are ﬁrst processed by one dimensional convolutional layers striding over the action dimension followed by a reduction to the mean.
This allows for different action sizes between environments.
Let A ( B ) ∈ R 1 × D be the action from the replay buffer, A ( π ) ∈ R 1 ×
D be the action predicted by the policy, and W ∈ R 2 × N a learnable matrix corresponding to N outgoing units, then the actions are transformed by
[Equation]
where [ a, b ] is a concatenation of a and b along the ﬁrst axis.
This corresponds to a convolution with kernel size 1 and stride 1.
Further transformations with non-linearities can be added after applying
W , if necessary.
We found it helpful (but not strictly necessary) to use ReLU activations for half of the units and square activations for the other half.
At each time-step the LSTM outputs a scalar value l t (bounded between − η and η using a scaled tanh activation), which are summed to obtain the value of the neural objective function.
Differentiating this value with respect to the policy parameters φ then yields gradients that can be used to improve π φ .
We only allow gradients to ﬂow backwards through π φ ( s t ) to φ .
This implementation is closely related to the functional form of a REINFORCE (Williams, 1992) estimator using the generalized advantage estimation (Schulman et al., 2015b).
All feed-forward networks (critic and policy) use ReLU activations and layer normalization (Ba et al., 2016).
The LSTM uses tanh activations for cell and hidden state transformations, sigmoid activations for the gates.
The input time t is normalized between 0 at the beginning of the episode and 1 at the ﬁnal transition.
Any other hyper-parameters can be seen in Table 3.
Extensibility The expressability of the objective function can be further increased through several means.
One possibility is to add the entire sequence of state observations o 1: T to its inputs, or by introducing a bi-directional LSTM.
Secondly, additional information about the policy (such as the hidden state of a recurrent policy) can be provided to L .
Although not explored in this work, this would in principle allow one to learn an objective that encourages certain representations to emerge, e.g. a predictive representation about future observations, akin to a world model (Schmidhuber, 1990;
Ha & Schmidhuber, 2018;
Weber et al., 2017).
In turn, these could create pressure to adapt the policy’s actions to explore unknown dynamics in the environment (Schmidhuber, 1991b; 1990;
Houthooft et al., 2016; Pathak et al., 2017).
B. M ETA -T RAINING
Annealing with DDPG At the beginning of meta-training (learning L α ), the objective function is randomly initialized and thus does not make sensible updates to the policies.
This can lead to irreversibly breaking the policies early during training.
Our current implementation circumvents this issue by linearly annealing ∇ φ L α the ﬁrst 10k timesteps ( ∼ 2% of all timesteps) with DDPG ∇ φ Q θ ( s t , π φ ( s t )) .
Preliminary experiments suggested that an exponential learning rate schedule on the gradient of ∇ φ L α for the ﬁrst 10k steps can replace the annealing with DDPG.
The learning rate anneals exponentially between a learning rate of zero and 1e-3.
However, in some rare cases this may still lead to unsuccessful training runs, and thus we have omitted this approach from the present work.
Standard training During training, the critic is updated twice as many times as the policy and objective function, similar to TD3 (Fujimoto et al., 2018).
One gradient update with data sampled from the replay buffer is applied for every timestep collected from the environment.
The gradient with respect to φ in Equation 6 is combined with φ using a ﬁxed learning rate in the standard way, all other parameter updates use Adam (Kingma & Ba, 2015) with the default parameters.
Any other hyper-parameters can be seen in Table 3 and Table 4.
Using additional gradient steps In our experiments (Section 5.2.3) we analyzed the effect of applying multiple gradient updates to the policy using L α before applying the critic to compute second-order gradients with respect to the objective function parameters.
For two updates, this gives
[Equation]
and can be extended to more than two correspondingly.
Additionally, we use disjoint mini batches of data τ : τ 1 , τ 2 .
When updating the policy using ∇ φ L
α
we continue to use only a single gradient step.
B. B ASELINES RL
The implementation for RL 2 mimics the paper by Duan et al.
(Duan et al., 2016).
However, we were unable to achieve good results with TRPO (Schulman et al., 2015a) on the MuJoCo environments and thus used PPO (Schulman et al., 2017) instead.
The PPO hyperparameters and implementation are taken from rllib (Liang et al., 2018).
Our implementation uses an LSTM with 64 units and does not reset the state of the LSTM for two episodes in sequence.
Resetting after additional episodes were given did not improve training results.
Different action and observation dimensionalities across environments were handled by using an environment wrapper that pads both with zeros appropriately.
We use the ofﬁcial EPG code base https://github.com/openai/EPG from the original paper (Houthooft et al., 2018).
The hyperparameters are taken from the paper, V = 64 noise vectors, an update frequency of M = 64 , and 128 updates for every inner loop, resulting in an inner loop length of 8196 steps.
During meta-test training, we run with the same update frequency for a total of 1 million steps.
PPO & On-Policy REINFORCE with GAE
We use the tuned implementations from https: //spinningup.openai.com/en/latest/spinningup/bench.html which include a
GAE (Schulman et al., 2015b) baseline.
Off-Policy Reinforce with GAE
The implementation is equivalent to MetaGenRL except that the objective function is ﬁxed to be the REINFORCE estimator with a GAE (Schulman et al., 2015b) baseline.
Thus, experience is sampled from a replay buffer.
We have also experimented with an importance weighted unbiased estimator but this resulted in poor performance.
DDPG Our implementation is based on https://spinningup.openai.com/en/ latest/spinningup/bench.html and uses the same TD3 tricks (Fujimoto et al., 2018) and hyperparameters (where applicable) that MetaGenRL uses.
[Table] [Table]