Optimistic Policy Optimization with Bandit Feedback
Yonathan Efroni, Lior Shani, Aviv Rosenberg, Shie Mannor
Introduction
Policy Optimization (PO) is among the most widely used methods in Reinforcement Learning (RL) (Peters & Schaal 2006; Peters & Schaal 2008; Deisenroth & Rasmussen 2011; Lillicrap et al. 2015; Levine et al. 2016; Gu et al. 2017). Unlike value-based approaches, e.g., Q-learning, these types of methods directly optimize the policy by incrementally changing it. Furthermore, PO methods span wide variety of popular algorithms such as policy-gradient algorithms (Sutton et al. 2000), natural policy gradient (Kakade 2002), trust region policy optimization (TRPO) (Schulman et al. 2015) and soft actor-critic (Haarnoja et al. 2018).
Due to their popularity, there is a rich literature that provides different types of theoretical guarantees for different PO methods (Scherrer & Geist 2014; Abbasi-Yadkori et al. 2019; Agarwal et al. 2019; Liu et al. 2019; Bhandari & Russo 2019; Shani et al. 2019; Wei et al. 2019) for both the approximate and tabular settings. However, previous results, concerned with regret or PAC bounds for the RL setting when the model is unknown and only bandit feedback is given, provide guarantees which critically depend on ‘concentrability coefficients’ (Kakade & Langford 2002; Munos 2003; Scherrer 2014) or on a unichain MDP assumption (Abbasi-Yadkori et al. 2019). However, these coefficients might be infinite and are usually small only for highly stochastic domains, while the unichain assumption is often very restrictive.
Preliminaries
where the expectation is with respect to the randomness of the transition function, the cost function and the policy. The -function of a policy given the state action pair at time-step is defined by
Unlike stochastic MDP, in adversarial MDP, we let the cost to be determined by an adversary at the beginning of every episode, whereas the transition function is fixed. Thus, we denote the MDP at the -th episode by . As in (2.1), (2.2), we define the value function and -function of a policy at the -th episode by
Notably, and satisfy the relations in relation (2.3).
where is a stepsize. In our case, is the unit simplex , and thus the optimization problem has a closed-form solution,
The MD algorithm ensures for all .
Related Work
A large body of work addresses the convergence properties of policy optimization algorithms from an optimization perspective. In Kakade & Langford 2002, the authors analyzed the Conservative Policy Iteration (CPI) algorithm, an RL variant of the Frank-Wolfe algorithm (Scherrer & Geist 2014; Vieillard et al. 2019), and showed it approximately converges to the global optimal solution. Recently, Liu et al. 2019 established the convergence of TRPO when neural networks are being used as the function approximators. Furthermore, Shani et al. 2019 showed that TRPO (Schulman et al. 2015) is in fact a natural RL adaptation of the MD algorithm, and established convergence guarantees. In (Agarwal et al. 2019), the authors obtained convergence results for policy gradient based algorithms. However, all of the aforementioned works rely on the strong assumption of a finite concentrability coefficient, i.e., . This assumption bypasses the need to address exploration (Kakade & Langford 2002), and leads to global guarantees based on the local nature of the policy gradients (Scherrer & Geist 2014).
There are two different methodologies for using MD updates in RL. The first and more practical one, is using MD-like updates directly on the policy. The second is based on optimizing over the space of state-action occupancy measures, that is, visitation frequencies for state-action pairs. An occupancy measure represents a policy implicitly. For convenience, previous results for regret minimization using MD approaches are summarized in Table 1.
As opposed to Policy-based methods, there is an extensive literature about regret minimization in episodic MDPs using value-based methods. The works of (Azar et al. 2017; Dann et al. 2017; Jin et al. 2018; Zanette & Brunskill 2019; Efroni et al. 2019) use the optimism in face of uncertainty principle to achieve near-optimal regret bounds. Jin et al. 2018 also establish a lower bound of .
Mirror Descent for MDPs
The empirical success of TRPO (Schulman et al. 2015) and SAC (Haarnoja et al. 2018) had motivated recent study of MD-like update rules for solving MDPs (Geist et al. 2019) when the model of the environment is known. Although not explicitly discussed in (Geist et al. 2019), such an algorithm can also provide guarantees – by similar proof technique – for the case where the cost function is adversarially chosen on each episode.
Policy Optimization by Mirror Descent (POMD) (see Algorithm 1) is conceptually similar to the Policy Iteration (PI) algorithm (Puterman 2014). It alternates between two stages: (i) policy evaluation, and (ii) policy improvement. Furthermore, much alike PI, POMD updates its policy on the entire state space, given the evaluated -function. However, as oppose to PI, the policy improvement stage is ‘soft’. Instead of updating according to the greedy policy, the algorithm applies soft update that keeps the next policy ‘close’ to the current one due to the KL-divergence term.
Extended Value Difference Lemma
The analysis of both stochastic and adversarial cases is built upon a central lemma which we now review. The lemma is a variant of (Cai et al. 2019)[Lemma 4.2], which generalizes classical value difference lemmas. Rewriting it in the following form, enables us to establish our results (proof in Appendix D).
Let be two policies, and and be two MDPs. Let be an approximation of the -function of policy on the MDP for all , and let . Then,
where is the value function of in the MDP .
This lemma generalizes existing value difference lemmas. For example, in (Kearns & Singh 2002; Dann et al. 2017) the term is analyzed, whereas in (Kakade & Langford 2002) the term is analyzed. In next sections, we will demonstrate how Lemma 1 results in a simple analysis of the POMD algorithm. Importantly, the resulting regret bounds do not depend on concentrability coefficients (see Section 3) nor on any other structural assumptions.
Policy Optimization in Stochastic MDPs
We are now ready to analyze the optimistic version of POMD for stochastic environments (see Algorithm 2). Instead of using the known model as in POMD, in Algorithm 2 we use the empirical model to estimate the -function of an empirical optimistic MDP, with the empirical transition function and an optimistic cost function . The empirical transition function and empirical cost function are computed by averaging the observed transitions and costs, respectively, that is,
The optimistic cost function is obtained by adding a bonus term which drives the algorithm to explore, i.e., , and we set
The two bonus terms compensate on the lack of knowledge of the true costs and transition model, and are
The following theorem bounds the regret of Algorithm 2. A full proof is found in Appendix B.2.
We start by decomposing the regret into three terms according to Lemma 1, and then bound each term separately to get our final regret bound. For any ,
Here and , are the differences between the true cost and transition model to the empirical cost and transition model. Applying Hoeffding’s bound and deviation bound (Weissman et al. 2003) we get that w.h.p. for any
Term (ii) is the linear approximation used in MD optimization procedure. We bound it using an analysis of OMD. By applying usual OMD analysis (see Lemma 16) we have that for any policy and ,
We plug this back to Term (ii) and use the fact that , to obtain
By choosing , we obtain
The choice of the bonus term is smaller than in (Cai et al. 2019) by a factor of . This translates to an improved regret bound by this factor, although (Cai et al. 2019) assumes full-information feedback on the cost function.
Unlike value-based algorithms (e.g., Jaksch et al. 2010) , the value-function by which POMD improves upon, is not necessarily optimistic relatively to . Instead, it is optimistic relatively to the value of , i.e., .
Policy Optimization in Adversarial MDPs
In this section, we turn to analyze an optimistic version of POMD for adversarial environments (Algorithm 3). Similarly to the stochastic case, Algorithm 3 follows the POMD scheme, and alternates between policy evaluation, and, soft policy improvement, based on MD-like updates.
Unlike POMD for stochastic environments, the policy evaluation stage of Algorithm 3 uses different estimates of the instantaneous cost and model. The instantaneous cost is evaluated by a biased importance-sampling estimator, originally suggested by (Neu 2015), and recently generalized to adversarial RL settings by (Jin et al. 2019),
Here is the set of transition functions obtained by using confidence intervals around the empirical model (see Appendix C.1.2).
Instead of using the empirical model and subtracting a bonus term, Algorithm 3 uses an optimistic model (Jaksch et al. 2010) for the policy evaluation stage. The model by which is evaluated is the one which results in the smallest loss among possible models,
The solution to this optimization problem can be computed efficiently (see, e.g., Jaksch et al. 2010).
The following theorem bounds the regret of Algorithm 3. A full proof is found in Appendix C.2.
Central to the analysis are the following claims, formally established in Appendix C. The first is proved in (Jin et al. 2019)[Lemma 11], based upon (Neu 2015)[Lemma 1].
However, a tighter upper bound can be obtained by applying Claim 2 with for all . We have that
where in the last relation we used the fact that for any , . In the following proof sketch we apply the later upper bound and demonstrate its importance.
We decompose the regret as in Theorem 1 to (i) Bias term, (ii) OMD term, and (iii) Optimism term. We bound both the Bias and Optimism terms in the appendix while relying on both Claim 1 and Claim 2.
Similarly to the stochastic case, we utilize the usual OMD analysis (Lemma 16), which ensures that for any policy and ,
where the second relation holds since , and the third relation holds by applying Eq. (7.3). Plugging this in Term (ii) we get
Discussion
There are two prevalent approaches for policy optimization in practice, on-policy and off-policy. On-policy algorithms, e.g., TRPO (Schulman et al. 2015), update the policy based on data gathered following the current policy. This results in updating the policy only in observed states. However, in terms of theoretical guarantees, the convergence analysis of this approach requires the strong assumption of finite concentrability coefficient (Kakade & Langford 2002; Scherrer & Geist 2014; Agarwal et al. 2019; Liu et al. 2019; Shani et al. 2019). The assumption arises from the need to acquire global guarantees from the local nature of policy gradients.
The approach taken in this work, is fundamentally different than such on-policy approaches. In each episode, instead of updating the policy only at visited states, the policy is updated over the entire state space, by using all the historical data (in the form of the empirical model). Thus, the analyzed approach bears resemblance to off-policy algorithms, e.g., SAC (Haarnoja et al. 2018). There, the authors i) estimate the -function of the current policy by sampling from a buffer, which contains historical data, and ii) apply an MD-like policy update to states sampled from the buffer.
The uniform updates of policy-based methods analyzed in this work are in stark contrast to value-based algorithms, such as in (Jin et al. 2018; Efroni et al. 2019), where only observed states are updated. It remains an important open question, whether such updates could also be implemented in a provable policy based algorithm. In the case of stochastic POMD, this may be achieved by using optimistic -function estimates, instead of estimating the model with UCB-bonus, similarly to (Jin et al. 2019). There, the authors keep the estimates optimistic with respect to the optimal -function, . However, in approximate policy optimization, the policy improvement is done with respect to , as described in Algorithm 1. Therefore, differently than in (Jin et al. 2019), such off-policy version would require learning an optimistic estimator, instead of .
In our work, we proposed algorithms which directly optimize the policy. In this scenario, the policy is updated independently at each time step and state . That is, an optimization problem is solved over the action space in each . Therefore, this method requires solving optimization problems of size , where each has a closed form solution in the tabular setting.
Alternatively, algorithms based on the O-REPS framework (Zimin & Neu 2013), follow a different approach and optimize over the state-action occupancy measures instead of directly on policies. In the case of unknown transition model, taking such an approach requires solving a constrained convex optimization problem, later relaxed to a convex optimization problem with only non-negativity constraints (Rosenberg & Mansour 2019b) of size , in each episode. Unlike the policy optimization approach, this optimization problem does not have a closed form solution. Thus, the computational cost of optimizing over the state-action occupancy measures is much worse than the policy optimization one.
Another significant shortcoming in applying the O-REPS framework is the difficulty to scale it to the function approximation setting. Specifically, in case the state-action occupancy measure is represented by a non-linear function, it is unclear how to solve the constrained optimization problem as defined in (Rosenberg & Mansour 2019b). Differently than the O-REPS framework, the policy optimization approach scales naturally to the function approximation setting, e.g., Haarnoja et al. 2018. In this important aspect, policy optimization is preferable.
Acknowledgments
We thank the anonymous reviewers for providing us with very helpful comments.
References
Appendix A Additional Notation
We denote, and , the empirical estimators for respectively. In the adversarial case, we denote as the importance sampling estimator for the costs and as the optimistic model. When referring to the estimated MDP, we always denote , regardless of the estimation method. When using the notation and , for some policy , transition model and costs , we refer to the expected Q-function and value function at the -th step, of following the policy on the MDP defined by the transitions and costs .
Appendix B Stochastic MDPs
First, we restate here Algorithm 2 for readability:
In the stochastic case, we use the empirical model:
The bonus term in Algorithm 2 is made of a bonus term dedicated to the uncertainty in the rewards and a second term dedicated to the uncertainty in the transition model (see (6.1)),
We choose the additive bonus terms as follows (this choice is guided by the need to keep the term in Lemma 5 negative):
For any , and . To see that, first note that by the update rule, we have that for any , . Moreover, using negative bonuses, is always smaller than . Therefore, it is always upper bounded by .
In the next section, B.1, we deal with all the failure events that can happen while running algorithm 2, and show that they happen with small probability. Then, in section B.2, we prove Theorem 1 which establishes the convergence of Algorithm 2.
Furthermore, the following relations hold.
Let Then , by Hoeffding’s inequality, and using a union bound argument on all , and all possible values of and . Furthermore, for the bound holds trivially since .
Let Then , holds by (Weissman et al. 2003) while applying union bound on all , and all possible values of and . Furthermore, for the bound holds trivially.
Let Then, . The proof is given in (Dann et al. 2017) Corollary E.4.
Setting then . When the failure events does not hold we say the algorithm is outside the failure event, or inside the good event .
B.2 Regret Analysis - Proof of Theorem 1
By conditioning our analysis on the good event which was formalized in the previous section (see Lemma 2), we are ready to prove the following theorem, which establishes the convergence of Algorithm 2.
First, we decompose the regret in the following way,
where the second relation holds by using the extended value difference lemma (Lemma 1).
By applying Lemmas 3, 4 and 5 to bound each of the above three terms, respectively, we get that conditioned on the good event, for any and any
In what follows we will analyze the each of the three terms separately: Term is a bias term between the value of the current policy and the estimation of that value, which we bound in Lemma 3. Term is the linear approximation term used in the OMD optimization problem. This term will be bounded by the OMD analysis (see Lemma 4). Term is an optimism term. It represents the error of our -function estimation w.r.t. to the -function obtained by having the real model, and thus, applying the true 1-step Bellman operator. By the optimistic nature of our estimators, this term is negative given the good event (see Lemma 5).
Conditioned on the good event, we have that
By the extended value diffrence lemma (Lemma 1), we get
where the second relation follows from the update rule of .
where the second relation is by the definition of minimum between two terms.
Conditioning on the good event, we have that for any
See that the second relation is by the Cauchy-Schwartz inequality. The third is by the fact that for any , . the last relation holds conditioned on the good event.
Plugging (B.3), (B.4) into (B.2) and then back to (B.1) we get
where in the fourth relation we used the fact that the expectations are equivalent, since at the -th episode we follow the policy in the MDP .
This term accounts for the optimization error, bounded by the OMD analysis.
By standard analysis of OMD with the KL divergence used as the Bregman distance (see Lemma 17) we have that for any and for policy ,
By the fact (see Remark B.1), we have
See that the first relation holds as the expectation does not depend on . Thus, by linearity of expectation, we can switch the order of summation and expectation. The second relation holds since (B.5) holds for any .
Finally, by choosing , we obtain
Conditioned on the good event, we have that for any
Now, by the fact that for any , , we have that
Conditioned on the good event, we have that for any ,
The first relation holds by Holder’s inequality. The second relation holds by the updating rule, which keeps (see Remark B.1). The third relation holds conditioning on the good event.
Appendix C Adversarial MDPs
First, we restate here Algorithm 3 for readability:
We define the costs of the online MDP at the -th episode, for each , and for any
We also define the following optimistic model, , which is the solution to the following optimization problem:
where is defined in (C.3) Finally, as for the stochastic case, we denote the empirical estimator of the transition function as
For any , and . To see that, first note that . By the fact that the estimators for the Q-function and value function are always calculated w.r.t. to some transition model , we get that the estimators are bounded as suggested.
The following lemmas, Lemma 6 and Lemma 7, will be essential to establish regret bounds for Algorithm 3. In the main body of the paper, we refer to these lemmas as claim 1 and claim 2, respectively. Lemma 6 is a very close adaptation of (Jin et al. 2019)[Lemma 11], which in itself based on (Neu 2015)[Lemma 1]. Lemma 7 relies upon applying Lemma 6.
Let be a sequence of functions, such that is -measurable for all . Let for any . Then, With probability of at least , for any ,
The full proof of Lemma 6 is given in section E.
Let be a sequence of functions, such that is -measurable for all . Furthermore, assume that for all . Then, with probability of at least , for any fixed and ,
where is the value of following the policy at the -th step, on the MDP defined by the transitions and costs (as defined in Appendix A).
The first relation holds by Corollary 1, as both value functions are measured w.r.t. the same dynamics and are defined over the same policy. The second relation holds by the fact and by the fact that by the assumptions of the lemma, for any , .
Now, observe that and are measurable functions w.r.t. . For any we set where . By this definition we have that
For any we apply Lemma 6, take a union bound and bound to get
In this section we define the high probability bounds which are later in use in the proof of Theorem 2. We divide the failure event into two different kinds of failure event: basic failure events which are independent on each other, and conditioned failure event which holds conditioned on the basic failure event.
The next sections are ordered in the following way: we first define the basic failure event and the resulting basic good event. Then, we describe the consequences of this basic good event. Finally, we describe the conditioned failure events, which rely on the consequences of the basic good event. By combining all failure events, we define the global failure event. In the proof, we condition our analysis on the event the global failure event does not hold. We also refer to this event as the good event.
Furthermore, the following relations hold.
Let . Then, , by (Maurer & Pontil 2009, Theorem 4) and union bounds.
Let Then, . The proof is given in (Dann et al. 2017) Corollary E.4.
by Lemma 6 w.p. for any . Taking union bound on and setting , we get that . Finally, let . By union bound,
Finally, setting , and denote . Then, by union bound .
Denote , then . When occurs, we say that the basic good event holds.
C.1.2 Consequences Conditioning on the Basic Good event
First, for any , we define the set
By using this definition conditioned on the basic good event, we get the following lemma from (Jin et al. 2019)[Lemma 8],
Conditioned on the basic good event, for all and for all , there exists constants for which we have that
Conditioned on the basic good event, for any ,
where is defined in Appendix A.
By the description of the algorithm, for each value, we solve the following minimization problem, for any
Therefore, by conditioning on the good event and by lemma 9, for any the following holds
Now, note that for using the fact that for any , we obtain,
and therefore, for any and policy
Using the above inequality, by backward recursion on on (C.6), we get for any
where in the second inequality we used the fact that , and are all non-negative.
C.1.3 Conditioned failure events
Fix and let . Conditioning on the the basic good event for any ,
where we conditioned on the event in which , Therefore, . Furthermore, observe
is a martingale-difference sequence. Thus, by Azuma-Hoeffding and taking union bound for all , we have that for any , .
Fix and let . Now, set for any , (constant and thus measurable). Furthermore, conditioned on the basic good event, we have that for any , . Thus, by applying Lemma 7, we get that w.p.
Now, conditioned on the basic good event, by Lemma 10 we have
Taking union bounds on and setting , we get that . Finally, let . By union bound,
Fix and let . Now, set for any ,
and note that it is -measurable. Furthermore, conditioned on the basic good event, we have that for any , . Thus, by applying Lemma 7, we get that w.p. , for any fixed
Now, conditioned on the basic good event, by Lemma 10 we have
w.p. . Taking union bound on and setting , we get that w.p.
or in other words, . Finally, let . By union bound,
By following the same proof of event (i.e., by applying Lemma 7), but using for any , we get that .
Now, denote the conditioned event, .
Next, we set . Then, by union bound .
Denote , then .
C.1.4 Global Failure Events
In this section, we combine both the basic and conditioned failure events into a single global failure event. The global failure event accounts for all failure events which can occur in the adversarial MDP case. Specifically, in our analysis we will always assume that none of the failure events occurs, which happens with probability of at least since
where we used the facts that by Lemma 8, and by Lemma 11.
Denote , then . When occurs, we say the algorithm outside the failure event or inside the good event.
C.2 Regret Analysis - Proof of Theorem 2
By conditioning our analysis on the good event which was formalized in the previous sections (see Lemma 12), we are ready to prove the following theorem, which establishes the convergence of Algorithm 3.
First, we decompose the regret in the following way
where the second relation holds by using the extended value difference lemma (Lemma 1).
By applying Lemmas 13, 14 and 15 to bound each of the above three terms, respectively, we get that conditioned on the good event (see Lemma 12), for any ,
The decomposition in the proof of Theorem 2 is the same as in the stochastic case. The analysis is different here due the different nature of the estimators for the costs and transition model. Again, term is a bias term between the value of the current policy and the estimation of that value, which is bounded in Lemma 13. Term is the linear approximation term used in the OMD optimization problem. This term will be bounded by the OMD analysis (see Lemma 14). Term is an optimism term. It represents the error of our -function estimation w.r.t. to the -function obtained by having the real model, and thus, applying the true 1-step Bellman operator. By the optimistic nature of our estimators, this term is (almost) negative given the good event (see Lemma 15).
First, by Lemma 1, the following relations hold,
By plugging back to the first term of (C.7),
First, we deal with the first term in (C.8),
where in the inequality we use the fact that by conditioning on the good event, for any , , and therefore for any ,
As for the second term in (C.8), conditioning on the good event we have that
where the last relation follows from Lemma 20.
Now, its left to address the second term of (C.7). Consider the following,
The second transition is by the fact is positive and by the conditioning on the good event and applying Lemma 9. The third transition is by the fact for any , .
First, we deal with the first term. Conditioning on the good event, we have for any
In the first transition we used the fact that is positive and bounded by for any . The second transition is by Jensen’s inequality and the fact that the square root is concave.
Note that in the first relation we used the fact that the expectations are equivalent, since at the -th episode we follow the policy in the MDP . The third relation holds by the fact that for any , it holds that .
Finally, applying Lemma 19 and Lemma 18 and excluding constant and logarithmic factors in , we get
Next, conditioned on the good event, and specifically on events we have that
Finally, by combining the bounds, we get that
The result holds by combining the two above terms.
Conditioned on the good event, for any ,
This term accounts for the optimization error, bounded by the OMD analysis when the KL-divergence is used as the Bregman divergence.
By Lemma 17, we have that for any and for policy ,
Now, conditioning on the good event, the following holds,
Note that the second relation holds by . The third relation is by the fact that both terms are bounded by . The fourth relation is by the definition of the update rule.
Plugging this into (C.14) we get for any
The second relation holds by definition. The third relation holds by conditioning on the good event, specifically, event . The fourth relation holds since the value function of the true MDP is bounded by .
Conditioned on the good event, for any ,
We shall prove that, conditioned on the good event,
We have that for any , conditioning on the good event
where we used that fact that conditioned on the good event, for any .
since conditioning on the good event.
The result follows by combining the two above terms
Appendix D Difference Lemmas
The following lemma is similar to the analysis of the first term, in (Cai et al. 2019)[Lemma 4.2]. See 1
For any two policies , and for any and , by the definition and by the definition of ,
where in the last relation we used the fixed-policy Bellman equation on the MDP . I.e., for any , we have that .
Now, by adding and subtracting , we get
By using the above relation recursively, we obtain,
By using the fact that for any policy -horizon MDP and for any policy and state , , we get
By replacing the approximation in the last lemma with the real expected value, we get the following well known result:
Let be any -finite horizon MDP. Then, for any two policies , the following holds
Appendix E Useful Lemmas
In each iteration of Online Mirror Descent (OMD), the following problem is solved:
The following lemma, (Orabona 2019)[Theorem 10.4], provides a fundamental inequality which will be used in our analysis.
Assume for for and . Let and . Using OMD with the KL-divergence, learning rate , and with uniform initialization, , the following holds for any ,
In our analysis, we will be solving the OMD problem for each time-step and state separately,
Therefore, by adapting the above lemma to our notation, we get the following lemma,
Let . Let be the uniform distribution for any and . Then, by solving (E.2) separately for any and , the following holds for any stationary policy ,
First, observe that for any , we solve the optimization problem defined in (E.2) which is the same as (E.1). By the fact that the estimators used in our analysis are non-negative, we can apply Lemma 16 separately for each with and . ∎
E.2 Bounds on the Visitation Counts
In both Zanette & Brunskill 2019; Efroni et al. 2019 these results were derived for MDPs with stationary dynamics. Repeating their analysis, in our case, an additional factor emerges as we consider MDPs with non-stationary dynamics.
E.3 Bias Lemmas
For any and state-action pair we have
Now, we use the above relation and apply Markov inequality to obtain
for every . With probability at least ,