Q* Approximation Schemes for Batch Reinforcement Learning: A Theoretical Comparison
Tengyang Xie, Nan Jiang
Introduction
We study value-function approximation for batch-mode reinforcement learning (RL), which is central to the success of modern RL as many popular off-policy deep RL algorithms find their prototypes in this literature. These algorithms are typically iterative, that is, they solve a series of optimization problems, aiming to mimic each step of value- or policy-iteration [Puterman, 2014].
In the setting of general function approximation, however, not only the iterative style causes instability in practice, but it also brings several theoretical issues, which have been made abundantly clear in existing analyses [e.g., Munos, 2003, 2007; Antos et al., 2008; Farahmand et al., 2010; Chen and Jiang, 2019]:
The performance loss of most iterative methods incur quadratic dependence on the effective horizon, i.e., , and this is tight for the popular Approximate Value/Policy Iteration (AVI/API) [Scherrer and Lesner, 2012]. One typical way this occurs in AVI analyses is through the use of (some fine-grained variants of) the following result from Singh and Yee , that the performance loss of a policy greedy w.r.t. some is bounded by
and translating to the quantities that the algorithm actually optimizes incurs at least another factor of horizon. Such a quadratic dependence is significantly worse than the ideal linear dependence, the best one could hope for [Scherrer, 2014].
While linear-in-horizon algorithms exist, they often require interactive access to the environment (to collect new data using policies of the algorithm’s choice), or the knowledge of transition probabilities to compute the true expectation in the Bellman operators,At the minimum, two i.i.d. next-states must be drawn from the same state-action pair, known as the double sampling trick [Baird, 1995], which is unrealistic in non-simulator problems. and few of them apply to the batch learning setting.Exceptions exist when we are allowed to output complex non-stationary policies; see Section 3 for details. Are there batch algorithms for that incur linear-in-horizon dependence?
(B) Characterization of Distribution Shift
One of the central challenges in RL is the distribution shift, that the computed policy may induce a state (and action) distribution different from what it is trained on. Existing analyses characterize this effect using the concentrability coefficients [Munos, 2007], with a typical definition being the density ratio (or importance weights) between the state distribution induced at a particular time step by some non-stationary policy and the data distribution. These “per-step” definitions can be very loose even in the uncontrolled setting (Section 5.2) and sometimes very complicated [Farahmand et al., 2010]. Are there algorithms whose distribution shift effects are characterized by elegantly and tightly defined quantities?
(C) Function Approximation Assumptions
Existing analyses require strong expressivity assumptions on the function classes, such as approximate closedness under Bellman update [see inherent Bellman errors; Munos and Szepesvári, 2008]. Are there algorithms with provable guarantees under somewhat weaker conditions?
(D) Squared-to-Average Conversion
In this paper we present novel analyses of two algorithms, MSBO (which has been analyzed by Chen and Jiang ) and MABO (which is novel), and provide positive answers to all questions above. A simple telescoping argument (Section 4) shows that both algorithms enjoy linear-in-horizon error propagation—which immediately improves the previous bound of Chen and Jiang for MSBO—and the distribution shift effects can be characterized by simple notions of concentrability coefficients that are significantly tighter than previous per-step definitions, which address (A) and (B). By carefully examining the difference between the two algorithms, we further show that MABO, a novel algorithm that uses explicit importance-weighting correction and plain average objectives (without squared loss) does not suffer from the looseness of squared-to-average conversion, and comes with automatically augmented expressivity for its importance-weight class, addressing (C) and (D).
Preliminaries
An (infinite-horizon discounted) MDP [Puterman, 2014] is a tuple , , , , : and are the finite state and the finite action spaces, respectively, whose cardinalities can be arbitrarily large. is the transition function (we use to denote the probability simplex), is the reward function, and is a parameter that characterizes how rewards are discounted over time. is the initial state distribution.
Another concept crucial to this paper is the normalized discounted state occupancy:
The state-action occupancy is defined similarly and satisfies .
2 Batch Value-Function Approximation
We are concerned with approximating in the batch RL setting, where a dataset consisting of tuples is given, and we cannot interact with the MDP to obtain new data. We adopt the following data generation protocol from Chen and Jiang , that the tuples are i.i.d.In reality, the transition tuples extracted from the same trajectory are in general dependent, which can be handled by concentration inequalities for dependent processes with mixing assumptions [see e.g., Antos et al., 2008]. as , , , and is fully supported on .
Function Approximation
We assume access to a function class , and focus on algorithms that approximate with some and output its greedy policy . This automatically implies a policy class , from which the output policy will be chosen. Some algorithms require additional function classes, which we introduce later. We assume all function classes have finite cardinalities for simplicity when analyzing statistical errors, as they are not our main focus and extension to continuous classes with e.g., finite VC-type dimensions [Natarajan, 1989] are standard.
A representative algorithm for this setting is Fitted Q-Iteration (FQI) [Ernst et al., 2005], which can be viewed as the theoretical prototype of the popular DQN algorithm [Mnih et al., 2015]: After initializing arbitrarily, we iteratively compute as
We will discuss the relationship between FQI (and iterative methods in general) and algorithms we analyze.
Marginalized Importance Weights
We define the importance weight of any policy to be the ratio between its normalized discounted state-action occupancy and the data distribution:
Such functions are of vital importance to us, as in Section 6 we model them with function approximation to explicitly correct distribution mismatch. Their norms also characterize the exploratoriness of the data distribution, which are closely related to the concentrability coefficients in prior analyses [Munos, 2007; Antos et al., 2008; Farahmand et al., 2010; Chen and Jiang, 2019].
Additional Notations
Related Work
As mentioned in the introduction, most of the existing linear-in-horizon results do not apply to the setting of batch learning with general function approximation. For example, Munos [2007, Section 5.2] points out that AVI enjoys linear-in-horizon error propagation if it happens to converge.Our paper provides a novel explanation of this result: when FQI (which is a concrete instantiation of the abstract AVI procedure) happens to converge, Chen and Jiang shows that its solution coincides with that of MSBO, which we show enjoys linear-in-horizon error propagation whatsoever. Unfortunately, AVI—and iterative methods in general—has no convergence guarantees (and known to diverge with simple linear classes) unless used with very restricted choices of function approximators [see e.g., averagers; Gordon, 1995]. As another example, linear-in-horizon error can be achieved if one can directly minimize the Bellman error [e.g., Geist et al., 2017], but computing that requires knowledge of the transition probabilities. We refer the readers to Scherrer and the references therein for further results of this kind.
The only exceptions we are aware of are the non-stationary versions of AVI/API [e.g., Scherrer and Lesner, 2012], when the algorithm is allowed to output a periodic non-stationary policies consisting of stationary policies. For a typical value of this translates to policies, and we believe such a complexity is responsible for the clever idea not being picked up in practice despite its appealing theoretical properties. In contrast, we establish linear-in-horizon guarantees for batch algorithms that output simple stationary policies.
Clean and Tight Concentrability Coefficients
The situation of concentrability coefficients is very similar. The best definition is , enjoyed by e.g., CPI [Kakade and Langford, 2002] (see also Agarwal et al. ). However, concrete instantiations of these abstract algorithms (in a way that preserve their theoretical properties) typically require on-policy Monte-Carlo roll-outs, which are not available in the batch setting. The same constant has been associated with an abstract Bellman error minimization procedure [Geist et al., 2017], but the algorithm only searches over valid value-functions (instead of arbitrary functions produced by the function approximator). While our definition is worse than theirs by a maximum over policies under consideration, it is still significantly tighter and cleaner than the per-step definitions in most previous analyses of AVI/API [Szepesvári and Munos, 2005; Munos, 2007; Antos et al., 2008; Farahmand et al., 2010]. In fact, we show in Appendix B that even in a simple uncontrolled setting, our occupancy-based definition can be multiplicatively tighter than any per-step definitions.
MSBO
The first algorithm we analyze, MSBO, is essentially the analogy of Modified BRM [Antos et al., 2008] (which approximates ) in the context of approximating . To our knowledge, the algorithm is first analyzed by Chen and Jiang , and we improve their loss bound by (which translates to improvement in sample complexity). It is also worth pointing out that Dai et al. has derived a closely related algorithm and demonstrated its empirical effectiveness with deep neural nets.
MABO
Our second algorithm, MABO, is presented and described in such a general form for the first time. That said, the algorithmic idea can be found in several recent works: Just as MSBO is the -counterpart of Modified BRM, MABO is the -counterpart of the MQL algorithm for off-policy evaluation [Uehara et al., 2019]. Another closely related work is kernel loss [Feng et al., 2019], which becomes similar to MABO when the implicit maximization in the RHKS is interpreted as searching over an importance weight class (this connection is pointed out by Uehara et al. ). Finally, the average Bellman error is first used by Jiang et al. for PAC-exploration with function approximation, and MABO can be viewed as the batch analogy of their OLIVE algorithm, using importance weights to mimic the data collected by different exploration policies.
Telescoping Performance Difference
We present the important telescoping lemmas that enable the nice guarantees of the algorithms to be introduced and analyzed later. We start with a simple telescoping lemma, which has also been used in recent off-policy evaluation literature [e.g., Uehara et al., 2019]. Unless otherwise specified, the full proofs of the results in the main text can be found in Appendix A.
We conclude this section with some useful corollaries of Theorem 2, which may also be of independent interest on their own.
Minimax Squared Bellman Optimality Error Minimization (MSBO)
We present the performance guarantee of the first algorithm, MSBO, which uses another helper class to model for any , seeking to form an (approximately) unbiased estimate of the Bellman error :
We now state the guarantee of the algorithm.
Let be the output of MSBO. W.p. at least ,
This result improves over the bound of Chen and Jiang in several aspects, which we explain below. Furthermore, their bound for MSBO is structurally the same as that for FQI when is set as , and while we are able to improve the bound for MSBO, some of the improvements cannot be enjoyed by FQI (see the argument of Scherrer and Lesner ), creating a gap between performance guarantees of the two algorithms.
In the rest of this section, we explain the result and discuss its significance in detail. We also include a high-level sketch of the proof at the end, deferring the full proof to Appendix A.
2 Concentrability Coefficient
The second improvement, which is much more significant, is the departure from “per-step” definitions. In all analyses of AVI/API, the concentrability coefficient takes the form of
where is the marginal distribution of . is a series of non-negative coefficients that sum up to . Different versions of differ in , the policy space considered in (typically non-stationary policies concatenated using policies from ), and sometimes replacing with ; see Farahmand et al. for a detailed discussion. While it is difficult to directly compare this quantity to ours due to its complication, we show that in a simplest uncontrolled scenario where there is no distribution shift at all, any per-step definition will be at least looser than ours. We include an intuitive but informal statement below, and defer the detailed discussions to Appendix B.
3 Horizon Dependence
4 Proof Sketch
The last step follows from Cauchy-Schwarz for random variables, and the term is well-studied by Chen and Jiang and we directly use their result.
Minimax Average Bellman Optimality Error Minimization (MABO)
Let be the output of MABO. W.p. ,
In the rest of this section, we explain the bound and discuss its significance.
2 Concentrability Coefficients
3 Horizon Dependence
4 Proof Sketch of Theorem 8
Further Comparisons and Discussions
In the previous sections we have analyzed MSBO and MABO, showing that they enjoy linear-in-horizon error propagation and cleanly and tightly defined concentrability coefficients, which answers (A) and (B) in the introduction. Still, MSBO bears significant similarities to classical AVI/API algorithmsRecall that FQI coincides with MSBO using when FQI converges [Chen and Jiang, 2019], and in this sense MSBO can be viewed as a best-case scenario for FQI. in the use of squared loss and the expressivity requirement on function approximation ((C) and (D)). In this section we compare its guarantee (Theorem 5) to that of MABO (Theorem 8), and discuss the potential advantages of MABO (which is novel and understudied), as well as its limitations, compared to currently popular algorithms. The recurring theme of the comparisons—as we will see below—is the pros and cons of implicit (e.g., FQI and MSBO) and explicit (MABO) distribution corrections.
Here the second step follows from Cauchy-Schwarz, which we also used in Section 5.4. As we can see, if is specified “just right”, MABO’s guarantee never suffers more than that of MSBO on misspecified , and any looseness from Cauchy-SchwarzSee (D) in the introduction. enters the gap. On the other hand, such an advantage of MABO may be weakened if includes additional functions that do not correspond to real importance weights.
2 Statistical Rates
3 Assumptions on the Helper Classes
A characteristic shared by MSBO and MABO is the use of a helper class ( for MSBO and for MABO) to assist the estimation of the Bellman error. These helper classes also take the heaviest expressivity burdens in their corresponding algorithms: while is only required to capture , and are required to capture and , respectively, for all .
Suppose the rank of the MDP’s transition matrix is . Then,
Conclusions
We analyze two algorithms, MSBO and MABO, which enjoy linear-in-horizon error propagation, a property established for the first time for batch algorithms outputting stationary policies. MABO uses a novel importance-weight correction to handle the difficulty of Bellman error estimation, and our analyses reveal its distinct properties and potential advantages compared to classical squared-loss-based algorithms.
Acknowledgement
The authors thank Aditya Modi for providing the references to some important related works.
References
Appendix A Detailed Proofs
where the first equation follows from the definition of , the second equation follows from the definition of . ∎
These three terms can be bound separately as follows.
The second equation follows from Lemma 1, and the last step follows from marginalizing out and by conditioning on using law of total expectation.
Finally, (III), which is handled similarly to (I).
where the third equation follows from the definition of being greedy w.r.t. . The result follows by putting all three parts together. ∎
Let be the output of MSBO. W.p. at least ,
We then directly adopt the upper bound on from Chen and Jiang :
By substitute Eq.(58) into Eq.(61) and adapt the the proof of Theorem 17 in Chen and Jiang , we have
Let be the output of MABO. W.p. ,
We now bound for any policy . Let
At this point, we peeled off all the approximation errors from , and it remains to bound the estimation error
where (a) follows form and (b) follows from Eq.(75) and the following argument:
Now, since the only difference between term (I) and term (II) is the choice of and , it suffices to provide a uniform deviation bound that applies to all and . Before applying concentration bounds, it will be useful to first verify the boundedness of the random variables: , and (recall that we assumed ). Therefore, by Bernstein’s inequality and the union bound, w.p. at least we have that for any and ,
where (a) is obtained by the following argument:
Appendix B Comparison between Per-step vs. Occupancy-based Concentrability Coefficients
We provide an example to illustrate the limitation of the per-step concentrability coefficients (Proposition 6). Consider a deterministic chain MDP, where there are states, . There is only one action, which we omit in the notations. is the deterministic initial state, and each transitions to under the only action for . is an absorbing state (i.e., it transitions to itself). The reward function is inconsequential.
There is only one possible policy for this MDP, and we let the data distribution . The occupancy-based concentrability coefficient is always (either or ), which agrees with the intuition that there is no distribution shift. Since the per-step definitions (Eq.(17)) are always the convex combinations of for , we can assert that it is never lower than however the combination coefficients are chosen.
Replacing with gives exactly the same results. (When the distribution on the enumerator is a point mass, of the importance weight is the same as .) Therefore, as long as is sufficiently large so that , we have for all , and the per-step concentrability coefficient is at least . As a final remark, since the MDP only has 1 policy, the result has no dependence on the choice of policy class in in the definition of concentrability coefficient, so we have virtually covered all existing definitions in the AVI/API literature.
Appendix C On Iterative Methods’ Lack of Control of Bellman Errors
We demonstrate that iterative methods fail to directly control the Bellman error on the data distribution . Consider a two-state deterministic MDP with just 1 action, where transitions to , and is absorbing. The reward is always .
We use the tabular representation for this MDP, where . Assume our batch data only contains transition tuples of form , and no data points from are present. We first show how FQI behave on this example. Given the update rule of FQI (Eq.(3)),
Therefore, with very update, will obtain the old value of from the previous iteration, whereas the new value of will be set arbitrarily. Since the mean square Bellman error is , its value can be arbitrarily away from and do not become smaller over iterations. In comparison, it is easy to verify that MSBO and MABO do not suffer from this issue: although there is also arbitrariness in their outputs due to insufficient data coverage, their outputs will always satisfy and hence imply zero Bellman error on .
Appendix D Existence of Simple 𝒲𝒲\mathcal{W} in Low-rank MDPs (Proposition 10)
Since is supported on the entire , we have . Putting all results together, it suffices to choose , and .
Remark on the |𝒬|𝒬|\mathcal{Q}| Dependence in the General Case
The annoying dependence on comes from the fact that we hope the state-action occupancy vectors of different policies to have low-rank factorization (which is satisfied in the more restricted case; see Claim 2). In general low-rank MDPs, however, only state occupancy factorizes and the state-action one does not; a counter-example can be easily shown in contextual bandits:
Consider an MDP with 2 actions per state. is uniform among states, all of which transition deterministically to the last state, which is absorbing. This MDP essentially emulates a contextual bandit. Since all states share exactly the same next-state distribution, the rank of the transition matrix is regardless of how large is. Now consider a policy space , where each policy takes action in one of the states, and takes in all other states; there are such policies. It is easy to show that the matrix consisting of state-action occupancy for all policies in has full-rank , which cannot be bounded by the rank of the transition matrix when is large.
Given this difficulty, our strategy is to first find the policies whose state occupancy vectors span the entire low-dimensional space, and take their Cartesian product with to handle the actions, which results in the dependence. As we will see below, we can avoid paying when the class is more structured.
Claim 2: Restricted Case of Knowing the Left Factorization Matrix as Features [Yang and Wang, 2019]
Remark
Since is closed under Bellman update in this setting, one may also use as the helper class for MSBO. However, the complexity of in this case only matches that of in the more general case (Claim 1) and is significant worse than what we can achieve here ().