Algorithmic Framework for Model-based Deep Reinforcement Learning with Theoretical Guarantees

Yuping Luo, Huazhe Xu, Yuanzhi Li, Yuandong Tian, Trevor Darrell, Tengyu Ma

Introduction

In recent years deep reinforcement learning has achieved strong empirical success, including super-human performances on Atari games and Go (Mnih et al., 2015; Silver et al., 2017) and learning locomotion and manipulation skills in robotics (Levine et al., 2016; Schulman et al., 2015b; Lillicrap et al., 2015). Many of these results are achieved by model-free RL algorithms that often require a massive number of samples, and therefore their applications are mostly limited to simulated environments. Model-based deep reinforcement learning, in contrast, exploits the information from state observations explicitly — by planning with an estimated dynamical model — and is considered to be a promising approach to reduce the sample complexity. Indeed, empirical results (Deisenroth & Rasmussen, 2011b; Deisenroth et al., 2013; Levine et al., 2016; Nagabandi et al., 2017; Kurutach et al., 2018; Pong et al., 2018a) have shown strong improvements in sample efficiency.

Despite promising empirical findings, many of theoretical properties of model-based deep reinforcement learning are not well-understood. For example, how does the error of the estimated model affect the estimation of the value function and the planning? Can model-based RL algorithms be guaranteed to improve the policy monotonically and converge to a local maximum of the value function? How do we quantify the uncertainty in the dynamical models?

It’s challenging to address these questions theoretically in the context of deep RL with continuous state and action space and non-linear dynamical models. Due to the high-dimensionality, learning models from observations in one part of the state space and extrapolating to another part sometimes involves a leap of faith. The uncertainty quantification of the non-linear parameterized dynamical models is difficult — even without the RL components, it is an active but widely-open research area. Prior work in model-based RL mostly quantifies uncertainty with either heuristics or simpler models (Moldovan et al., 2015; Xie et al., 2016; Deisenroth & Rasmussen, 2011a).

Previous theoretical work on model-based RL mostly focuses on either the finite-state MDPs (Jaksch et al., 2010; Bartlett & Tewari, 2009; Fruit et al., 2018; Lakshmanan et al., 2015; Hinderer, 2005; Pirotta et al., 2015; 2013), or the linear parametrization of the dynamics, policy, or value function (Abbasi-Yadkori & Szepesvári, 2011; Simchowitz et al., 2018; Dean et al., 2017; Sutton et al., 2012; Tamar et al., 2012), but not much on non-linear models. Even with an oracle prediction intervalsWe note that the confidence interval of parameters are likely meaningless for over-parameterized neural networks models. or posterior estimation, to the best of our knowledge, there was no previous algorithm with convergence guarantees for model-based deep RL.

Towards addressing these challenges, the main contribution of this paper is to propose a novel algorithmic framework for model-based deep RL with theoretical guarantees. Our meta-algorithm (Algorithm 1) extends the optimism-in-face-of-uncertainty principle to non-linear dynamical models in a way that requires no explicit uncertainty quantification of the dynamical models.

Let VπV^{\pi} be the value function VπV^{\pi} of a policy π\pi on the true environment, and let V^π\widehat{V}^{\pi} be the value function of the policy π\pi on the estimated model M^\widehat{M}. We design provable upper bounds, denoted by Dπ,M^D^{\pi,\widehat{M}}, on how much the error can compound and divert the expected value V^π\widehat{V}^{\pi} of the imaginary rollouts from their real value VπV^{\pi}, in a neighborhood of some reference policy. Such upper bounds capture the intrinsic difference between the estimated and real dynamical model with respect to the particular reward function under consideration.

The discrepancy bounds Dπ,M^D^{\pi,\widehat{M}} naturally leads to a lower bound for the true value function:

Our algorithm iteratively collects batches of samples from the interactions with environments, builds the lower bound above, and then maximizes it over both the dynamical model M^\widehat{M} and the policy π\pi. We can use any RL algorithms to optimize the lower bounds, because it will be designed to only depend on the sample trajectories from a fixed reference policy (as opposed to requiring new interactions with the policy iterate.)

We show that the performance of the policy is guaranteed to monotonically increase, assuming the optimization within each iteration succeeds (see Theorem 3.1.) To the best of our knowledge, this is the first theoretical guarantee of monotone improvement for model-based deep RL.

Readers may have realized that optimizing a robust lower bound is reminiscent of robust control and robust optimization. The distinction is that we optimistically and iteratively maximize the RHS of (1.1) jointly over the model and the policy. The iterative approach allows the algorithms to collect higher quality trajectory adaptively, and the optimism in model optimization encourages explorations of the parts of space that are not covered by the current discrepancy bounds.

In Section 4.2, we design a discrepancy bound that is invariant to the representation of the state space. Here we measure the loss of the model by the difference between the value of the predicted next state and the value of the true next state. Such a loss function is shown to be invariant to one-to-one transformation of the state space. Thus we argue that the loss is an intrinsic measure for the model error without any information beyond observing the rewards. We also refine our bounds in Section A by utilizing some mathematical tools of measuring the difference between policies in χ2\chi^{2}-divergence (instead of KL divergence or TV distance).

Our analysis also sheds light on the comparison between model-based RL and on-policy model-free RL algorithms such as policy gradient or TRPO (Schulman et al., 2015a). The RHS of equation (1.1) is likely to be a good approximator of VπV^{\pi} in a larger neighborhood than the linear approximation of VπV^{\pi} used in policy gradient is (see Remark 4.5.)

Finally, inspired by our framework and analysis, we design a variant of model-based RL algorithms Stochastic Lower Bounds Optimization (SLBO). Experiments demonstrate that SLBO achieves state-of-the-art performance when only 1M samples are permitted on a range of continuous control benchmark tasks.

Notations and Preliminaries

We denote the state space by S\mathcal{S}, the action space by A\mathcal{A}. A policy π(⋅∣s)\pi(\cdot|s) specifies the conditional distribution over the action space given a state ss. A dynamical model M(⋅∣s,a)M(\cdot|s,a) specifies the conditional distribution of the next state given the current state ss and action aa. We will use M⋆M^{\star} globally to denote the unknown true dynamical model. Our target applications are problems with the continuous state and action space, although the results apply to discrete state or action space as well. When the model is deterministic, M(⋅∣s,a)M(\cdot|s,a) is a dirac measure. In this case, we use M(s,a)M(s,a) to denote the unique value of s′s^{\prime} and view MM as a function from S×A\mathcal{S}\times\mathcal{A} to S\mathcal{S}. Let M\mathcal{M} denote a (parameterized) family of models that we are interested in, and Π\Pi denote a (parameterized) family of policies.

Unless otherwise stated, for random variable XX, we will use pXp_{X} to denote its density function.

Let Vπ,MV^{\pi,M} be the value function on the model MM and policy π\pi defined as:

Algorithmic Framework

As mentioned in the introduction, towards optimizing Vπ,M⋆V^{\pi,M^{\star}},Note that in the introduction we used VπV^{\pi} for simplicity, and in the rest of the paper we will make the dependency on M⋆M^{\star} explicit. our plan is to build a lower bound for Vπ,M⋆V^{\pi,M^{\star}} of the following type and optimize it iteratively:

The third requirement for the discrepancy bound DD is that it can be estimated and optimized in the sense that

where ff is a known differentiable function. We can estimate such discrepancy bounds for every π\pi in the neighborhood of πref\pi_{\textup{ref}} by sampling empirical trajectories τ(1),…,τ(n)\tau^{(1)},\dots,\tau^{(n)} from executing policy πref\pi_{\textup{ref}} on the real environment M⋆M^{\star} and compute the average of f(M^,π,τ(i))f(\widehat{M},\pi,\tau^{(i)})’s. We would have to insist that the expectation cannot be over the randomness of trajectories from π\pi on M⋆M^{\star}, because then we would have to re-sample trajectories for every possible π\pi encountered.

For example, assuming the dynamical models are all deterministic, one of the valid discrepancy bounds (under some strong assumptions) that will prove in Section 4 is a multiple of the error of the prediction of M^\widehat{M} on the trajectories from πref\pi_{\textup{ref}}:

Suppose we can establish such an discrepancy bound DD (and the distance function dd) with properties (R1), (R2), and (R3), — which will be the main focus of Section 4 —, then we can devise the following meta-algorithm (Algorithm 1). We iteratively optimize the lower bound over the policy πk+1\pi_{k+1} and the model Mk+1M_{k+1}, subject to the constraint that the policy is not very far from the reference policy πk\pi_{k} obtained in the previous iteration. For simplicity, we only state the population version with the exact computation of Dπref(M^,π)D_{\pi_{\textup{ref}}}(\widehat{M},\pi), though empirically it is estimated by sampling trajectories.

We first remark that the discrepancy bound Dπk(M,π)D_{\pi_{k}}(M,\pi) in the objective plays the role of learning the dynamical model by ensuring the model to fit to the sampled trajectories. For example, using the discrepancy bound in the form of equation (3.2), we roughly recover the standard objective for model learning, with the caveat that we only have the norm instead of the square of the norm in MSE. Such distinction turns out to be empirically important for better performance (see Section 6.2).

Second, our algorithm can be viewed as an extension of the optimism-in-face-of-uncertainty (OFU) principle to non-linear parameterized setting: jointly optimizing MM and π\pi encourages the algorithm to choose the most optimistic model among those that can be used to accurately estimate the value function. (See (Jaksch et al., 2010; Bartlett & Tewari, 2009; Fruit et al., 2018; Lakshmanan et al., 2015; Pirotta et al., 2015; 2013) and references therein for the OFU principle in finite-state MDPs.) The main novelty here is to optimize the lower bound directly, without explicitly building any confidence intervals, which turns out to be challenging in deep learning. In other words, the uncertainty is measured straightforwardly by how the error would affect the estimation of the value function.

Thirdly, the maximization of Vπ,MV^{\pi,M}, when MM is fixed, can be solved by any model-free RL algorithms with MM as the environment without querying any real samples. Optimizing Vπ,MV^{\pi,M} jointly over π,M\pi,M can be also viewed as another RL problem with an extended actions space using the known “extended MDP technique”. See (Jaksch et al., 2010, section 3.1) for details.

Our main theorem shows formally that the policy performance in the real environment is non-decreasing under the assumption that the real dynamics belongs to our parameterized family M\mathcal{M}.We note that such an assumption, though restricted, may not be very far from reality: optimistically speaking, we only need to approximate the dynamical model accurately on the trajectories of the optimal policy. This might be much easier than approximating the dynamical model globally.

Suppose that M⋆∈MM^{\star}\in\mathcal{M}, that DD and dd satisfy equation (R1) and (R2), and the optimization problem in equation (3.3) is solvable at each iteration. Then, Algorithm 1 produces a sequence of policies π0,…,πT\pi_{0},\dots,\pi_{T} with monotonically increasing values:

Moreover, as k→∞k\rightarrow\infty, the value Vπk,M⋆V^{\pi_{k},M^{\star}} converges to some Vπˉ,M⋆V^{\bar{\pi},M^{\star}}, where πˉ\bar{\pi} is a local maximum of Vπ,M⋆V^{\pi,M^{\star}} in domain Π\Pi.

The theorem above can also be extended to a finite sample complexity result with standard concentration inequalities. We show in Theorem G.2 that we can obtain an approximate local maximum in O(1/ε)O(1/\varepsilon) iterations with sample complexity (in the number of trajectories) that is polynomial in dimension and accuracy ε\varepsilon and is logarithmic in certain smoothness parameters.

Since DD and dd satisfy equation (R1), we have that

By the definition that πk+1\pi_{k+1} and Mk+1M_{k+1} are the optimizers of equation (3.3), we have that

Combing the two equations above we complete the proof of equation (3.5).

For the second part of the theorem, by compactness, we have that a subsequence of πk\pi_{k} converges to some πˉ\bar{\pi}. By the monotonicity we have Vπk,M⋆≤Vπˉ,M⋆V^{\pi_{k},M^{\star}}\leq V^{\bar{\pi},M^{\star}} for every k≥0k\geq 0. For the sake of contradiction, we assume πˉ\bar{\pi} is a not a local maximum, then in the neighborhood of πˉ\bar{\pi} there exists π′\pi^{\prime} such that Vπ′,M⋆>Vπˉ,M⋆V^{\pi^{\prime},M^{\star}}>V^{\bar{\pi},M^{\star}} and d(πˉ,π′)<δ/2d(\bar{\pi},\pi^{\prime})<\delta/2. Let tt be such that πt\pi_{t} is in the δ/2\delta/2-neighborhood of πˉ\bar{\pi}. Then we see that (π′,M⋆)(\pi^{\prime},M^{\star}) is a better solution than (πt+1,Mt+1)(\pi_{t+1},M_{t+1}) for the optimization problem (3.3) in iteration tt because Vπ′,M⋆>Vπˉ,M⋆≥Vπt+1,M⋆≥Vπt+1,Mt+1−Dπt(Mt+1,πt+1)V^{\pi^{\prime},M^{\star}}>V^{\bar{\pi},M^{\star}}\geq V^{\pi_{t+1},M^{\star}}\geq V^{\pi_{t+1},M_{t+1}}-D_{\pi_{t}}(M_{t+1},\pi_{t+1}). (Here the last inequality uses equation (R1) with πt\pi_{t} as πref\pi_{\textup{ref}}.) The fact (π′,M⋆)(\pi^{\prime},M^{\star}) is a strictly better solution than (πt+1,Mt+1)(\pi_{t+1},M_{t+1}) contradicts the fact that (πt+1,Mt+1)(\pi_{t+1},M_{t+1}) is defined to be the optimal solution of (3.3) . Therefore πˉ\bar{\pi} is a local maximum and we complete the proof.

Update in Feb 2021. The authors and their collaborators Jiaqi Yang and Kefan Dong recently realized that even though Theorem 3.1 is technically correct, its conditions (R1), (R2), and (R3) cannot simultaneously hold unless we have already obtained enough diverse data to identity M⋆M^{\star} exactly.

Particularly, the condition (R2) and (R3) are at odds with each other—(R3) essentially says that the discrepancy bound DD can only carry information about M⋆M^{\star} through the sampled data, and the non-trivial uncertainty about M⋆M^{\star} from observing only sampled data implies that the discrepancy bound Dπref(M^,π)D_{\pi_{\textup{ref}}}(\widehat{M},\pi) can never be zero (regardless of M⋆=M^M^{\star}=\widehat{M} or not). We can formally see this from the linear bandit setting (which corresponds to the horizon H=1H=1 case.)

Discrepancy Bounds Design

In this section, we design discrepancy bounds that can provably satisfy the requirements (R1), (R2), and (R3). We design increasingly stronger discrepancy bounds from Section 4.1 to Section A.

In this subsection, we assume the dynamical model M⋆M^{\star} is deterministic and we also learn with a deterministic model M^\widehat{M}. Under assumptions defined below, we derive a discrepancy bound DD of the form ∥M^(S,A)−M⋆(S,A)∥\lVert\widehat{M}(S,A)-M^{\star}(S,A)\rVert averaged over the observed state-action pair (S,A)(S,A) on the dynamical model M^\widehat{M}. This suggests that the norm is a better metric than the mean-squared error for learning the model, which is empirically shown in Section 6.2. Through the derivation, we will also introduce a telescoping lemma, which serves as the main building block towards other finer discrepancy bounds.

We make the (strong) assumption that the value function Vπ,M^V^{\pi,\widehat{M}} on the estimated dynamical model is LL-Lipschitz w.r.t to some norm ∥⋅∥\|\cdot\| in the sense that

In other words, nearby starting points should give reward-to-go under the same policy π\pi. We note that not every real environment M⋆M^{\star} has this property, let alone the estimated dynamical models. However, once the real dynamical model induces a Lipschitz value function, we may penalize the Lipschitz-ness of the value function of the estimated model during the training.

We start off with a lemma showing that the expected prediction error is an upper bound of the discrepancy between the real and imaginary values.

Suppose Vπ,M^V^{\pi,\widehat{M}} is LL-Lipschitz (in the sense of (4.1)). Recall κ=γ(1−γ)−1\kappa=\gamma(1-\gamma)^{-1}.

However, in RHS in equation 4.2 cannot serve as a discrepancy bound because it does not satisfy the requirement (R3) — to optimize it over π\pi we need to collect samples from ρπ\rho^{\pi} for every iterate π\pi — the state distribution of the policy π\pi on the real model M⋆M^{\star}. The main proposition of this subsection stated next shows that for every π\pi in the neighborhood of a reference policy πref\pi_{\textup{ref}}, we can replace the distribution ρπ\rho^{\pi} be a fixed distribution ρπref\rho^{\pi_{\textup{ref}}} with incurring only a higher order approximation. We use the expected KL divergence between two π\pi and πref\pi_{\textup{ref}} to define the neighborhood:

In the same setting of Lemma 4.1, assume in addition that π\pi is close to a reference policy πref\pi_{\textup{ref}} in the sense that dKL(π,πref)≤δd^{\textup{KL}}(\pi,\pi_{\textup{ref}})\leq\delta, and that the states in S\mathcal{S} are uniformly bounded in the sense that ∥s∥≤B,∀s∈S\|s\|\leq B,\forall s\in\mathcal{S}. Then,

In a benign scenario, the second term in the RHS of equation (4.4) should be dominated by the first term when the neighborhood size δ\delta is sufficiently small. Moreover, the term BB can also be replaced by max⁡S,A∥M^(S,A)−M⋆(S,A)∥\max_{S,A}\lVert\widehat{M}(S,A)-M^{\star}(S,A)\rVert (see the proof that is deferred to Section C.). The dependency on κ\kappa may not be tight for real-life instances, but we note that most analysis of similar nature loses the additional κ\kappa factor Schulman et al. (2015a); Achiam et al. (2017), and it’s inevitable in the worst-case.

Towards proving Propositions 4.2 and deriving stronger discrepancy bound, we define the following quantity that captures the discrepancy between M^\widehat{M} and M⋆M^{\star} on a single state-action pair (s,a)(s,a).

Note that if M,M^M,\widehat{M} are deterministic, then Gπ,M^(s,a)=Vπ,M^(M^(s,a))−Vπ,M^(M⋆(s,a))G^{\pi,\widehat{M}}(s,a)=V^{\pi,\widehat{M}}(\widehat{M}(s,a))-V^{\pi,\widehat{M}}(M^{\star}(s,a)). We give a telescoping lemma that decompose the discrepancy between Vπ,MV^{\pi,M} and Vπ,M⋆V^{\pi,M^{\star}} into the expected single-step discrepancy GG.

[Telescoping Lemma] Recall that κ:=γ(1−γ)−1\kappa:=\gamma(1-\gamma)^{-1}. For any policy π\pi and dynamical models M,M^M,\widehat{M}, we have that

The proof is reminiscent of the telescoping expansion in Kakade & Langford (2002) (c.f. Schulman et al. (2015a)) for characterizing the value difference of two policies, but we apply it to deal with the discrepancy between models. The detail is deferred to Section B. With the telescoping Lemma 4.3, Proposition 4.1 follows straightforwardly from Lipschitzness of the imaginary value function. Proposition 4.2 follows from that ρπ\rho^{\pi} and ρπref\rho^{\pi_{\textup{ref}}} are close. We defer the proof to Appendix C.

2 Representation-invariant Discrepancy Bounds

The main limitation of the norm-based discrepancy bounds in previous subsection is that it depends on the state representation. Let T\mathcal{T} be a one-to-one map from the state space S\mathcal{S} to some other space S′\mathcal{S}^{\prime}, and for simplicity of this discussion let’s assume a model MM is deterministic. Then if we represent every state ss by its transformed representation Ts\mathcal{T}s, then the transformed model MTM^{\mathcal{T}} defined as MT(s,a)≜TM(T−1s,a)M^{\mathcal{T}}(s,a)\triangleq\mathcal{T}M(\mathcal{T}^{-1}s,a) together with the transformed reward RT(s,a)≜R(T−1s,a)R^{\mathcal{T}}(s,a)\triangleq R(\mathcal{T}^{-1}s,a) and transformed policy πT(s)≜π(T−1s)\pi^{\mathcal{T}}(s)\triangleq\pi(\mathcal{T}^{-1}s) is equivalent to the original set of the model, reward, and policy in terms of the performance (Lemma C.1). Thus such transformation T\mathcal{T} is not identifiable from only observing the reward. However, the norm in the state space is a notion that depends on the hidden choice of the transformation T\mathcal{T}. That said, in many cases the reward function itself is known, and the states have physical meanings, and therefore we may be able to use the domain knowledge to figure out the best norm.

Another limitation is that the loss for the model learning should also depend on the state itself instead of only on the difference M^(S,A)−M⋆(S,A)\widehat{M}(S,A)-M^{\star}(S,A). It is possible that when SS is at a critical position, the prediction error needs to be highly accurate so that the model M^\widehat{M} can be useful for planning. On the other hand, at other states, the dynamical model is allowed to make bigger mistakes because they are not essential to the reward.

Let dKLd^{\textup{KL}} and DGD^{G} be defined as in equation (4.3) and (4.7). Then the choice d=dKLd=d^{\textup{KL}} and D=DGD=D^{G} satisfies the basic requirements (equation (R1) and (R2)). Moreover, GG is invariant w.r.t any one-to-one transformation of the state space (in the sense of equation C.1 in the proof).

The proof follows from the telescoping lemma (Lemma 4.3) and is deferred to Section C. We remark that the first term κε1\kappa\varepsilon_{1} can in principle be estimated and optimized approximately: the expectation be replaced by empirical samples from ρπref\rho^{\pi_{\textup{ref}}}, and Gπ,M^G^{\pi,\hat{M}} is an analytical function of π\pi and M^\widehat{M} when they are both deterministic, and therefore can be optimized by back-propagation through time (BPTT). (When π\pi and M^\widehat{M} and are stochastic with a re-parameterizable noise such as Gaussian distribution Kingma & Welling (2013), we can also use back-propagation to estimate the gradient.) The second term in equation (4.7) is difficult to optimize because it involves the maximum. However, it can be in theory considered as a second-order term because δ\delta can be chosen to be a fairly small number. (In the refined bound in Section A, the dependency on δ\delta is even milder.)

Proposition 4.4 intuitively suggests a technical reason of why model-based approach can be more sample-efficient than policy gradient based algorithms such as TRPO or PPO (Schulman et al., 2015a; 2017). The approximation error of Vπ,M^V^{\pi,\widehat{M}} in model-based approach decreases as the model error ε1,εmax⁡\varepsilon_{1},\varepsilon_{\max} decrease or the neighborhood size δ\delta decreases, whereas the approximation error in policy gradient only linearly depends on the the neighborhood size Schulman et al. (2015a). In other words, model-based algorithms can trade model accuracy for a larger neighborhood size, and therefore the convergence can be faster (in terms of outer iterations.) This is consistent with our empirical observation that the model can be accurate in a descent neighborhood of the current policy so that the constraint (3.4) can be empirically dropped. We also refine our bonds in Section A, where the discrepancy bounds is proved to decay faster in δ\delta.

Additional Related work

Model-based reinforcement learning is expected to require fewer samples than model-free algorithms (Deisenroth et al., 2013) and has been successfully applied to robotics in both simulation and in the real world (Deisenroth & Rasmussen, 2011b; Morimoto & Atkeson, 2003; Deisenroth et al., 2011) using dynamical models ranging from Gaussian process (Deisenroth & Rasmussen, 2011b; Ko & Fox, 2009), time-varying linear models (Levine & Koltun, 2013; Lioutikov et al., 2014; Levine & Abbeel, 2014; Yip & Camarillo, 2014), mixture of Gaussians (Khansari-Zadeh & Billard, 2011), to neural networks (Hunt et al., 1992; Nagabandi et al., 2017; Kurutach et al., 2018; Tangkaratt et al., 2014; Sanchez-Gonzalez et al., 2018; Pascanu et al., 2017). In particular, the work of Kurutach et al. (2018) uses an ensemble of neural networks to learn the dynamical model, and significantly reduces the sample complexity compared to model-free approaches. The work of Chua et al. (2018) makes further improvement by using a probabilistic model ensemble. Clavera et al. (Clavera et al., 2018) extended this method with meta-policy optimization and improve the robustness to model error. In contrast, we focus on theoretical understanding of model-based RL and the design of new algorithms, and our experiments use a single neural network to estimate the dynamical model.

Our discrepancy bound in Section 4 is closely related to the work (Farahmand et al., 2017) on the value-aware model loss. Our approach differs from it in three details: a) we use the absolute value of the value difference instead of the squared difference; b) we use the imaginary value function from the estimated dynamical model to define the loss, which makes the loss purely a function of the estimated model and the policy; c) we show that the iterative algorithm, using the loss function as a building block, can converge to a local maximum, partly by cause of the particular choices made in a) and b). Asadi et al. (2018) also study the discrepancy bounds under Lipschitz condition of the MDP.

Prior work explores a variety of ways of combining model-free and model-based ideas to achieve the best of the two methods (Sutton, 1991; 1990; Racanière et al., 2017; Mordatch et al., 2016; Sun et al., 2018). For example, estimated models (Levine & Koltun, 2013; Gu et al., 2016; Kalweit & Boedecker, 2017) are used to enrich the replay buffer in the model-free off-policy RL. Pong et al. (2018b) proposes goal-conditioned value functions trained by model-free algorithms and uses it for model-based controls. Feinberg et al. (2018); Buckman et al. (2018) use dynamical models to improve the estimation of the value functions in the model-free algorithms.

On the control theory side, Dean et al. (2018; 2017) provide strong finite sample complexity bounds for solving linear quadratic regulator using model-based approach. Boczar et al. (2018) provide finite-data guarantees for the “coarse-ID control” pipeline, which is composed of a system identification step followed by a robust controller synthesis procedure. Our method is inspired by the general idea of maximizing a low bound of the reward in (Dean et al., 2017). By contrast, our work applies to non-linear dynamical systems. Our algorithms also estimate the models iteratively based on trajectory samples from the learned policies.

Strong model-based and model-free sample complexity bounds have been achieved in the tabular case (finite state space). We refer the readers to (Kakade et al., 2018; Dann et al., 2017; Szita & Szepesvári, 2010; Kearns & Singh, 2002; Jaksch et al., 2010; Agrawal & Jia, 2017) and the reference therein. Our work focus on continuous and high-dimensional state space (though the results also apply to tabular case).

Another line of work of model-based reinforcement learning is to learn a dynamic model in a hidden representation space, which is especially necessary for pixel state spaces (Kakade et al., 2018; Dann et al., 2017; Szita & Szepesvári, 2010; Kearns & Singh, 2002; Jaksch et al., 2010). Srinivas et al. (2018) shows the possibility to learn an abstract transition model to imitate expert policy. Oh et al. (2017) learns the hidden state of a dynamical model to predict the value of the future states and applies RL or planning on top of it. Serban et al. (2018); Ha & Schmidhuber (2018) learns a bottleneck representation of the states. Our framework can be potentially combined with this line of research.

Practical Implementation and Experiments

We design with simplification of our framework a variant of model-based RL algorithms, Stochastic Lower Bound Optimization (SLBO). First, we removed the constraints (3.4). Second, we stop the gradient w.r.t MM (but not π\pi) from the occurrence of MM in Vπ,MV^{\pi,M} in equation (3.3) (and thus our practical implementation is not optimism-driven.)

where λ\lambda is a tunable parameter and sg denotes the stop gradient operation.

We note that the term Vπθ,sg(M^ϕ)V^{\pi_{\theta},\textup{sg}(\widehat{M}_{\phi})} depends on both the parameter θ\theta and the parameter ϕ\phi but there is no gradient passed through ϕ\phi, whereas Lϕ(H)\mathcal{L}_{\phi}^{(H)} only depends on the ϕ\phi. We optimize equation (6.2) by alternatively maximizing Vπθ,sg(M^ϕ)V^{\pi_{\theta},\textup{sg}(\widehat{M}_{\phi})} and minimizing Lϕ(H)\mathcal{L}_{\phi}^{(H)}: for the former, we use TRPO with samples from the estimated dynamical model M^ϕ\widehat{M}_{\phi} (by treating M^ϕ\widehat{M}_{\phi} as a fixed simulator), and for the latter we use standard stochastic gradient methods. Algorithm 2 gives a pseudo-code for the algorithm. The nmodeln_{\text{model}} and npolicyn_{\text{policy}} iterations are used to balance the number of steps of TRPO and Adam updates within the loop indexed by ninnern_{\textup{inner}}.In principle, to balance the number of steps, it suffices to take one of nmodeln_{\text{model}} and npolicyn_{\text{policy}} to be 1. However, empirically we found the optimal balance is achieved with larger nmodeln_{\text{model}} and npolicyn_{\text{policy}}, possibly due to complicated interactions between the two optimization problem.

Power of stochasticity and connection to standard MB RL: We identify the main advantage of our algorithms over standard model-based RL algorithms is that we alternate the updates of the model and the policy within an outer iteration. By contrast, most of the existing model-based RL methods only optimize the models once (for a lot of steps) after collecting a batch of samples (see Algorithm 3 for an example). The stochasticity introduced from the alternation with stochastic samples seems to dramatically reduce the overfitting (of the policy to the estimated dynamical model) in a way similar to that SGD regularizes ordinary supervised training. Similar stochasticity can potentially be obtained by an extreme hyperparameter choice of the standard MB RL algorithm: in each outer iteration of Algorithm 3, we only sample a very small number of trajectories and take a few model updates and policy updates. We argue our interpretation of stochastic optimization of the lower bound (6.2) is more natural in that it reveals the regularization from stochastic optimization. Another way to view the algorithm is that the model obtained from line 7 of Algorithm 2 at different inner iteration serves as an ensemble of models. We do believe that a cleaner and easier instantiation of our framework (with optimism) exists, and the current version, though performing very well, is not necessarily the best implementation.

Entropy regularization: An additional component we apply to SLBO is the commonly-adopted entropy regularization in policy gradient method (Williams & Peng, 1991; Mnih et al., 2016), which was found to significantly boost the performance in our experiments (ablation study in Appendix F.5). Specifically, an additional entropy term is added to the objective function in TRPO. We hypothesize that entropy bonus helps exploration, diversifies the collected data, and thus prevents overfitting.

2 Experimental Results

We evaluate our algorithm SLBO (Algorithm 2) on five continuous control tasks from rllab (Duan et al., 2016), including Swimmer, Half Cheetah, Humanoid, Ant, Walker. All environments that we test have a maximum horizon of 500, which is longer than most of the existing model-based RL work (Nagabandi et al., 2017; Kurutach et al., 2018). (Environments with longer horizons are commonly harder to train.) More details can be found in Appendix F.1.

Baselines. We compare our algorithm with 3 other algorithms including: (1) Soft Actor-Critic (SAC) (Haarnoja et al., 2018), the state-of-the-art model-free off-policy algorithm in sample efficiency; (2) Trust-Region Policy Optimization (TRPO) (Schulman et al., 2015a), a policy-gradient based algorithm; and (3) Model-Based TRPO, a standard model-based algorithm described in Algorithm 3. Details of these algorithms can be found in Appendix F.4.We did not have the chance to implement the competitive random search algorithms in (Mania et al., 2018) yet, although our test performance with 500 episode length is higher than theirs with 1000 episode on Half Cheetach (3950 by ours vs 2345 by theirs) and Walker (3650 by ours vs 894 by theirs).

Conclusions

We devise a novel algorithmic framework for designing and analyzing model-based RL algorithms with the guarantee to convergence monotonically to a local maximum of the reward. Experimental results show that our proposed algorithm (SLBO) achieves new state-of-the-art performance on several mujoco benchmark tasks when one million or fewer samples are permitted.

A compelling (but obvious) empirical open question then given rise to is whether model-based RL can achieve near-optimal reward on other more complicated tasks or real-world robotic tasks with fewer samples. We believe that understanding the trade-off between optimism and robustness is essential to design more sample-efficient algorithms. Currently, we observed empirically that the optimism-driven part of our proposed meta-algorithm (optimizing Vπ,M^V^{\pi,\widehat{M}} over M^\widehat{M}) may lead to instability in the optimization, and therefore don’t in general help the performance. It’s left for future work to find practical implementation of the optimism-driven approach.

Update in Feb 2021: It turns out that the conditions of Theorem 3.1 cannot simultaneously hold as noted at the end of Section 3. The follow-up work (Dong et al., 2021) to some extent fixes this issue for some bandit and RL problems with more sophisticated model learning and exploration techniques. It also shows that converging to a global maximum for neural net bandit problems is statistically impossible, which to some degree justifies the local convergence goal of this paper.

We thank the anonymous reviewers for detailed, thoughtful, and helpful reviews. We’d like to thank Emma Brunskill, Chelsea Finn, Shane Gu, Ben Recht, and Haoran Tang for many helpful comments and discussions. We thank Jiaqi Yang and Kefan Dong for their help with the update of the paper in Feb 2021.

References

Appendix A Refined bounds

The theoretical limitation of the discrepancy bound DG(M^,π)D^{G}(\widehat{M},\pi) is that the second term involving εmax⁡\varepsilon_{\max} is not rigorously optimizable by stochastic samples. In the worst case, there seem to exist situations where such infinity norm of Gπ,M^G^{\pi,\widehat{M}} is inevitable. In this section we tighten the discrepancy bounds with a different closeness measure dd, χ2\chi^{2}-divergence, in the policy space, and the dependency on the εmax⁡\varepsilon_{\max} is smaller (though not entirely removed.) We note that χ2\chi^{2}-divergence has the same second order approximation as KL-divergence around the local neighborhood the reference policy and thus locally affects the optimization much.

We start by defining a re-weighted version βπ\beta^{\pi} of the distribution ρπ\rho^{\pi} where examples in later step are slightly weighted up. We can effectively sample from βπ\beta^{\pi} by importance sampling from ρπ\rho^{\pi}

For a policy π\pi, define βπ\beta^{\pi} as the re-weighted version of discounted distribution of the states visited by π\pi on M⋆M^{\star}. Recall that pStπp_{S_{t}^{\pi}} is the distribution of the state at step tt, we define βπ=(1−γ)2∑t=1∞tγt−1pStπ\beta^{\pi}=(1-\gamma)^{2}\sum_{t=1}^{\infty}t\gamma^{t-1}p_{S_{t}^{\pi}}.

Then we are ready to state our discrepancy bound. Let

The discrepancy bound Dχ2D^{\chi^{2}} and closeness measure dχ2d^{\chi^{2}} satisfies requirements (R1) and (R2).

We defer the proof to Section C so that we can group relevant proofs with similar tools together. Some of these tools may be of independent interests and used for better analysis of model-free reinforcement learning algorithms such as TRPO Schulman et al. (2015a), PPO Schulman et al. (2017) and CPO Achiam et al. (2017).

Appendix B Proof of Lemma 4.3

Let WjW_{j} be the cumulative reward when we use dynamical model MM for jj steps and then M^\widehat{M} for the rest of the steps, that is,

By definition, we have that W∞=Vπ,M(s) and W0=Vπ,M^(s)W_{\infty}=V^{\pi,M}(s)\textup{ and }W_{0}=V^{\pi,\widehat{M}}(s). Then, we decompose the target into a telescoping sum,

Combining the equation above with equation (B.1) concludes that

Appendix C Missing Proofs in Section 4

Towards proving the second part of Proposition 4.4 regarding the invariance, we state the following lemma:

Suppose for simplicity the model and the policy are both deterministic. For any one-to-one transformation from S\mathcal{S} to S′\mathcal{S}^{\prime}, let MT(s,a)≜TM(T−1s,a)M^{\mathcal{T}}(s,a)\triangleq\mathcal{T}M(\mathcal{T}^{-1}s,a), RT(s,a)≜R(T−1s,a)R^{\mathcal{T}}(s,a)\triangleq R(\mathcal{T}^{-1}s,a), and πT(s)≜π(T−1s)\pi^{\mathcal{T}}(s)\triangleq\pi(\mathcal{T}^{-1}s) be a set of transformed model, reward and policy. Then we have that (M,π,R)(M,\pi,R) is equivalent to (MT,πT,RT)(M^{\mathcal{T}},\pi^{\mathcal{T}},R^{\mathcal{T}}) in the sense that

where the value function VπT,MTV^{\pi^{\mathcal{T}},M^{\mathcal{T}}} is defined with respect to RTR^{\mathcal{T}}.

Let s0T=Ts,…,s_{0}^{\mathcal{T}}=\mathcal{T}s,\dots, be the sequence of states visited by policy πT\pi^{\mathcal{T}} on model MTM^{\mathcal{T}} starting from ss. We have that s0T=Ts=Ts0s_{0}^{\mathcal{T}}=\mathcal{T}s=\mathcal{T}s_{0}. We prove by induction that stT=Tsts_{t}^{\mathcal{T}}=\mathcal{T}s_{t}. Assume this is true for some value tt, then we prove that st+1T=Tst+1s_{t+1}\mathcal{T}=\mathcal{T}s_{t+1} holds:

Thus we have RT(stT,atT)=R(st,at)R^{\mathcal{T}}(s_{t}^{\mathcal{T}},a_{t}^{\mathcal{T}})=R(s_{t},a_{t}). Therefore VπT,MT(Ts)=Vπ,M(s)V^{\pi^{\mathcal{T}},M^{\mathcal{T}}}(\mathcal{T}s)=V^{\pi,M}(s). ∎

We first show the invariant of GG under deterministic models and policies. The same result applies to stochastic policies with slight modification. Let sT=Tss^{\mathcal{T}}=\mathcal{T}s. We consider the transformation applied to MM and M⋆M^{\star} and the resulting GG function

Note that by Lemma C.1, we have that VπT,MT(MT(sT,a))=Vπ,M(T−1MT(sT,a))=Vπ,M(M(s,a))V^{\pi^{\mathcal{T}},M^{\mathcal{T}}}(M^{\mathcal{T}}(s^{\mathcal{T}},a))=V^{\pi,M}(\mathcal{T}^{-1}M^{\mathcal{T}}(s^{\mathcal{T}},a))=V^{\pi,M}(M(s,a)). Similarly, VπT,MT(M⋆,T(sT,a))=Vπ,M(M⋆(s,a))V^{\pi^{\mathcal{T}},M^{\mathcal{T}}}(M^{\star,\mathcal{T}}(s^{\mathcal{T}},a))=V^{\pi,M}(M^{\star}(s,a)). Therefore we obtain that

By Lemma 4.3 and triangle inequality, we have that

C.2 Proof of Proof of Proposition A.2

Let μ\mu be the distribution of the initial state S0S_{0}, and let P′P^{\prime} and PP be the state-to-state transition kernel under policy π\pi and πref\pi_{\textup{ref}}. Let Gˉ=(1−γ)∑k=0∞γkPk\bar{G}=(1-\gamma)\sum_{k=0}^{\infty}\gamma^{k}P^{k} and Gˉ′=(1−γ)∑k=0∞γkP′k\bar{G}^{\prime}=(1-\gamma)\sum_{k=0}^{\infty}\gamma^{k}{P^{\prime}}^{k}. Under these notations, we can re-write ρπref=Gˉμ\rho^{\pi_{\textup{ref}}}=\bar{G}\mu and ρπ=Gˉ′μ\rho^{\pi}=\bar{G}^{\prime}\mu. Moreover, we observe that βπref=GˉPGˉμ\beta^{\pi_{\textup{ref}}}=\bar{G}P\bar{G}\mu.

Let δ1=(1−γ)−1χGˉμ2(P′,P)1/2\delta_{1}=(1-\gamma)^{-1}\chi^{2}_{\bar{G}\mu}(P^{\prime},P)^{1/2} and δ2=(1−γ)−1χGˉPGˉμ2(P′,P)1/2\delta_{2}=(1-\gamma)^{-1}\chi^{2}_{\bar{G}P\bar{G}\mu}(P^{\prime},P)^{1/2} by the χ2\chi^{2} divergence between P′P^{\prime} and PP, measured with respect to distributions Gˉμ=ρπref\bar{G}\mu=\rho^{\pi_{\textup{ref}}} and GˉPGˉμ=βπref\bar{G}P\bar{G}\mu=\beta^{\pi_{\textup{ref}}}. By Lemma D.1, we have that the χ2\chi^{2}-divergence between the states can be bounded by the χ2\chi^{2}-divergence between the actions in the sense that:

Therefore we obtain that δ1≤(1−γ)−1δ\delta_{1}\leq(1-\gamma)^{-1}\delta, δ2≤(1−γ)−1δ\delta_{2}\leq(1-\gamma)^{-1}\delta. Let f(s)=Gπ,M^(s).f(s)=G^{\pi,\widehat{M}}(s). By Lemma D.4, we can control the difference between ⟨ρπref,f⟩\langle\rho^{\pi_{\textup{ref}}},f\rangle and ⟨ρπ,f⟩\langle\rho^{\pi},f\rangle by

C.3 Proof of Proposition 4.1 and 4.2

By definition of GG and the Lipschitzness of Vπ,M^V^{\pi,\widehat{M}}, we have that ∣Gπ,M^(s,a)∣≤L∣M^(s,a)−M⋆(s,a)∣|G^{\pi,\widehat{M}}(s,a)|\leq L|\widehat{M}(s,a)-M^{\star}(s,a)|. Then, by Lemma 4.3 and triangle inequality, we have that

Let SS be a random variable over the domain S\mathcal{S}. Let π\pi and π′\pi^{\prime} be two policies and and A∼π(⋅∣S)A\sim\pi(\cdot\mid S) and A′∼π′(⋅∣S)A^{\prime}\sim\pi^{\prime}(\cdot\mid S). Let Y∼M(⋅∣S,A)Y\sim M(\cdot\mid S,A) and Y′∼M(⋅∣S,A′)Y^{\prime}\sim M(\cdot\mid S,A^{\prime}) be the random variables for the next states under two policies. Then,

By definition, we have that Y∣S=s,A=aY|S=s,A=a has the same density as Y′∣S=s,A′=aY^{\prime}|S=s,A^{\prime}=a for any aa and ss. Therefore by Theorem E.4 (setting X,X′,Y,Y′X,X^{\prime},Y,Y^{\prime} in Theorem E.4 by A∣S=sA|S=s, A′∣S=sA^{\prime}|S=s, Y∣S=sY|S=s, Y′∣S=sY^{\prime}|S=s respectively), we have

Taking expectation over the randomness of SS we complete the proof.

In this subsection, we consider bounded the difference of the distributions induced by two markov process starting from the same initial distributions μ\mu. Let P,P′P,P^{\prime} be two transition kernels. Let G=∑k=0∞γkPkG=\sum_{k=0}^{\infty}\gamma^{k}P^{k} and Gˉ=(1−γ)G\bar{G}=(1-\gamma)G. Define G′G^{\prime} and Gˉ′\bar{G}^{\prime} similarly. Therefore we have that Gˉμ\bar{G}\mu is the discounted distribution of states visited by the markov process starting from distribution μ\mu. In other words, if μ\mu is the distribution of S0S_{0}, and PP is the transition kernel induced by some policy π\pi, then Gˉμ=ρπ\bar{G}\mu=\rho^{\pi}.

First of all, let Δ=γ(P′−P)\Delta=\gamma(P^{\prime}-P) and we note that with simple algebraic manipulation,

We start off with a simple lemma that controls the form ⟨p−q,f⟩\langle p-q,f\rangle by the χ2\chi^{2} divergence between pp and qq. With this lemma we can reduce our problem of bounding ⟨(Gˉ′−G)μ,f⟩\langle(\bar{G}^{\prime}-G)\mu,f\rangle to characterizing the χ2\chi^{2} divergence between Gˉ′μ\bar{G}^{\prime}\mu and Gˉμ\bar{G}\mu.

Let pp and qq be probability distributions. Then we have

The following Lemma is a refinement of the lemma above. It deals with the distributions pp and qq with the special structure p=WP′μp=WP^{\prime}\mu and q=WPμq=WP\mu.

Let W,P′,PW,P^{\prime},P be transition kernels and μ\mu be a distribution. Then,

where χμ2(P′,P)\chi^{2}_{\mu}(P^{\prime},P) is a divergence between transitions defined in Definition E.3.

By Lemma D.2 with p=WPμp=WP\mu and q=WP′μq=WP^{\prime}\mu, we conclude that

By Theorem E.4 and Theorem E.5 we have that χ2(WP′μ,WPμ)≤χ2(P′μ,Pμ)≤χμ2(P′,P)\chi^{2}(WP^{\prime}\mu,WP\mu)\leq\chi^{2}(P^{\prime}\mu,P\mu)\leq\chi^{2}_{\mu}(P^{\prime},P), plugging this into the equation above we complete the proof. ∎

Now we are ready to state the main result of this subsection.

Let Gˉ,Gˉ′,P′,P,f\bar{G},\bar{G}^{\prime},P^{\prime},P,f as defined in the beginning of this section. Let δ1=(1−γ)−1χGˉμ2(P′,P)1/2\delta_{1}=(1-\gamma)^{-1}\chi^{2}_{\bar{G}\mu}(P^{\prime},P)^{1/2} and δ2=(1−γ)−1χGˉPGˉμ2(P′,P)1/2\delta_{2}=(1-\gamma)^{-1}\chi^{2}_{\bar{G}P\bar{G}\mu}(P^{\prime},P)^{1/2}. Then,

By Holder inequality and the fact that ∥Gˉ∥1→1=1\|\bar{G}\|_{1\rightarrow 1}=1, ∥Gˉ′∥1→1=1\|\bar{G}^{\prime}\|_{1\rightarrow 1}=1 and ∥P∥1→1=1\|P\|_{1\rightarrow 1}=1, we have

Combining equation (D.3) and (D.5) we complete the proof of equation (D.2).

Next we bound ⟨Gˉ′PGˉμ,f2⟩1/2\langle\bar{G}^{\prime}P\bar{G}\mu,f^{2}\rangle^{1/2} in a more refined manner. By equation (D.1), we have

By Holder inequality and the fact that ∥Gˉ∥1→1=1\|\bar{G}\|_{1\rightarrow 1}=1, ∥Gˉ′∥1→1=1\|\bar{G}^{\prime}\|_{1\rightarrow 1}=1 and ∥P∥1→1=1\|P\|_{1\rightarrow 1}=1, we have

Then, combining equation (D.3), (D.4), (D.9), we have

The following Lemma is a stronger extension of Lemma D.4, which can be used to future improve Proposition A.2, and may be of other potential independent interests. We state it for completeness.

Let Gˉ,Gˉ′,P′,P,f\bar{G},\bar{G}^{\prime},P^{\prime},P,f as defined in the beginning of this section. Let dk=(GˉP)kGˉμd_{k}=(\bar{G}P)^{k}\bar{G}\mu and δk=(1−γ)−1χdk−12(P′,P)1/2\delta_{k}=(1-\gamma)^{-1}\chi^{2}_{d_{k-1}}(P^{\prime},P)^{1/2}, then we have that for any KK,

By the first equation of Lemma D.4, we got the case for K=1K=1. Assuming we have proved the case for KK, then applying

By Cauchy-Schwartz inequality, we obtain that

Plugging the equation above into equation (D.10), we provide the induction hypothesis for the case with K+1K+1.

Now applying ⟨Gˉ′Δ(GˉP)KGˉμ,f2K⟩2−K≤∥f∥∞\langle\bar{G}^{\prime}\Delta(\bar{G}P)^{K}\bar{G}\mu,f^{2^{K}}\rangle^{2^{-K}}\leq\|f\|_{\infty} with equation (D.10) we complete the proof.

Appendix E Toolbox

The Neyman χ2\chi^{2} distance between two distributions pp and qq is defined as

For notational simplicity, suppose two random variables XX and YY has distributions pXp_{X} and pYp_{Y}, we often write χ2(X,Y)\chi^{2}(X,Y) as a simplification for χ2(pX,pY)\chi^{2}(p_{X},p_{Y}).

The Kullback-Leibler (KL) divergence between two distributions p,qp,q is bounded from above by the χ2\chi^{2} distance:

Since log⁡\log is a concave function, by Jensen inequality we have

Given two transition kernels P,P′P,P^{\prime}. For any distribution μ\mu, we define χμ2(P′,P)\chi^{2}_{\mu}(P^{\prime},P) as:

Suppose random variables (X,Y)(X,Y) and (X′,Y′)(X^{\prime},Y^{\prime}) satisfy that pY∣X=pY′∣X′p_{Y\mid X}=p_{Y^{\prime}\mid X^{\prime}}. Then

Or equivalently, for any transition kernel PP and distribution μ,μ′\mu,\mu^{\prime}, we have

Denote pY∣X(y∣x)=pY′∣X′(y∣x)p_{Y\mid X}(y\mid x)=p_{Y^{\prime}\mid X^{\prime}}(y\mid x) by p(y∣x)p(y\mid x), and we rewrite pXp_{X} as pp and pX′p_{X^{\prime}} as p′p^{\prime}. By Cauchy-Schwarz inequality, we have:

Let X,Y,Y′X,Y,Y^{\prime} are three random variables. Then,

We note that the expectation on the right hand side is over the randomness of XX.Observe χ2(Y∣X,Y′∣X)\chi^{2}(Y|X,Y^{\prime}|X) deterministically depends on XX. As a direct corollary, we have for transition kernel P′P^{\prime} and PP and distribution μ\mu,

We denote pY′∣X(y∣x)p_{Y^{\prime}|X}(y|x) by p′(y∣x)p^{\prime}(y\mid x) and pY∣X(y∣x)p_{Y|X}(y|x) by p(y∣x)p(y|x), and let p(x)p(x) be a simplification for pX(x)p_{X}(x). We have by Cauchy-Schwarz,

Let μ\mu be a distribution over the state space S\mathcal{S}. Let PP and P′P^{\prime} be two transition kernels. G=∑k=0∞(γP)k=(Id−γP)−1G=\sum_{k=0}^{\infty}(\gamma P)^{k}=(\textup{Id}-\gamma P)^{-1} and G′=∑k=0∞(γP′)k=(Id−γP′)−1G^{\prime}=\sum_{k=0}^{\infty}(\gamma P^{\prime})^{k}=(\textup{Id}-\gamma P^{\prime})^{-1}. Let d=(1−γ)Gμd=(1-\gamma)G\mu and d′=(1−γ)G′μd^{\prime}=(1-\gamma)G^{\prime}\mu be the discounted distribution starting from μ\mu induced by the transition kernels GG and G′G^{\prime}. Then,

Moreover, let γ(P′−P)=Δ\gamma(P^{\prime}-P)=\Delta. Then, we have

Replacing G′G^{\prime} in the RHS of the equation (E.2) by G′=G+G′ΔGG^{\prime}=G+G^{\prime}\Delta G, and doing this recursively gives

Let π\pi and π′\pi^{\prime} be two policies and let ρπ\rho^{\pi} be defined as in Definition 2.1. Then,

Let PP and P′P^{\prime} be the state-state transition matrix under policy π\pi and π′\pi^{\prime} and Δ=γ(P′−P)\Delta=\gamma(P^{\prime}-P) By Claim E.6, we have that

Appendix F Implementation Details

We benchmark our algorithm on six tasks based on physics simulator Mujoco (Todorov et al., 2012). We use rllab’s implementation (Duan et al., 2016) commit b3a2899 in https://github.com/rll/rllab/ to interact with Mujoco. All the environments we use have a maximum horizon of 500 steps. We remove all contact information from observation. To compute reward from states, we put the velocity of center of mass into the states.

F.2 Network Architecture and Model Learning

F.3 SLBO Details

The dynamical model is represented by a feed-forward neural network with two hidden layers, each of which contains 500 hidden units. The activation function at each layer is ReLU. We use Adam to optimize the loss function with learning rate 10−310^{-3} and L2L_{2} regularization 10−510^{-5}. The network does not predict the next state directly; instead, it predicts the normalized difference of st+1−sts_{t+1}-s_{t}. The normalization scheme and statistics are the same as those of observations: We maintain μ,σ\mu,\sigma from collected data in the real environment and may change them as we collect more, and the normalized difference is st+1−st−σμ\frac{s_{t+1}-s_{t}-\sigma}{\mu}.

The policy network is a feed-forward network with two hidden layers, each of which contains 32 hidden units. The policy network uses tanh⁡\tanh as activation function and outputs a Gaussian distribution N(μ(s),σ2)\mathcal{N}(\mu(s),\sigma^{2}) where σ\sigma a state-independent trainable vector.

During our evaluation, we use H=2H=2 for multi-step model training and the batch size is given by 256H=128\frac{256}{H}=128, i.e., we enforce the model to see 256 transitions at each batch.

We run our algorithm nouter=100n_{\text{outer}}=100 iterations. We collect ntrain=10000n_{\text{train}}=10000 steps of real samples from the environment at the start of each iteration using current policy with Ornstein-Uhlunbeck noise (with parameter θ=0.15,σ=0.3\theta=0.15,\sigma=0.3) for better exploration. At each iteration, we optimize dynamics model and policy alternatively for ninner=20n_{\text{inner}}=20 times. At each iteration, we optimize dynamics model for nmodel=100n_{\text{model}}=100 times and optimize policy for npolicy=40n_{\text{policy}}=40 times.

F.4 Baselines

TRPO hyperparameters are listed at Table 1, which are the same as OpenAI Baselines’ implementation. These hyperparameters are fixed for all experiments where TRPO is used, including ours, MB-TRPO and MF-TRPO. We do not tune these hyperparameters. We also normalize observations as our algorithm and OpenAI Baselines do.

We use a neural network as the value function to reduce variance, which has 2 hidden layers of units 64 and uses tanh⁡\tanh as activation functions. We use Generalized Advantage Estimator (GAE) Schulman et al. (2015b) to estimate advantages. Both TRPO used in our algorithm and that in model-free algorithm share the same set of hyperparameters.

SAC

For fair comparison, we do not use a large policy network (2 hidden layers, one of which has 256 hidden units) as the authors suggest, but use exactly the same policy network as ours. All other hyperparameters are kept the same as the authors’. Note that Q network and value network have 256 hidden units at each hidden layers, which is more than TRPO’s. We refer the readers to Haarnoja et al. (2018) Appendix D for more details.

MB-TRPO

Model-Based TRPO (MB-TRPO) is similar to our algorithm SLBO but does not optimize model and policy alternatively during one iteration. We do not tune the hyperparameter nmodeln_{\text{model}} since any number beyond a certain threshold would bring similar results. For npolicyn_{\text{policy}} we try {100,200,400,800}\{100,200,400,800\} on Ant and find npolicy=200n_{\text{policy}}=200 works best in Ant so we use it for all other environments. Note that when Algo 2 uses 800 Adam updates (per outer iteration), it has the same amount of updates (per outer iteration) as in Algo 3. As suggested by Section 2, we use 0.005 as the coefficient of entropy bonus for all experiments.

SLBO

We tune multi-step model training parameter H∈{1,2,4,8}H\in\{1,2,4,8\}, entropy regularization coefficient λ∈{0,0.001,0.003,0.005}\lambda\in\{0,0.001,0.003,0.005\} and npolicy∈{10,20,40}n_{\text{policy}}\in\{10,20,40\} on Ant and find H=2,λ=0.005,npolicy=40H=2,\lambda=0.005,n_{\text{policy}}=40 work best, then we fix them in all environments, though environment-specific hyperparameters may work better. The other hyperparameters, including ninner,nmodeln_{\text{inner}},n_{\text{model}} and network architecture, are never tuned. We observe that at the first several iterations, the policy overfits to the learnt model so a reduction of npolicyn_{\text{policy}} at the beginning can further speed up convergence but we omit this for simplicity.

The most important hyperparameters we found are npolicyn_{\text{policy}} and the coefficient in front of the entropy regularizer λ\lambda. It seems that once nmodeln_{\text{model}} is large enough we don’t see any significant changes. We did have a held-out set for model prediction (with the same distribution as the training set) and found out the model doesn’t overfit much. As mentioned in F.3, we also found out normalizing the state helped a lot since the raw entries in the state have different magnitudes; if we don’t normalize them, the loss will be dominated by the loss of some large entries.

F.5 Ablation Study

We compare multi-step model training with single-step model training and the results are shown on Figure 2. Note that H=1H=1 means we use single-step model training. We observe that small HH (e.g., 2 or 4) can be beneficial, but larger HH (e.g., 8) can hurt. We hypothesize that smaller HH can help the model learn the uncertainty in the input and address the error-propagation issue to some extent. Pathak et al. (2018) uses an auto-regressive recurrent model to predict a multi-step loss on a trajectory, which is closely related to ours. However, theirs differs from ours in the sense that they do not use the predicted output xt+1x_{t+1} as the input for the prediction of xt+2x_{t+2}, and so on and so forth.

Entropy regularization

Figure 3 shows that entropy reguarization can improve both sample efficiency and final performance. More entropy regularization leads to better sample efficiency and higher total rewards. We observe that in the late iterations of training, entropy regularization may hurt the performance thus we stop using entropy regularization in the second half of training.

SLBO with 4M training steps

Figure 4 shows that SLBO is superior to SAC and MF-TRPO in Swimmer, Half Cheetah, Walker and Humanoid when 4 million samples or fewer samples are allowed. For Ant environment , although SLBO with less than one million samples reaches the performance of MF-TRPO with 8 million samples, SAC’s performance surpasses SLBO after 2 million steps of training. Since model-free TRPO almost stops improving after 8M steps and our algorithms uses TRPO for optimizing the estimated environment, we don’t expect SLBO can significantly outperform the reward of TRPO at 8M steps. The result shows that SLBO is also satisfactory in terms of asymptotic convergence (compared to TRPO.) It also indicates a better planner or policy optimizer instead of TRPO might be necessary to further improve the performance.

Appendix G Sample Complexity Bounds

When DD satisfies (R3), we use L^πref,δπ,M\widehat{L}_{\pi_{\textup{ref}},\delta}^{\pi,M} to denotes its empirical estimates. Namely, we replace the expectation in equation (R3) by empirical samples τ(1),…,τ(n)\tau^{(1)},\dots,\tau^{(n)}. In other words, we optimize

Let pp be the total number of parameters in the policy and model parameterization. We assume that we have a discrepancy bound Dπref(π,M)D_{\pi_{\textup{ref}}}(\pi,M) satisfying (R3) with a function ff that is bounded with [−Bf,Bf][-B_{f},B_{f}] and that is LfL_{f}-Lipschitz in the parameters of π\pi and MM. That is, suppose π\pi is parameterized by θ\theta and MM is parameterized by ϕ\phi, then we require ∣f(Mϕ,ϕθ,τ)−f(Mϕ′,ϕθ′,τ)∣≤Lf(∥ϕ−ϕ′∥22+∥θ−θ′∥2)|f(M_{\phi},\phi_{\theta},\tau)-f(M_{\phi^{\prime}},\phi_{\theta^{\prime}},\tau)|\leq L_{f}(\|\phi-\phi^{\prime}\|_{2}^{2}+\|\theta-\theta^{\prime}\|^{2}) for all τ\tau, θ,θ′,ϕ,ϕ′\theta,\theta^{\prime},\phi,\phi^{\prime}. We note that LfL_{f} is likely to be exponential in dimension due to the recursive nature of the problem, but our bounds only depends on its logarithm. We also restrict our attention to parameters in an Euclidean ball {θ:∥θ∥2≤B}\{\theta:\|\theta\|_{2}\leq B\} and {ϕ:∥ϕ∥2≤B}\{\phi:\|\phi\|_{2}\leq B\}. Our bounds will be logarithmic in BB.

We need the following definition of approximate local maximum since with sampling error we cannot hope to converge to the exact local maximum.

We say π\pi is a (δ,ε)(\delta,\varepsilon)-local maximum of Vπ,M⋆V^{\pi,M^{\star}} with respect to the constraint set Π\Pi and metric dd, if for any π′∈Π\pi^{\prime}\in\Pi with d(π,π′)≤δd(\pi,\pi^{\prime})\leq\delta, we have Vπ,M⋆≥Vπ′,M⋆−εV^{\pi,M^{\star}}\geq V^{\pi^{\prime},M^{\star}}-\varepsilon.

We show a sample complexity bounds that scales linearly in pp and logarithmically in Lf,BL_{f},B and BfB_{f}.

Let ε>0\varepsilon>0. In the setting of Theorem 3.1, under the additional assumptions above, suppose we use n=O(Bfplog⁡(BLf/ε)/ε2)n=O(B_{f}p\log(BL_{f}/\varepsilon)/\varepsilon^{2}) trajectories to estimate the discrepancy bound in Algorithm 1. Then, for any tt, if πt\pi_{t} is not a (δ,ε)(\delta,\varepsilon)-local maximum, then the total reward will increase in the next step: with high probability,

As a direct consequence, suppose the maximum possible total reward is BRB_{R} and the initial total reward is 0, then for some T=O(BR/ε)T=O(B_{R}/\varepsilon), we have that πT\pi_{T} is a (δ,ε)(\delta,\varepsilon)-local maximum of the Vπ,M⋆V^{\pi,M^{\star}}.

By Hoeffiding’s inequality, we have for fix π\pi and M^\widehat{M}, with probability 1−nO(1)1-n^{O(1)} over the randomness of τ(1),…,τ(n)\tau^{(1)},\dots,\tau^{(n)},

In more succinct notations, we have ∣D^πk,δ(M,π)−Dπk,δ(M,π)∣≤4Bflog⁡nn|\widehat{D}_{\pi_{k},\delta}(M,\pi)-D_{\pi_{k},\delta}(M,\pi)|\leq 4\sqrt{\frac{B_{f}\log n}{n}}, and therefore

By a standard ε\varepsilon-cover + union bound argument, we can prove the uniform convergence: with high probability (at least 1−nO(1)1-n^{O(1)}) over the choice of τ(1),…,τ(n)\tau^{(1)},\dots,\tau^{(n)}, for all policy and model, for all policy π\pi and dynamics MM,

Suppose at iteration tt, we are at policy πt\pi_{t} which is not a (δ,ε)(\delta,\varepsilon)-local maximum of Vπ,M⋆V^{\pi,M^{\star}}. Then, there exists π′\pi^{\prime} such that d(π′,πt)≤δd(\pi^{\prime},\pi_{t})\leq\delta and

Note that the total reward can only improve by ε/2\varepsilon/2 for at most O(BR/ε)O(B_{R}/\varepsilon) steps. Therefore, in the first O(BR/ε)O(B_{R}/\varepsilon) iterations, we must have hit a solution that is a (δ,ε)(\delta,\varepsilon)-local maximum. This completes the proof.