Maximum a Posteriori Policy Optimisation

Abbas Abdolmaleki, Jost Tobias Springenberg, Yuval Tassa, Remi Munos, Nicolas Heess, Martin Riedmiller

Introduction

Model free reinforcement learning algorithms can acquire sophisticated behaviours by interacting with the environment while receiving simple rewards. Recent experiments (Mnih et al., 2015; Jaderberg et al., 2016; Heess et al., 2017) successfully combined these algorithms with powerful deep neural-network approximators while benefiting from the increase of compute capacity.

Unfortunately, the generality and flexibility of these algorithms comes at a price: They can require a large number of samples and – especially in continuous action spaces – suffer from high gradient variance. Taken together these issues can lead to unstable learning and/or slow convergence. Nonetheless, recent years have seen significant progress, with improvements to different aspects of learning algorithms including stability, data-efficiency and speed, enabling notable results on a variety of domains, including locomotion (Heess et al., 2017; Peng et al., 2016), multi-agent behaviour (Bansal et al., 2017) and classical control (Duan et al., 2016).

Two types of algorithms currently dominate scalable learning for continuous control problems: First, Trust-Region Policy Optimisation (TRPO; Schulman et al. 2015) and the derivative family of Proximal Policy Optimisation algorithms (PPO; Schulman et al. 2017b). These policy-gradient algorithms are on-policy by design, reducing gradient variance through large batches and limiting the allowed change in parameters. They are robust, applicable to high-dimensional problems, and require moderate parameter tuning, making them a popular first choice (Ho & Ermon, 2016). However, as on-policy algorithms, they suffer from poor sample efficiency.

In contrast, off-policy value-gradient algorithms such as the Deep Deterministic Policy Gradient (DDPG, Silver et al. 2014; Lillicrap et al. 2016), Stochastic Value Gradient (SVG, Heess et al. 2015), and the related Normalized Advantage Function formulation (NAF, Gu et al. 2016b) rely on experience replay and learned (action-)value functions. These algorithms exhibit much better data efficiency, approaching the regime where experiments with real robots are possible (Gu et al., 2016a; Andrychowicz et al., 2017). While also popular, these algorithms can be difficult to tune, especially for high-dimensional domains like general robot manipulation tasks.

In this paper we propose a novel off-policy algorithm that benefits from the best properties of both classes. It exhibits the scalability, robustness and hyperparameter insensitivity of on-policy algorithms, while offering the data-efficiency of off-policy, value-based methods.

To derive our algorithm, we take advantage of the duality between control and estimation by using Expectation Maximisation (EM), a powerful tool from the probabilistic estimation toolbox, in order to solve control problems. This duality can be understood as replacing the question “what are the actions which maximise future rewards?” with the question “assuming future success in maximising rewards, what are the actions most likely to have been taken?”. By using this estimation objective we have more control over the policy change in both E and M steps, yielding robust learning. We show below that several algorithms, including TRPO, can be directly related to this perspective. We leverage the fast convergence properties of EM-style coordinate ascent by alternating a non-parametric data-based E-step which re-weights state-action samples, with a supervised, parametric M-step using deep neural networks.

In contrast to typical off-policy value-gradient algorithms, the new algorithm does not require gradient of the Q-function to update the policy. Instead it uses samples from the Q-function to compare different actions in a given state. And subsequently it updates the policy such that better actions in that state will have better probabilities to be chosen.

We evaluate our algorithm on a broad spectrum of continuous control problems including a 56 DoF humanoid body. All experiments used the same optimisation hyperparameters With the exception of the number of samples collected between updates.. Our algorithm shows remarkable data efficiency often solving the tasks we consider an order of magnitude faster than the state-of-the-art. A video of some resulting behaviours can be found here youtu.be/he_BPw32PwU.

Background and Notation

Casting Reinforcement Learning (RL) as an inference problem has a long history dating back at least two decades (Dayan & Hinton, 1997). The framework presented here is inspired by a variational inference perspective on RL that has previously been utilised in multiple studies; c.f. Dayan & Hinton (1997); Neumann (2011); Deisenroth et al. (2013); Rawlik et al. (2012); Levine & Koltun (2013); Florensa et al. (2017).

Particular attention has been paid to obtaining maximum entropy policies as the solution to an inference problem. The penalisation of determinism can be seen encouraging both robustness and simplicity. Among these are methods that perform trajectory optimisation using either linearised dynamics (Todorov, 2008; Toussaint, 2009; Levine & Koltun, 2013) or general dynamics as in path integral control (Kappen, 2005; Theodorou et al., 2010). In contrast to these algorithms, here we do not assume the availability of a transition model and avoid on-policy optimisation. A number of other authors have considered the same perspective but in a model-free RL setting (Neumann, 2011; Peters et al., 2010a; Florensa et al., 2017; Daniel et al., 2016) or inverse RL problems (Ziebart et al., 2008). These algorithms are more directly related to our work and can be cast in the same (EM-like) alternating optimisation scheme on which we base our algorithm. However, they typically lack the maximisation (M)-step – with the prominent exception of REPS, AC-REPS, PI2-GPS and MDGPS (Peters et al., 2010a; Wirth et al., 2016; Chebotar et al., 2016; Montgomery & Levine, 2016) to which our algorithm is closely related as outlined below. An interesting recent addition to these approaches is an EM-perspective on the PoWER algorithm (Roux, 2016) which uses the same iterative policy improvement employed here, but commits to parametric inference distributions and avoids an exponential reward transformation, resulting in a harder to optimise lower bound.

As an alternative to these policy gradient inspired algorithms, the class of recent algorithms for soft Q-learning (e.g. Rawlik et al. (2012); Haarnoja et al. (2017); Fox et al. (2016) parameterise and estimate a so called “soft” Q-function directly, implicitly inducing a maximum entropy policy. A perspective that can also be extended to hierarchical policies (Florensa et al., 2017), and has recently been used to establish connections between Q-learning and policy gradient methods (O’Donoghue et al., 2016; Schulman et al., 2017a). In contrast, we here rely on a parametric policy, our bound and derivation is however closely related to the definition of the soft (entropy regularised) Q-function.

A line of work, that is directly related to the “RL as inference” perspective, has focused on using information theoretic regularisers such as the entropy of the policy or the Kullback-Leibler divergence (KL) between policies to stabilise standard RL objectives. In fact, most state-of-the-art policy gradient algorithms fall into this category. For example see the entropy regularization terms used in Mnih et al. (2016) or the KL constraints employed by work on trust-region based methods (Schulman et al., 2015; 2017b; Gu et al., 2017; Wang et al., 2017). The latter methods introduce a trust region constraint, defined by the KL divergence between the new policy and the old policy, so that the expected KL divergence over state space is bounded. From the perspective of this paper these trust-region based methods can be seen as optimising a parametric E-step, as in our algorithm, but are “missing” an explicit M-step.

Finally, the connection between RL and inference has been invoked to motivate work on exploration. The most prominent examples for this are formed by work on Boltzmann exploration such as Kaelbling et al. (1996); Perkins & Precup (2002); Sutton (1990); O’Donoghue et al. (2017), which can be connected back to soft Q-learning (and thus to our approach) as shown in Haarnoja et al. (2017).

2 Markov decision Processes

Maximum a Posteriori Policy Optimisation

Our approach is motivated by the well established connection between RL and probabilistic inference. This connection casts the reinforcement learning problem as that of inference in a particular probabilistic model. Conventional formulations of RL aim to find a trajectory that maximizes expected reward. In contrast, inference formulations start from a prior distribution over trajectories, condition a desired outcome such as achieving a goal state, and then estimate the posterior distribution over trajectories consistent with this outcome.

A finite-horizon undiscounted reward formulation can be cast as inference problem by constructing a suitable probabilistic model via a likelihood function p(O=1∣τ)∝exp⁡(\nicefrac∑trtα)p(O=1|\tau)\propto\exp(\nicefrac{{\sum_{t}r_{t}}}{{\alpha}}), where α\alpha is a temperature parameter. Intuitively, OO can be interpreted as the event of obtaining maximum reward by choosing an action; or the event of succeeding at the RL task (Toussaint, 2009; Neumann, 2011). With this definition we can define the following lower bound on the likelihood of optimality for the policy π\pi:

where pπp_{\pi} is the trajectory distribution induced by policy π(a∣s)\pi(a|s) as described in section 2.2 and q(τ)q(\tau) is an auxiliary distribution over trajectories that will discussed in more detail below. The lower bound J\mathcal{J} is the evidence lower bound (ELBO) which plays an important role in the probabilistic modeling literature. It is worth already noting here that optimizing (2) with respect to qq can be seen as a KL regularized RL problem.

An important motivation for transforming a RL problem into an inference problem is that this allows us draw from the rich toolbox of inference methods: For instance, J\mathcal{J} can be optimized with the familiy of expectation maximization (EM) algorithms which alternate between improving J\mathcal{J} with respect to qq and π\pi. In this paper we follow classical (Dayan & Hinton, 1997) and more recent works (e.g. Peters et al. 2010b; Levine & Koltun 2013; Daniel et al. 2016; Wirth et al. 2016) and cast policy search as a particular instance of this family. Our algorithm then combines properties of existing approaches in this family with properties of recent off-policy algorithms for neural networks.

The algorithm alternates between two phases which we refer to as E and M step in reference to an EM-algorithm. The E-step improves J\mathcal{J} with respect to qq. Existing EM policy search approaches perform this step typically by reweighting trajectories with sample returns (Kober & Peters, 2009) or via local trajectory optimization (Levine & Koltun, 2013). We show how off-policy deep RL techniques and value-function approximation can be used to make this step both scalable as well as data efficient. The M-step then updates the parametric policy in a supervised learning step using the reweighted state-action samples from the E-step as targets.

These choices lead to the following desirable properties: (a) low-variance estimates of the expected return via function approximation; (b) low-sample complexity of value function estimate via robust off-policy learning; (c) minimal parametric assumption about the form of the trajectory distribution in the E-step; (d) policy updates via supervised learning in the M step; (e) robust updates via hard trust-region constraints in both the E and the M step.

The derivation of our algorithm then starts from the infinite-horizon analogue of the KL-regularized expected reward objective from Equation (2). In particular, we consider variational distributions q(τ)q(\tau) that factor in the same way as pπp_{\pi}, i.e. q(τ)=p(s0)∏t>0p(st+1∣st,at)q(at∣st)q(\tau)=p(s_{0})\prod_{t>0}p(s_{t+1}|s_{t},a_{t})q(a_{t}|s_{t}) which yields:

Note that due to the assumption about the structure of q(τ)q(\tau) the KL over trajectories decomposes into a KL over the individual state-conditional action distributions. This objective has also been considered e.g. by Haarnoja et al. (2017); Schulman et al. (2017a). The additional log⁡p(θ)\log p({\boldsymbol{\theta}}) term is a prior over policy parameters and can be motivated by a maximum a-posteriori estimation problem (see appendix for more details).

We also define the regularized Q-value function associated with (3) as

with \textrm{KL}\big{(}q_{t}||\pi_{t}\big{)}=\textrm{KL}\big{(}q(a|s_{t})\big{)}\|\pi(a|s_{t},{\boldsymbol{\theta}})\big{)}. Note that \textrm{KL}\big{(}q_{0}||\pi_{0}\big{)} and p(θ)p(\theta) are not part of the Q-function as they are not a function of the action.

2 E-Step

In the E-step of iteration ii we perform a partial maximization of J(q,θ)\mathcal{J}(q,{\boldsymbol{\theta}}) with respect to qq given θ=θi\theta=\theta_{i}. We start by setting q=πθiq=\pi_{{\boldsymbol{\theta}}_{i}} and estimate the unregularized action-value function:

Maximizing Equation (6), thus obtaining qi=arg⁡max⁡Jˉ(q,θi)q_{i}=\arg\max\bar{\mathcal{J}}(q,\theta_{i}), does not fully optimize J\mathcal{J} since we treat QθiQ_{\theta_{i}} as constant with respect to qq. An intuitive interpretation qiq_{i} is that it chooses the soft-optimal action for one step and then resorts to executing policy π\pi. In the language of the EM algorithm this optimization implements a partial E-step. In practice we also choose μq\mu_{q} to be the stationary distribution as given through samples from the replay buffer.

The reward and the KL terms are on an arbitray relative scale. This can make it difficult to choose α\alpha. We therefore replace the soft KL regularization with a hard constraint with parameter ϵ\epsilon, i.e,

If we choose to explicitly parameterize q(a∣s)q(a|s) – option 1 below – the resulting optimisation is similar to that performed by the recent TRPO algorithm for continuous control (Schulman et al., 2015); only in an off-policy setting. Analogously, the unconstrained objective (6) is similar to the objective used by PPO (Schulman et al., 2017b). We note, however, that the KL is reversed when compared to the KL used by TRPO and PPO.

To implement (7) we need to choose a form for the variational policy q(a∣s)q(a|s). Two options arise:

We can use a parametric variational distribution q(a∣s,θq)q(a|s,{\boldsymbol{\theta}}^{q}), with parameters θq{\boldsymbol{\theta}}^{q}, and optimise Equation (7) via the likelihood ratio or action-value gradients. This leads to an algorithm similar to TRPO/PPO and an explicit M-step becomes unnecessary (see. Alg. 3).

We can choose a non-parametric representation of q(a∣s)q(a|s) given by sample based distribution over actions for a state ss. To achieve generalization in state space we then fit a parametric policy in the M-step. This is possible since in our framework the optimisation of Equation (7) is only the first step of an EM procedure and we thus do not have to commit to a parametric distribution that generalises across the state space at this point.

Fitting a parametric policy in the M-step is a supervised learning problem, allowing us to employ various regularization techniques at that point. It also makes it easier to enforce the hard KL constraint.

Non parametric variational distribution

In the non-parametric case we can obtain the optimal sample based qq distribution over actions for each state – the solution to Equation (7) – in closed form (see the appendix for a full derivation), as,

where we can obtain η∗\eta^{*} by minimising the following convex dual function,

after the optimisation of which we can evaluate qi(a∣s)q_{i}(a|s) on given samples.

This optimization problem is similar to the one solved by relative entropy policy search (REPS) (Peters et al., 2010a) with the difference that we optimise only for the conditional variational distribution q(a∣s)q(a|s) instead of a joint distribution q(a,s)q(a,s) – effectively fixing μq(s)\mu_{q}(s) to the stationary distribution given by previously collected experience – and we use the Q function of the old policy to evaluate the integral over aa. While this might seem unimportant it is crucial as it allows us to estimate the integral over actions with multiple samples without additional environment interaction. This greatly reduces the variance of the estimate and allows for fully off-policy learning at the cost of performing only a partial optimization of J\mathcal{J} as described above.

3 M-step

Given qiq_{i} from the E-step we can optimize the lower bound J\mathcal{J} with respect to θ{\boldsymbol{\theta}} to obtain an updated policy θi+1=arg⁡max⁡θJ(qi,θ){\boldsymbol{\theta}}_{i+1}=\arg\max_{{\boldsymbol{\theta}}}\mathcal{J}(q_{i},{\boldsymbol{\theta}}). Dropping terms independent of θ{\boldsymbol{\theta}} this entails solving for the solution of

which corresponds to a weighted maximum a-posteriroi estimation (MAP) problem where samples are weighted by the variational distribution from the E-step. Since this is essentially a supervised learning step we can choose any policy representation in combination with any prior for regularisation. In this paper we set p(θ)p({\boldsymbol{\theta}}) to a Gaussian prior around the current policy, i.e, p({\boldsymbol{\theta}})\approx\mathcal{N}\Big{(}\mu={\boldsymbol{\theta}}_{i},\Sigma=\frac{F_{{\boldsymbol{\theta}}_{i}}}{\lambda}\Big{)}, where θi{\boldsymbol{\theta}}_{i} are the parameters of the current policy distribution, FθiF_{{\boldsymbol{\theta}}_{i}} is the empirical Fisher information matrix and λ\lambda is a positive scalar.

As shown in the appendix this suggests the following generalized M-step:

which can be re-written as the hard constrained version:

This additional constraint minimises the risk of overfitting the samples, i.e. it helps us to obtain a policy that generalises beyond the state-action samples used for the optimisation. In practice we have found the KL constraint in the M step to greatly increase stability of the algorithm. We also note that in the E-step we are using the reverse, mode-seeking, KL while in the M-step we are using the forward, moment-matching, KL which reduces the tendency of the entropy of the parametric policy to collapse. This is in contrast to other RL algorithms that use M-projection without KL constraint to fit a parametric policy (Peters et al., 2010a; Wirth et al., 2016; Chebotar et al., 2016; Montgomery & Levine, 2016). Using KL constraint in M-step has also been shown effective for stochastic search algorithms (Abdolmaleki et al., 2017).

Policy Evaluation

Our method is directly applicable in an off-policy setting. For this, we have to rely on a stable policy evaluation operator to obtain a parametric representation of the Q-function Qθ(s,a)Q_{\theta}(s,a). We make use of the policy evaluation operator from the Retrace algorithm Munos et al. (2016), which we found to yield stable policy evaluation in practiceWe note that, despite this empirical finding, Retrace may not be guaranteed to be stable with function approximation (Touati et al., 2017).. Concretely, we fit the Q-function Qθi(s,a,ϕ)Q_{\theta_{i}}(s,a,\phi) as represented by a neural network, with parameters ϕ\phi, by minimising the squared loss:

where Qϕ′(s,a)Q_{\phi^{\prime}}(s,a) denotes the output of a target Q-network, with parameters ϕ′\phi^{\prime}, that we copy from the current parameters ϕ\phi after each M-step. We truncate the infinite sum after NN steps by bootstrapping with Qϕ′Q_{\phi^{\prime}} (rather than considering a λ\lambda return). Additionally, b(a∣s)b(a|s) denotes the probabilities of an arbitrary behaviour policy. In our case we use an experience replay buffer and hence bb is given by the action probabilities stored in the buffer; which correspond to the action probabilities at the time of action selection.

Experiments

For our experiments we evaluate our MPO algorithm across a wide range of tasks. Specifically, we start by looking at the continuous control tasks of the DeepMind Control Suite (Tassa et al. (2018), see Figure 1), and then consider the challenging parkour environments recently published in Heess et al. (2017). In both cases we use a Gaussian distribution for the policy whose mean and covariance are parameterized by a neural network (see appendix for details). In addition, we present initial experiments for discrete control using ATARI environments using a categorical policy distribution (whose logits are again parameterized by a neural network) in the appendix.

The suite of continuous control tasks that we are evaluating against contains 18 tasks, comprising a wide range of domains including well known tasks from the literature. For example, the classical cart-pole and acrobot dynamical systems, 2D and Humanoid walking as well as simple low-dimensional planar reaching and manipulation tasks. This suite of tasks was built in python on top of mujoco and will also be open sourced to the public by the time of publication.

While we include plots depicting the performance of our algorithm on all tasks below; comparing it against the state-of-the-art algorithms in terms of data-efficiency. We want to start by directing the attention of the reader to a more detailed evaluation on three of the harder tasks from the suite.

We start by looking at the results for the classical Acrobot task (two degrees of freedom, one continuous action dimension) as well as the 2D walker (which has 12 degrees of freedom and thus a 12 dimensional action space and a 21 dimensional state space) and the hopper standing task. The reward in the Acrobot task is the distance of the robots end-effector to an upright position of the underactuated system. For the walker task it is given by the forward velocity, whereas in the hopper the requirement is to stand still.

Figure 2 shows the results for this task obtained by applying our algorithm MPO as well as several ablations – in which different parts were removed from the MPO optimization – and two baselines: our implementation of Proximal Policy Optimization (PPO) (Schulman et al., 2017b) and DDPG. The hyperparameters for MPO were kept fixed for all experiments in the paper (see the appendix for hyperparameter settings).

1.2 Complete results on the control suite

The results for MPO (non-parameteric) – and a comparison to an implementation of state-of-the-art algorithms from the literature in our framework – on all the environments from the control suite that we tested on are shown in Figure 4. All tasks have rewards that are scaled to be between 0 and 1000. We note that in order to ensure a fair comparison all algorithms ran with exactly the same network configuration, used a single learner (no distributed computation), used the same optimizer and were tuned w.r.t. their hyperparameters for best performance across all tasks. We refer to the appendix for a complete description of the hyperparameters. Our comparison is made in terms of data-efficiency.

2 High-dimensional continuous control

Next we turn to evaluating our algorithm on two higher-dimensional continuous control problems; humanoid and walker. To make computation time bearable in these more complicated domains we utilize a parallel variant of our algorithm: in this implementation K learners are all independently collecting data from an instance of the environment. Updates are performed at the end of each collected trajectory using distributed synchronous gradient descent on a shared set of policy and Q-function parameters (we refer to the appendix for an algorithm description). The results of this experiment are depicted in Figure 3.

For the Humanoid running domain we can observe a similar trend to the experiments from the previous section: MPO quickly finds a stable running policy, outperforming all other algorithms in terms of sample efficiency also in this high-dimensional control problem.

The case for the Walker-2D parkour domain (where we compare against a PPO baseline) is even more striking: where standard PPO requires approximately 1M trajectories to find a good policy MPO finds a solution that is asymptotically no worse than the PPO solution in in about 70k trajectories (or 60M samples), resulting in an order of magnitude improvement. In addition to the walker experiment we have also evaluated MPO on the Parkour domain using a humanoid body (with 22 degrees of freedom) which was learned successfully (not shown in the plot, please see the supplementary video).

3 Discrete control

As a proof of concept – showcasing the robustness of our algorithm and its hyperparameters – we performed an experiment on a subset of the games contained contained in the "Arcade Learning Environment" (ALE) where we used the same hyperparameter settings for the KL constraints as for the continuous control experiments. The results of this experiment can be found in the Appendix.

Conclusion

We have presented a new off-policy reinforcement learning algorithm called Maximum a-posteriori Policy Optimisation (MPO). The algorithm is motivated by the connection between RL and inference and it consists of an alternating optimisation scheme that has a direct relation to several existing algorithms from the literature. Overall, we arrive at a novel, off-policy algorithm that is highly data efficient, robust to hyperparameter choices and applicable to complex control problems. We demonstrated the effectiveness of MPO on a large set of continuous control problems.

The authors would like to thank David Budden, Jonas Buchli, Roland Hafner, Tom Erez, Jonas Degrave, Guillaume Desjardins, Brendan O’Donoghue and many others of the DeepMind team for their support and feedback during the preparation of this manuscript.

References

Appendix A Proof of monotonic improvement for the KL-regularized policy optimization procedure

In this section we prove a monotonic improvement guarantee for KL-regularized policy optimization via alternating updates on π\pi and qq under the assumption that the prior on θ\theta is uninformative.

Let π\pi be an arbitrary policy. For any other policy qq such that, for all x,ax,a, {π(a∣x)>0}  ⟹  {q(a∣x)>0}\{\pi(a|x)>0\}\implies\{q(a|x)>0\}, define the π\pi-regularized reward for policy qq:

Define the π\pi-regularized Bellman operator for policy qq

and the non-regularized Bellman operator for policy qq

Define the π\pi-regularized value function for policy qq as

For any q,π,Vq,\pi,V, we have Vαπ,q≤VqV^{\pi,q}_{\alpha}\leq V^{q} and Tαπ,qV≤TqVT^{\pi,q}_{\alpha}V\leq T^{q}V. Indeed

Define the optimal regularized value function: Vαπ,∗(x)=max⁡qVαπ,q(x)V^{\pi,*}_{\alpha}(x)=\max_{q}V^{\pi,q}_{\alpha}(x), and the optimal (non-regularized) value function: V∗(x)=max⁡qVq(x)V^{*}(x)=\max_{q}V^{q}(x).

The optimal policy of the π\pi-regularized problem qαπ,∗(⋅∣x)=arg⁡max⁡qVαπ,q(x)q^{\pi,*}_{\alpha}(\cdot|x)=\arg\max_{q}V^{\pi,q}_{\alpha}(x) and the optimal policy of the non-regularized problem q∗(⋅∣x)=arg⁡max⁡qVqq^{*}(\cdot|x)=\arg\max_{q}V^{q}.

We have that Vαπ,qV^{\pi,q}_{\alpha} is the unique fixed point of Tαπ,qT^{\pi,q}_{\alpha}, and VqV^{q} is the unique fixed point of TqT^{q}. Thus we have the following Bellman equations: For all x∈Xx\in X,

Notice that (16) holds for all actions a∈Aa\in A, and not in expectation w.r.t. a∼q(⋅∣x)a\sim q(\cdot|x) only.

A.2 Regularized joint policy gradient

We now consider a parametrized policy πθ\pi_{\theta} and consider maximizing the regularized joint policy optimization problem for a given initial state x0x_{0} (this could be a distribution over initial states). Thus we want to find a parameter θ\theta that (locally) maximizes

We start with an initial parameter θ0\theta_{0} and define a sequence of policies πi=πθi\pi_{i}=\pi_{\theta_{i}} parametrized by θi\theta_{i}, in the following way:

where cc is a numerical constant, and gig_{i} is the norm of the gradient (minimized by the algorithm):

Thus we build a sequence of policies (πθi,qi)(\pi_{\theta_{i}},q_{i}) whose values J(θi,qi)\mathcal{J}(\theta_{i},q_{i}) are non-decreasing thus converge to a local maximum. In addition, the improvement is lower-bounded by a constant times the norm of the gradient, thus the algorithm keeps improving the performance until the gradient vanishes (when we reach the limit of the capacity of our representation).

from which we deduce (19). Now, from the definition of qiq_{i}, we have

Now, since Tαπi,qiT^{\pi_{i},q_{i}}_{\alpha} is a monotone operator (i.e. if V1≥V2V_{1}\geq V_{2} elementwise, then Tαπi,qiV1≥Tαπi,qiV2T^{\pi_{i},q_{i}}_{\alpha}V_{1}\geq T^{\pi_{i},q_{i}}_{\alpha}V_{2}) and its fixed point is Vαπi,qiV^{\pi_{i},q_{i}}_{\alpha}, we have

Now, in order to prove (21) we derive the following steps.

From the definition of qi+1q_{i+1} we have, for any xx,

the update rule is θi+1=θi−β∇θf(πi,qi,θi)\theta_{i+1}=\theta_{i}-\beta\nabla_{\theta}f(\pi_{i},q_{i},\theta_{i}). Thus we have that for sufficiently small β\beta,

where g_{i}=\frac{1}{2}\big{\|}\nabla_{\theta}f(\pi_{i},q_{i},\theta_{i})\big{\|}.

where δx0\delta_{x_{0}} is a Dirac (in the row vector x0x_{0}), and PπP^{\pi} is the transition matrix for policy π\pi.

Now a bit of algebra. For two stochastic matrices PP and P′P^{\prime}, we have

Applying this equality to the transition matrices PπkP^{\pi_{k}} and Pπk+1P^{\pi_{k+1}} and since ∥Pπk+1−Pπk∥=O(η)\|P^{\pi_{k+1}}-P^{\pi_{k}}\|=O(\eta), we have:

Appendix B Additional Experiment: Discrete control

As a proof of concept – showcasing the robustness of our algorithm and its hyperparameters – we performed an experiment on a subset of the games contained contained in the "Arcade Learning Environment" (ALE). For this experiment we used the same hyperparameter settings for the KL constraints as for the continuous control experiments as well as the same learning rate and merely altered the network architecture to the standard network structure used by DQN Mnih et al. (2015) – and created a seperate network with the same architecture, but predicting the parameters of the policy distribution. A comparison between our algorithm and well established baselines from the literature, in terms of the mean performance, is listed in Table 1. While we do not obtain state-of-the-art performance in this experiment, the fact that MPO is competitive, out-of-the-box in these domains suggests that combining the ideas presented in this paper with recent advances for RL with discrete actions (Bellemare et al., 2017) could be a fruitful avenue for future work.

Appendix C Experiment details

In this section we give the details on the hyper-parameters used for each experiment. All the continuous control experiments use a feed-forward network except for Parkour-2d were we used the same network architecture as in Heess et al. (2017). Other hyper parameters for MPO with non parametric variational distribution were set as follows,

Hyperparameters for MPO with parametric variational distribution were as follows,

Appendix D Derivation of update rules for a Gaussian Policy

For continuous control we assume that the policy is given by a Gaussian distribution with a full covariance matrix, i.e, π(a∣s,θ)=N(μ,Σ)\pi(\boldsymbol{a}|\boldsymbol{s},{\boldsymbol{\theta}})=\mathcal{N}\left(\mu,\boldsymbol{\Sigma}\right). Our neural network outputs the mean μ=μ(s)\mu=\mu(s) and Cholesky factor A=A(s)A=A(s), such that Σ=AAT\Sigma=AA^{T}. The lower triagular factor AA has positive diagonal elements enforced by the softplus transform Aii←log⁡(1+exp⁡(Aii))A_{ii}\leftarrow\log(1+\exp(A_{ii})).

In this section we provide the derivations and implementation details for the non-parametric variational distribution case for both E-step and M-step.

D.2 E-Step

The E-step with a non-parametric variational solves the following program, where we have replaced expectations with integrals to simplify the following derivations:

First we write the Lagrangian equation, i.e,

Next we maximise the Lagrangian LL w.r.t the primal variable qq. The derivative w.r.t qq reads,

Setting it to zero and rearranging terms we get

However the last exponential term is a normalisation constant for qq. Therefore we can write,

Note that we could write γ\gamma based on π\pi and η\eta. At this point we can derive the dual function,

D.3 M-step

To obtain the KL constraint in the M step we set p(θ)p(\theta) to a Gaussian prior around the current policy, i.e,

where θi{\boldsymbol{\theta}}_{i} are the parameters of the current policy distribution, FθiF_{{\boldsymbol{\theta}}_{i}} is the empirical Fisher information matrix and λ\lambda.

With this, and dropping constant terms our optimization program becomes

We can observe that (θ−θi)TFθi−1(θ−θi)({\boldsymbol{\theta}}-{\boldsymbol{\theta}}_{i})^{T}F^{-1}_{{\boldsymbol{\theta}}_{i}}({\boldsymbol{\theta}}-{\boldsymbol{\theta}}_{i}) is the second order Taylor approximation of ∫μq(s)KL(π(a∣s,θi),π(a∣s,θ))ds\int\mu_{q}(s)\textrm{KL}(\pi(a|s,{\boldsymbol{\theta}}_{i}),\pi(a|s,{\boldsymbol{\theta}}))ds which leads us to the generalized M-step objective:

which corresponds to Equation (11) from the main text, where expectations are replaced by integrals.

After obtaining the non parametric variational distribution in the M step with a Gaussian policy we empirically observed that better results could be achieved by decoupling the KL constraint into two terms such that we can constrain the contribution of the mean and covariance separately i.e.

This decoupling allows us to set different ϵ\epsilon values for each component, i.e., ϵμ,ϵΣ\epsilon_{\mu},\epsilon_{\Sigma} for the mean, the covariance matrix respectively. Different ϵ\epsilon lead to different learning rates. The effectivness of this decoupling has also been shown in Abdolmaleki et al. (2017). We always set a much smaller epsilon for covariance than the mean. The intuition is that while we would like the distribution moves fast in the action space, we also want to keep the exploration to avoid premature convergence.

In order to solve the constrained optimisation in the M-step, we first write the generalised Lagrangian equation, i.e,

Where ημ\eta_{\mu} and ηΣ\eta_{\Sigma} are Lagrangian multipliers. Following prior work on constraint optimisation, we formulate the following primal problem,

In order to solve for θ{\boldsymbol{\theta}} we iteratively solve the inner and outer optimisation programs independently: We fix the Lagrangian multipliers to their current value and optimise for θ{\boldsymbol{\theta}} (outer maximisation) and then fix the parameters θ{\boldsymbol{\theta}} to their current value and optimise for the Lagrangian multipliers (inner minimisation). We continue this procedure until policy parameters θ{\boldsymbol{\theta}} and Lagrangian multipliers converge. Please note that the same approach can be employed to bound the KL explicitly instead of decoupling the contribution of mean and covariance matrix to the KL.

D.4 Parametric variational distribution

In this case we assume our variational distribution also uses a Gaussian distribution over the action space and use the same structure as our policy π\pi.

Similar to the non-parametric case for a Gaussian distribution in the M-step we also use a decoupled KL but this time in the E-step for a Gaussian variational distribution. Using the same reasoning as in the previous section we can obtain the following generalized Lagrangian equation:

Where ημ\eta_{\mu} and ηΣ\eta_{\Sigma} are Lagrangian multipliers. And where we use the advantage function A(a,s)A(a,s) instead of the Q function Q(a,s)Q(a,s), as it empirically gave better performance. Please note that the KL in the E-step is different than the one used in the M-step. Following prior works on constraint optimisation, we can formulate the following primal problem,

In order to solve for θq{\boldsymbol{\theta}}^{q} we iteratively solve the inner and outer optimisation programs independently. In order to that we fix the Lagrangian multipliers to their current value and optimise for θq{\boldsymbol{\theta}}^{q} (outer maximisation), in this case we use the likelihood ratio gradient to compute the gradient w.r.t θq{\boldsymbol{\theta}}^{q}. Subsequently we fix the parameters θq{\boldsymbol{\theta}}^{q} to their current value and optimise for Lagrangian multipliers (inner minimisation). We iteratively continue this procedure until the policy parameters θq{\boldsymbol{\theta}}^{q} and the Lagrangian multipliers converges. Please note that the same approach can be used to bound the KL explicitly instead of decoupling the contribution of mean and covariance matrix to the KL. As our policy has the same structure as the parametric variational distribution, the M step in this case reduce to set the policy parameters θ{\boldsymbol{\theta}} to the parameters θq{\boldsymbol{\theta}}^{q} we obtained in E-step, i.e,

Appendix E Implementation details

While we ran most of our experiments using a single learner, we implemented a scalable variant of the presented method in which multiple workers collect data independently in an instance of the considered environment, compute gradients and send them to a chief (or parameter server) that performs parameter update by averaging gradients. That is we use distributed synchronous gradient descent. These procedures are described in Algorithms 1 and 2 for the non-parametric case and 3 for the parametric case.