Title: TRUNCATED HORIZON POLICY SEARCH: COMBINING REINFORCEMENT LEARNING & IMITATION LEARNING

Abstract: In this paper, we propose to combine imitation and reinforcement learning via the idea of reward shaping using an oracle. We study the effectiveness of the nearoptimal cost-to-go oracle on the planning horizon and demonstrate that the costto-go oracle shortens the learner's planning horizon as function of its accuracy: a globally optimal oracle can shorten the planning horizon to one, leading to a onestep greedy Markov Decision Process which is much easier to optimize, while an oracle that is far away from the optimality requires planning over a longer horizon to achieve near-optimal performance. Hence our new insight bridges the gap and interpolates between imitation learning and reinforcement learning. Motivated by the above mentioned insights, we propose Truncated HORizon Policy Search (THOR), a method that focuses on searching for policies that maximize the total reshaped reward over a finite planning horizon when the oracle is sub-optimal. We experimentally demonstrate that a gradient-based implementation of THOR can achieve superior performance compared to RL baselines and IL baselines even when the oracle is sub-optimal.

1. INTRODUCTION:

Reinforcement Learning (RL), equipped with modern deep learning techniques, has dramatically advanced the state-of-the-art in challenging sequential decision problems including high-dimensional robotics control tasks as well as video and board games (Mnih et al., 2015; Silver et al., 2016) . However, these approaches typically require a large amount of training data and computational resources to succeed. In response to these challenges, researchers have explored strategies for making RL more efficient by leveraging additional information to guide the learning process. Imitation learning (IL) is one such approach. In IL, the learner can reference expert demonstrations (Abbeel & Ng, 2004) , or can access a cost-to-go oracle (Ross & Bagnell, 2014) , providing additional information about the long-term effects of learner decisions. Through these strategies, imitation learning lowers sample complexity by reducing random global exploration. For example, Sun et al. (2017) shows that, with access to an optimal expert, imitation learning can exponentially lower sample complexity compared to pure RL approaches. Experimentally, researchers also have demonstrated sample efficiency by leveraging expert demonstrations by adding demonstrations into a replay buffer (Večerík et al., 2017; Nair et al., 2017) , or mixing the policy gradient with a behavioral cloning-related gradient (Rajeswaran et al., 2017) .

Although imitating experts can speed up the learning process in RL tasks, the performance of the learned policies are generally limited to the performance of the expert, which is often sub-optimal in practice. Previous imitation learning approaches with strong theoretical guarantees such as Data Aggregation (DAgger) (Ross et al., 2011) and Aggregation with Values (AGGREVATE) (Ross & Bagnell, 2014 ) can only guarantee a policy which performs as well as the expert policy or a one-step deviation improvement over the expert policy. 1 Unfortunately, this implies that imitation learning with a sub-optimal expert will often return a sub-optimal policy. Ideally, we want the best of both IL and RL: we want to use the expert to quickly learn a reasonable policy by imitation, while also exploring how to improve upon the expert with RL. This would allow the learner to overcome the sample inefficiencies inherent in a pure RL strategy while also allowing the learner to eventually surpass a potentially sub-optimal expert. Combining RL and IL is, in fact, not new. Chang et al. (2015) attempted to combine IL and RL by stochastically interleaving incremental RL and IL updates. By doing so, the learned policy will either perform as well as the expert policy-the property of IL (Ross & Bagnell, 2014) , or eventually reach a local optimal policy-the property of policy iteration-based RL approaches. Although, when the expert policy is sub-optimal, the learned locally optimal policy could potentially perform better than the expert policy, it is still difficult to precisely quantify how much the learner can improve over the expert.

In this work, we propose a novel way of combining IL and RL through the idea of Reward Shaping (Ng et al., 1999) . Throughout our paper we use cost instead of reward, and we refer to the concept of reward shaping with costs as cost shaping. We assume access to a cost-to-go oracle that provides an estimate of expert cost-to-go during training. The key idea is that the cost-to-go oracle can serve as a potential function for cost shaping. For example, consider a task modeled by a Markov Decision Process (MDP). Cost shaping with the cost-to-go oracle produces a new MDP with an optimal policy that is equivalent to the optimal policy of the original MDP (Ng et al., 1999) . The idea of cost shaping naturally suggests a strategy for IL: pick a favourite RL algorithm and run it on the new MDP reshaped using expert's cost-to-go oracle. In fact, Ng et al. (1999) demonstrated that running SARSA (Sutton & Barto, 1998) on an MDP reshaped with a potential function that approximates the optimal policy's value-to-go, is an effective strategy.

We take this idea one step further and study the effectiveness of the cost shaping with the expert's cost-to-go oracle, with a focus on the setting where we only have an imperfect estimator V e of the cost-to-go of some expert policy π e , i.e., V e = V * , where V * is the optimal policy's cost-to-go in the original MDP. We show that cost shaping with the cost-to-go oracle shortens the learner's planning horizon as a function of the accuracy of the oracle V e compared to V * . Consider two extremes. On one hand, when we reshape the cost of the original MDP with V * (i.e., V e = V * ), the reshaped MDP has an effective planning horizon of one: a policy that minimizes the one-step cost of the reshaped MDP is in fact the optimal policy (hence the optimal policy of the original MDP). On the other hand, when the cost-to-go oracle provides no information regarding V * , we have no choice but simply optimize the reshaped MDP (or just the original MDP) using RL over the entire planning horizon.

With the above insight, we propose the high-level strategy for combining IL and RL, which we name Truncated HORizon Policy Search with cost-to-go oracle (THOR). The idea is to first shape the cost using the expert's cost-to-go oracle V e , and then truncate the planning horizon of the new MDP and search for a policy that optimizes over the truncated planning horizon. For discrete MDPs, we mathematically formulate this strategy and guarantee that we will find a policy that performs better than the expert with a gap that can be exactly quantified (which is missing in the previous work of Chang et al. (2015) ). In practice, we propose a gradient-based algorithm that is motivated from this insight. The practical algorithm allows us to leverage complex function approximators to represent policies and can be applied to continuous state and action spaces. We verify our approach on several MDPs with continuous state and action spaces and show that THOR can be much more sample efficient than strong RL baselines (we compared to Trust Region Policy Optimization with Generalized Advantage Estimation (TRPO-GAE) (Schulman et al., 2016) ), and can learn a significantly better policy than AGGREVATE (we compared to the policy gradient version of AGGREVATE from (Sun et al., 2017) ) with access only to an imperfect cost-to-go oracle.

1.1. RELATED WORK AND OUR CONTRIBUTION:

Previous work has shown that truncating the planning horizon can result in a tradeoff between accuracy and computational complexity. Farahmand et al. (2016) proposed a model-based RL approach that focuses on a search for policies that maximize a sum of k-step rewards with a termination value that approximates the optimal value-to-go. Their algorithm focuses on the model-based setting and the discrete state and action setting, as the algorithm needs to perform k-step value iteration to compute the policy. Another use of the truncated planning horizon is to trade off bias and variance. When the oracle is an approximation of the value function of the agent's current policy, by using k-step rollouts bottomed up by the oracle's return, truncating the planning horizon trades off bias and variance of the estimated reward-to-go. The bias-variance tradeoff has been extensively studied in Temporal Difference Learning literature (Sutton, 1988) and policy iteration literature as well (Gabillon et al., 2011 ). Ng (2003) is perhaps the closest to our work. In Theorem 5 in the Appendix of Ng's dissertation, Ng considers the setting where the potential function for reward shaping is close to the optimal value function and suggests that if one performs reward shaping with the potential function, then one can decrease the discount factor of the original MDP without losing the optimality that much. Although in this work we consider truncating the planning steps directly, Theorem 5 in Ng's dissertation and our work both essentially considers trading off between the hardness of the reshaped MDP (the shorter the planning horizon, the easier the MDP to optimize) and optimality of the learned policy. In addition to this tradeoff, our work suggests a path toward understanding previous imitation learning approaches through reward shaping, and tries to unify IL and RL by varying the planning horizon from 1 to infinity, based on how close the expert oracle is to the optimal value function. Another contribution of our work is a lower bound analysis that shows that performance limitation of AGGREVATE with an imperfect oracle, which is missing in previous work (Ross & Bagnell, 2014) . The last contribution of our work is a model-free, actor-critic style algorithm that can be used for continuous state and action spaces.

2. PRELIMINARIES:

We consider the problem of optimizing Markov Decision Process defined as M 0 = (S, A, P, C, γ).

Here, S is a set of S states and A is a set of A actions; P is the transition dynamics at such that for any s ∈ S, s ∈ S, a ∈ A, P (s |s, a) is the probability of transitioning to state s from state s by taking action a. For notation simplicity, in the rest of the paper, we will use short notation P sa to represent the distribution P (•|s, a). The cost for a given pair of s and a is c(s, a), which is sampled from the cost distribution C(s, a) with mean value c(s, a). A stationary stochastic policy π(a|s) computes the probability of generating action a given state s.

The value function V π M0 and the state action cost-to-go Q π M0,h (s, a) of π on M 0 are defined as:

V π M0 (s) = E ∞ t=0 γ t c(s t , a t )|s 0 = s, a ∼ π , Q π M0 (s, a) = E c(s, a) + γE s ∼Psa [V π M0 (s )] ,

where the expectation is taken with respect to the randomness of M 0 and the stochastic policy π.

With V π M0 and Q π M0 , we define the disadvantage 2 function A π M0 (s, a) = Q π M0 (s, a) -V π M0 (s).

The objective is to search for the optimal policy π * such that π * = arg min π V π (s), ∀s ∈ S.

Throughout this work, we assume access to an cost-to-go oracle V e (s) : S → R. Note that we do not require V e (s) to be equal to V * M0 . For example, V e (s) could be obtained by learning from trajectories demonstrated by the expert π e (e.g., Temporal Difference Learning (Sutton & Barto, 1998)), or V e could be computed by near-optimal search algorithms via access to ground truth information (Daumé III et al., 2009; Chang et al., 2015; Sun et al., 2016) or via access to a simulator using Dynamic Programming (DP) techniques (Choudhury et al., 2017; Pan et al., 2017) . In our experiment, we focus on the setting where we learn a V e (s) using TD methods from a set of expert demonstrations.

2.1. COST SHAPING:

Given the original MDP M 0 and any potential functions Φ : S → R, we can reshape the cost c(s, a) sampled from C(s, a) to be:

c (s, a) = c(s, a) + γΦ(s ) -Φ(s), s ∼ P sa .

(1)

Denote the new MDP M as the MDP obtained by replacing c by c in M 0 : M = (S, A, P, c , γ). Ng et al. (1999) showed that the optimal policy π * M on M and the optimal policy π * M0 on the original MDP are the same: π * M (s) = π * M0 (s), ∀s. In other words, if we can successfully find π * M on M, then we also find π * M0 , the optimal policy on the original MDP M 0 that we ultimately want to optimize.

2.2. IMITATION LEARNING:

In IL, when given a cost-to-go oracle V e , we can use it as a potential function for cost shaping. Specifically let us define the disadvantage A e (s, a) = c(s, a) + γE s ∼Psa [V e (s )] -V e (s). As cost shaping does not change the optimal policy, we can rephrase the original policy search problem using the shaped cost:

EQUATION

for all s ∈ S. Though Eq. 2 provides an alternative objective for policy search, it could be as hard as the original problem as

E[ t γ t A e (s t , a t )] is just equal to E[ t γ t c(s t , a t ) -V e (s 0 )],

which can be easily verified using the definition of cost shaping and a telescoping sum trick.

As directly optimizing Eq 2 is as difficult as policy search in the original MDP, previous IL algorithms such as AGGREVATE essentially ignore temporal correlations between states and actions along the planning horizon and directly perform a policy iteration over the expert policy at every state, i.e., they are greedy with respect to A e as π(s) = arg min a A e (s, a), ∀s ∈ S. The policy iteration theorem guarantees that such a greedy policy π performs at least as well as the expert. Hence, when the expert is optimal, the greedy policy π is guaranteed to be optimal. However when V e is not the optimal value function, the greedy policy π over A e is a one-step deviation improvement over the expert but is not guaranteed to be close to the optimal π * . We analyze in detail how poor the policy resulting from such a greedy policy improvement method could be when V e is far away from the optimal value function in Sec. 3.

3. EFFECTIVENESS OF COST-TO-GO ORACLE ON PLANNING HORIZON:

In this section we study the dependency of effective planning horizon on the cost-to-go oracle. We focus on the setting where we have access to an oracle V e (s) which approximates the cost-to-go of some expert policy π e (e.g., V e could be designed by domain knowledge (Ng et al., 1999) or learned from a set of expert demonstrations). We assume the oracle is close to V * M0 , but imperfect:

| V e -V * M0 | = for some ∈ R + .

We first show that with such an imperfect oracle, previous IL algorithms AGGREVATE and AGGREVATE D (Ross & Bagnell, 2014; Sun et al., 2017) are only guaranteed to learn a policy that is γ /(1-γ) away from the optimal. Let us define the expected total cost for any policy π as J(π) = E s0∼v V π M0 (s 0 ) , measured under some initial state distribution v and the original MDP M 0 .

Theorem 3.1. There exists an MDP and an imperfect oracle V e (s) with | V e (s) -V * M0,h (s)| = , such that the performance of the induced policy from the cost-to-go oracle π * = arg min a c(s, a) + γE s ∼Psa [ V e (s )] is at least Ω(γ /(1 -γ)) away from the optimal policy π * :

EQUATION

)

The proof with the constructed example can be found in Appendix A. Denote Qe (s, a) = c(s, a) + γE s [ V e (s )], in high level, we construct an example where Qe is close to Q * in terms of Qe -Q * ∞ , but the order of the actions induced by Qe is different from the order of the actions from Q * , hence forcing the induced policy π * to make mistakes.

As AGGREVATE at best computes a policy that is one-step improvement over the oracle, i.e., π * = arg min a c(s, a) + γE s ∼Psa [ V e (s )] , it eventually has to suffer from the above lower bound. This gap in fact is not surprising as AGGREVATE is a one-step greedy algorithm in a sense that it is only optimizing the one-step cost function c from the reshaped MDP M. To see this, note that the cost of the reshaped MDP

M is E[c (s, a)] = [c(s, a) + γE s ∼Psa V e (s ) -V e (s)

], and we have π * (s) = arg min a E[c (s, a)]. Hence AGGREVATE can be regarded as a special algorithm that aims to optimizing the one-step cost of MDP M that is reshaped from the original MDP M 0 using the cost-to-go oracle.

Though when the cost-to-go oracle is imperfect, AGGREVATE will suffer from the above lower bound due to being greedy, when the cost-to-go oracle is perfect, i.e., V e = V * , being greedy on one-step cost makes perfect sense. To see this, use the property of the cost shaping (Ng et al., 1999) , we can verify that when V e = V * :

EQUATION

Namely the optimal policy on the reshaped MDP M only optimizes the one-step cost, which indicates that the optimal cost-to-go oracle shortens the planning horizon to one: finding the optimal policy on M 0 becomes equivalent to optimizing the immediate cost function on M at every state s.

When the cost-to-go oracle is away from the optimality, we lose the one-step greedy property shown in Eq. 4. In the next section, we show that how we can break the lower bound Ω( /(1 -γ)) only with access to an imperfect cost-to-go oracle V e , by being less greedy and looking head for more than one-step.

3.1. OUTPERFORMING THE EXPERT:

Given the reshaped MDP M with V e as the potential function, as we mentioned in Sec. 2.2, directly optimizing Eq. 2 is as difficult as the original policy search problem, we instead propose to minimize the total cost of a policy π over a finite k ≥ 1 steps at any state s ∈ S:

EQUATION

Using the definition of cost shaping and telescoping sum trick,we can re-write Eq. 5 in the following format, which we define as k-step disadvantage with respect to the cost-to-go oracle:

EQUATION

We assume that our policy class Π is rich enough that there always exists a policy π * ∈ Π that can simultaneously minimizes the k-step disadvantage at every state (e.g., policies in tabular representation in discrete MDPs). Note that when k = 1, minimizing Eq. 6 becomes the problem of finding a policy that minimizes the disadvantage A e M0 (s, a) with respect to the expert and reveals AGGREVATE.

The following theorem shows that to outperform expert, we can optimize Eq. 6 with k > 1. Let us denote the policy that minimizes Eq. 6 in every state as π * , and the value function of π * as V π * . Theorem 3.2. Assume π * minimizes Eq. 6 for every state s ∈ S with k > 1 and | V e (s) -V * (s)| = Θ( ), ∀s. We have :

J(π * ) -J(π * ) ≤ O γ k 1 -γ k (7)

Compare the above theorem to the lower bound shown in Theorem 3.1, we can see that when k > 1, we are able to learn a policy that performs better than the policy induced by the oracle (i.e.,π * (s) = arg min a Qe (s, a)) by at least

( γ 1-γ -γ k 1-γ k )

. The proof can be found in Appendix B. Theorem 3.2 and Theorem 3.1 together summarize that when the expert is imperfect, simply computing a policy that minimizes the one-step disadvantage (i.e., (k = 1)) is not sufficient to guarantee near-optimal performance; however, optimizing a k-step disadvantage with k > 1 leads to a policy that guarantees to outperform the policy induced by the oracle (i.e., the best possible policy that can be learnt using AGGREVATE and AGGREVATED). Also our theorem provides a concrete performance gap between the policy that optimizes Eq. 6 for k > 1 and the policy that induced by the oracle, which is missing in previous work (e.g., (Chang et al., 2015) ).

As we already showed, if we set k = 1, then optimizing Eq. 6 becomes optimizing the disadvantage over the expert A e M0 , which is exactly what AGGREVATE aims for. When we set k = ∞, optimizing Eq. 6 or Eq. 5 just becomes optimizing the total cost of the original MDP. Optimizing over a shorter Execute π θn to generate a set of trajectories {τ i } N i=1 .

6:

Reshape cost c (s t , a t ) = c(s t , a t ) + V e t+1 (s t+1 ) -V e t (s t ), for every t ∈ [1,

|τ i |] in every trajectory τ i , i ∈ [N ]. 7:

Compute gradient:

EQUATION

Update disadvantage estimator to Âπn,k M using {τ i } i with reshaped cost c . 9:

Update policy parameter to θ n+1 . 10: end for finite horizon is easier than optimizing over the entire infinite long horizon due to advantages such as smaller variance of the empirical estimation of the objective function, less temporal correlations between states and costs along a shorter trajectory. Hence our main theorem essentially provides a tradeoff between the optimality of the solution π * and the difficulty of the underlying optimization problem.

4. PRACTICAL ALGORITHM:

Given the original MDP M 0 and the cost-to-go oracle V e , the reshaped MDP's cost function c is obtained from Eq. 1 using the cost-to-go oracle as a potential function. Instead of directly applying RL algorithms on M 0 , we use the fact that the cost-to-go oracle shortens the effective planning horizon of M, and propose THOR: Truncated HORizon Policy Search summarized in Alg. 1. The general idea of THOR is that instead of searching for policies that optimize the total cost over the entire infinitely long horizon, we focus on searching for polices that minimizes the total cost over a truncated horizon, i.e., a k-step time window. Below we first show how we derive THOR from the insight we obtained in Sec. 3.

Let us define a k-step truncated value function V π,k M and similar state action value function Q π,k M on the reshaped MDP M as:

EQUATION

At any time state s, V π,k M only considers (reshaped) cost signals c from a k-step time window. We are interested in searching for a policy that can optimizes the total cost over a finite k-step horizon as shown in Eq. 5. For MDPs with large or continuous state spaces, we cannot afford to enumerate all states s ∈ S to find a policy that minimizes the k-step disadvantage function as in Eq. 5. Instead one can leverage the approximate policy iteration idea and minimize the weighted cost over state space using a state distribution ν (Kakade & Langford, 2002; Bagnell et al., 2004) :

EQUATION

)

For parameterized policy π (e.g., neural network policies), we can implement the minimization in Eq. 10 using gradient-based update procedures (e.g., Stochastic Gradient Descent, Natural Gradient (Kakade, 2002; Bagnell & Schneider, 2003) ) in the policy's parameter space. In the setting where the system cannot be reset to any state, a typical choice of exploration policy is the currently learned policy (possibly mixed with a random process (Lillicrap et al., 2015) to futher encourage exploration). Denote π n as the currently learned policy after iteration n and P r πn (•) as the average state distribution induced by executing π n (parameterized by θ n ) on the MDP. Replacing the exploration distribution by P r πn (•) in Eq. 10, and taking the derivative with respect to the policy parameter θ, the policy gradient is:

E s∼P rπ n   E τ k ∼πn [ k i=1 ∇ θ ln π(a i |s i ; θ)( k+i j=i γ j-i c (s j , a j ))]   ≈ E s∼P rπ n E τ k ∼πn [ k i=1 ∇ θ ln π(a i |s i ; θ)Q π,k M (s i , a i )]

where τ k ∼ π n denotes a partial k-step trajectory τ k = {s 1 , a 1 , ..., s k , a k |s 1 = s} sampled from executing π n on the MDP from state s. Replacing the expectation by empirical samples from π n , replacing Q π,k M by a critic approximated by Generalized disadvantage Estimator (GAE) Âπ,k M (Schulman et al., 2016) , we get back to the gradient used in Alg. 1:

EQUATION

where |τ | denotes the length of the trajectory τ .

4.1. INTERPRETATION USING TRUNCATED BACK-PROPAGATION THROUGH TIME:

If using the classic policy gradient formulation on the reshaped MDP M we should have the following expression, which is just a re-formulation of the classic policy gradient (Williams, 1992) :

EQUATION

which is true since the cost c i (we denote c i (s, a) as c i for notation simplicity) at time step i is correlated with the actions at time step t = i all the way back to the beginning t = 1. In other words, in the policy gradient format, the effectiveness of the cost c t is back-propagated through time all the way back the first step. Our proposed gradient formulation in Alg. 1 shares a similar spirit of Truncated Back-Propagation Through Time (Zipser, 1990) , and can be regarded as a truncated version of the classic policy gradient formulation: at any time step t, the cost c is back-propagated through time at most k-steps:

EQUATION

In Eq. 13, for any time step t, we ignore the correlation between c t and the actions that are executed k-step before t, hence elimiates long temporal correlations between costs and old actions. In fact, AGGREVATE D (Sun et al., 2017) , a policy gradient version of AGGREVATE, sets k = 1 and can be regarded as No Back-Propagation Through Time.

Published as a conference paper at ICLR 2018

4.2. CONNECTION TO IL AND RL:

The above gradient formulation provides a natural half-way point between IL and RL. When k = 1 and V e = V * M0 (the optimal value function in the original MDP M 0 ):

EQUATION

where, for notation simplicity, we here use E τ to represent the expectation over trajectories sampled from executing policy π θ , and A π * M0 is the advantage function on the original MDP M 0 . The fourth expression in the above equation is exactly the gradient proposed by AGGREVATED (Sun et al., 2017) . AGGREVATED performs gradient descent with gradient in the format of the fourth expression in Eq. 14 to discourage the log-likelihood of an action a t that has low advantage over π * at a given state s t .

On the other hand, when we set k = ∞, i.e., no truncation on horizon, then we return back to the classic policy gradient on the MDP M obtained from cost shaping with V e . As optimizing M is the same as optimizing the original MDP M 0 (Ng et al., 1999) , our formulation is equivalent to a pure RL approach on M 0 . In the extreme case when the oracle V e has nothing to do with the true optimal oracle V * , as there is no useful information we can distill from the oracle and RL becomes the only approach to solve M 0 .

5. EXPERIMENTS:

We evaluated THOR on robotics simulators from OpenAI Gym (Brockman et al., 2016) . Throughout this section, we report reward instead of cost, since OpenAI Gym by default uses reward. The baseline we compare against is TRPO-GAE (Schulman et al., 2016) and AGGREVATED (Sun et al., 2017) .

To simulate oracles, we first train TRPO-GAE until convergence to obtain a policy as an expert π e . We then collected a batch of trajectories by executing π e . Finally, we use TD learning Sutton (1988) to train a value function V e that approximates V e . In all our experiments, we ignored π e and only used the pre-trained V e for reward shaping. Hence our experimental setting simulates the situation where we only have a batch of expert demonstrations available, and not the experts themselves. This is a much harder setting than the interactive setting considered in previous work (Ross et al., 2011; Sun et al., 2017; Chang et al., 2015) . Note that π e is not guaranteed to be an optimal policy, and V e is only trained on the demonstrations from π e , therefore the oracle V e is just a coarse estimator of V * M0 . Our goal is to show that, compared to AGGREVATED, THOR with k > 1 results in significantly better performance; compared to TRPO-GAE, THOR with some k << H converges faster and is more sample efficient. For fair comparison to RL approaches, we do not pre-train policy or critic Â using demonstration data, though initialization using demonstration data is suggested in theory and has been used in practice to boost the performance (Ross et al., 2011; Bahdanau et al., 2016) .

For all methods we report statistics (mean and standard deviation) from 25 seeds that are i.i.d generated. For trust region optimization on the actor π θ and GAE on the critic, we simply use the recommended parameters in the code-base from TRPO-GAE (Schulman et al., 2016) . We did not tune any parameters except the truncation length k.

5.1. DISCRETE ACTION CONTROL:

We consider two discrete action control tasks with sparse rewards: Mountain-Car, Acrobot and a modified sparse reward version of CartPole. All simulations have sparse reward in the sense that no reward signal is given until the policy succeeds (e.g., Acrobot swings up). In these settings, pure RL approaches that rely on random exploration strategies, suffer from the reward sparsity. On the other Note that in our setting where V e is imperfect, THOR with k > 1 works much better than AG-GREVATED (THOR with k = 1) in Acrobot. In Mountain Car, we observe that AGGREVATED achieves good performance in terms of the mean, but THOR with k > 1 (especially k = 10) results in much higher mean+std, which means that once THOR receives the reward signal, it can leverage this signal to perform better than the oracles.

We also show that THOR with k > 1 (but much smaller than H) can perform better than TRPO-GAE. In general, as k increases, we get better performance. We make the acrobot setting even harder by setting H = 200 to even reduce the chance of a random policy to receive reward signals. Compare Fig. 1 (c ) to Fig. 1 (b) , we can see that THOR with different settings of k always learns faster than TRPO-GAE, and THOR with k = 50 and k = 100 significantly outperform TRPO-GAE in both mean and mean+std. This indicates that THOR can leverage both reward signals (to perform better than AGGREVATED) and the oracles (to learn faster or even outperform TRPO).

5.2. CONTINUOUS ACTION CONTROL:

We tested our approach on simulators with continuous state and actions from MuJoCo simulators: a modified sparse reward Inverted Pendulum, a modifed sparse reward Inverted Double Pendulum, Hopper and Swimmer. Note that, compared to the sparse reward setting, Hopper and Swimmer do not have reward sparsity and policy gradient methods have shown great results (Schulman et al., 2015; 2016) . Also, due to the much larger and more complex state space and control space compared to the simulations we consider in the previous section, the value function estimator V e is much less accurate in terms of estimating V * M0 since the trajectories demonstrated from experts may only cover a very small part of the state and control space. Fig. 2 shows the results of our approach. For all simulations, we require k to be around 20% ∼ 30% of the original planning horizon H to achieve good performance. AGGREVATED (k = 1) learned very little due to the imperfect value function estimator V e . We also tested k = H, where we observe that reward shaping with V e gives better performance than TRPO-GAE. This empirical observation is consistent with the observation from (Ng et al., 1999 ) ( Ng et al. (1999 ) used SARSA (Sutton, 1988) , not policy gradient based methods). This indicates that even when V e is not close to V * , policy gradient methods can still employ the oracle V e just via reward shaping. Finally, we also observed that our approach significantly reduces the variance of the performance of the learned polices (e.g., Swimmer in Fig. 2(a) ) in all experiments, including the sparse reward setting. This is because truncation can significantly reduce the variance from the policy gradient estimation when k is small compared to H.

6. CONCLUSION:

We propose a novel way of combining IL and RL through the idea of cost shaping with an expert oracle. Our theory indicates that cost shaping with the oracle shortens the learner's planning horizon as a function of the accuracy of the oracle compared to the optimal policy's value function. Specifically, when the oracle is the optimal value function, we show that by setting k = 1 reveals previous imitation learning algorithm AGGREVATED. On the other hand, we show that when the oracle is imperfect, using planning horizon k > 1 can learn a policy that outperforms a policy that would been learned by AGGREVATE and AGGREVATED (i.e., k = 1). With this insight, we propose THOR (Truncated HORizon policy search), a gradient based policy search algorithm that explicitly focusing on minimizing the total cost over a finite planning horizon. Our formulation provides a natural half-way point between IL and RL, and experimentally we demonstrate that with a reasonably accurate oracle, our approach can outperform RL and IL baselines.

We believe our high-level idea of shaping the cost with the oracle and then focusing on optimizing a shorter planning horizon is not limited to the practical algorithm we proposed in this work. In fact our idea can be combined with other RL techniques such as Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015) , which has an extra potential advantage of storing extra information from the expert such as the offline demonstrations in its replay buffer (Večerík et al. (2017) ). Though in our experiments, we simply used some expert's demonstrations to pre-train V e using TD learning, there are other possible ways to learn a more accurate V e . For instance, if an expert is available during training (Ross et al., 2011) , one can online update V e by querying expert's feedback.

A PROOF OF THEOREM 3.1 It is clear that for any state s i , we have Q * (s i , a 1 ) = 0, Q * (s i , a 2 ) = γ, Q * (s i , a 1 ) = 1 and Q * (s i , a 2 ) = 1 + γ, for i ≥ 1. Let us assume that we have an oracle V e such that V e (s i ) = 0.5 + δ and V e (s i ) = 0.5 -δ, for some positive real number δ. Hence we can see that | V e (s) -V * (s)| = 0.5 + δ, for all s. Denote Qe (s, a) = c(s, a) + γE s ∼Psa [ V e (s )], we know that Qe (s i , a 1 ) = γ(0.5 + δ), Qe (s i , a 2 ) = γ(0.5 -δ), Qe (s i , a 1 ) = 1 + γ(0.5 + δ) and Qe (s i , a 2 ) = 1 + γ(0.5 -δ).

It is clear that the optimal policy π * has cost J(π * ) = 0. Now let us compute the cost of the induced policy from oracle Qe : π(s) = arg min a Qe (s, a). As we can see π makes a mistake at every state as arg min a Qe (s, a) = arg min a Q * (s, a). Hence we have J(π) = γ 1-γ . Recall that in our constructed example, we have = 0.5 + δ. Now let δ → 0 + (by δ → 0 + we mean δ approaches to zero from the right side), we have → 0.5, hence J(π) = γ 1-γ → 2γ 1-γ (due to the fact 2 → 1). Hence we have J(π) -J(π * ) = Ω γ 1-γ B PROOF OF THEOREM 3.2 Below we prove Theorem 3.2.

Proof of Theorem 3.2. In this proof, for notation simplicity, we denote V π M0 as V π for any π. Using the definition of value function V π , for any state s 1 ∈ S we have:

V π * (s 1 ) -V * (s 1 ) = E k i=1 γ i-1 c(s i , a i ) + γ k V π * (s k+1 )|π * -E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * = E k i=1 γ i-1 c(s i , a i ) + γ k V π * (s k+1 )|π * -E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * + E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * -E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * = γ k E V π * (s k+1 ) -V * (s k+1 ) + E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * -E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * (15)

Published as a conference paper at ICLR 2018 Using the fact that V * (s) -V e (s) ≤ , we have that:

E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * ≤ E k i=1 γ i-1 c(s i , a i ) + γ k V e (s k+1 )|π * + γ k , E k i=1 γ i-1 c(s i , a i ) + γ k V * (s k+1 )|π * ≥ E k i=1 γ i-1 c(s i , a i ) + γ k V e (s k+1 )|π * -γ k .

Substitute the above two inequality into Eq. 15, we have:

EQUATION

)

where the second inequality comes from the fact that π * is the minimizer from Eq. 6. Recursively expand V π * (s k+1 ) -V * (s k+1 ) using the above procedure, we can get:

EQUATION

Since the above inequality holds for any s 1 ∈ S, for any initial distribution v over state space S, we will have J(π * ) -J(π * ) ≤ O( γ k 1-γ k ).

:

AGGREVATE achieves one-step deviation improvement over the expert under the assumption that the policy class is rich enough.

We call A π as the disadvantage function as we are working in the cost setting.

Figures and Tables:

Truncated Horizon Policy Search (THOR) 1: Input: The original MDP M 0 . Truncation Step k. Oracle V e . 2: Initialize policy π θ0 with parameter θ 0 and truncated advantage estimator Â0,k M . 3: for n = 0, ... do 4: Reset system.

Figure 1: Reward versus batch iterations of THOR with different k and TRPO-GAE (blue) for Mountain car, Sparse Reward (SR) CartPole, and Acrobot with different horizon. Average rewards across 25 runs are shown in solid lines and averages + std are shown in dotted lines.

Figure 2: Reward versus batch iterations of THOR with different k and TRPO-GAE (blue) for Sparse Reward (SR) Inverted Pendulum, Sparse Reward Inverted-Double Pendulum, Swimmer and Hopper. Average rewards across 25 runs are shown in solid lines and averages + std are shown in dotted lines.

Figure 3: The special MDP we constructed for theorem 3.1

Peer review (iclr2018):
 This work proposes to use the value function V^e of some expert policy .pi^e in order to speed up learning of an RL agent which should eventually do better than the expert. The emphasis is put on using k-steps (with k>1) Bellman updates using bootstrapping from V^e. It is claimed that the case k=1 does not allow the agent to outperform the expert policy, whereas k>1 does (Section 3.1, paragraph before Lemma 3.2). I disagree with this claim. Indeed a policy gradient algorithm (similar to (10)) with a 1-step advantage c(s,a) + gamma V^e(s_{t+1}) - V^e(s_t) will converge (say in the tabular case, or in the case you consider of a rich enough policy space .Pi) to the greedy policy with respect to V^e, which is strictly better than V^e (if V^e is not optimal). So you don’t need to use k>1 to improve the expert policy. Now it’s true that this will not converge to the optimal policy (since you keep bootstrapping with V^e instead of the current value function), but neither the k-step advantage will. So I don’t see any fundamental difference between k=1 and k>1. The only difference being that the k-step bootstrapping will implement a k-step Bellman operator which contracts faster (as gamma^k) when k is large. But the best choice of k has to be discussed in light of a bias-variance discussion, which is missing here. So I find that the main motivation for this work is not well supported. Algorithmic suggestion: Instead of bootstrapping with V^e, why not bootstrap with min(V^e, V), where V is your current approximation of the value function. In that way you would benefit from (1) fast initialization with V^e at the beginning of learning, (2) continual improvement once you’ve reached the performance of the expert. Other comments: Requiring that we know the value function of the expert on the whole state space is a very strong assumption that we do not usually make in Imitation learning. Instead we assume we have trajectories from expert (from which we can compute value function along those trajectories only). Generalization of the value function to other states is a hard problem in RL and is the topic of important research. The overall writing lacks rigor and the contribution is poor. Indeed the lower bound (Theorem 3.1) is not novel (btw, the constant hidden in the .Omega notation is 1/(1-gamma)). Theorems 3.2 and 3.3 are not novel either. Please read [Bertsekas and Tsitsiklis, 96] as an introduction to dynamic programming with approximation. The writing could be improved, and there are many typos, such as: - J is not defined (Equation (2)) - Why do you call A a disadvantage function whereas this quantity is usually called an advantage? - You are considering a finite (ie, k) horizon setting, so the value function depend on time. For example the value functions defined in (11) depend on time. - All derivations in Section 4, before subsection 4.1 are very approximate and lack rigor. - Last sentence of Proof of theorem 3.1. I don’t understand H -> 2H epsilon. H is fixed, right? Also your example does not seem to be a discounted problem.