What are the Statistical Limits of Offline RL with Linear Function Approximation?
Ruosong Wang, Dean P. Foster, Sham M. Kakade
Introduction
Offline methods (also known as off-policy methods or batch methods) are a promising methodology to alleviate the sample complexity burden in challenging reinforcement learning (RL) settings, particularly those where sample efficiency is paramount (Mandel et al. 2014; Gottesman et al. 2018; Wang et al. 2018; Yu et al. 2019). Off-policy methods are often applied together with function approximation schemes; such methods take sample transition data and reward values as inputs, and approximate the value of a target policy or the value function of the optimal policy. Indeed, many practical deep RL algorithms find their prototypes in the literature of offline RL. For example, when running on off-policy data (sometimes termed as “experience replay”), deep -networks (DQN) (Mnih et al. 2015) can be viewed as an analog of Fitted -Iteration (Gordon 1999) with neural networks being the function approximators. More recently, there are an increasing number of both model-free (Laroche et al. 2019; Fujimoto et al. 2019; Jaques et al. 2020; Kumar et al. 2019; Agarwal et al. 2020) and model-based (Ross and Bagnell 2012; Kidambi et al. 2020) offline RL methods, with steady improvements in performance (Fujimoto et al. 2019; Kumar et al. 2019; Wu et al. 2020; Kidambi et al. 2020).
However, despite the importance of these methods, the extent to which data reuse is possible, especially when off-policy methods are combined with function approximation, is not well understood. For example, deep -network requires millions of samples to solve certain Atari games (Mnih et al. 2015). Also important is that in some safety-critical settings, we seek guarantees when offline-trained policies can be effective (Thomas 2014; Thomas et al. 2019). A basic question here is that if there are fundamental statistical limits on such methods, where sample-efficient offline RL is simply not possible without further restrictions on the problem.
In the context of supervised learning, it is well-known that empirical risk minimization is sample-efficient if the hypothesis class has bounded complexity. For example, suppose the agent is given a -dimensional feature extractor, and the ground truth labeling function is a (realizable) linear function with respect to the feature mapping. Here, it is well-known that a polynomial number of samples in suffice for a given target accuracy. Furthermore, in this realizable case, provided the training data has a good feature coverage, then we will have good accuracy against any test distribution. Specifically, if the features have a uniformly bounded norm and if the minimum eigenvalue of the feature covariance matrix of our data is bounded away from , say by , then we have good accuracy on any test distribution. See Assumption 2 and the comments thereafter.
In the more challenging offline RL setting, it is unclear if sample-efficient methods are possible, even under analogous assumptions. This is our motivation to consider the following question:
What are the statistical limits for offline RL with linear function approximation?
Here, one may hope that value estimation for a given policy is possible in the offline RL setting under the analogous set of assumptions that enable sample-efficient supervised learning, i.e., 1) (realizability) the features can perfectly represent the value functions and 2) (good coverage) the feature covariance matrix of our off-policy data has lower bounded eigenvalues.
The extant body of provable methods on offline RL either make representational assumptions that are far stronger than realizability or assume distribution shift conditions that are far stronger than having coverage with regards to the spectrum of the feature covariance matrix of the data distribution. For example, Szepesvári and Munos 2005 analyze offline RL methods by assuming a representational condition where the features satisfy (approximate) closedness under Bellman updates, which is a far stronger representation condition than realizability. Recently, Xie and Jiang 2020a propose a offline RL algorithm that only requires realizability as the representation condition. However, the algorithm in (Xie and Jiang 2020a) requires a more stringent data distribution condition. Whether it is possible to design a sample-efficient offline RL method under the realizability assumption and a reasonable data coverage assumption — an open problem in (Chen and Jiang 2019) — is the focus of this work.
Perhaps surprisingly, our main result shows that, under only the above two assumptions, it is information-theoretically not possible to design a sample-efficient algorithm to non-trivially estimate the value of a given policy. The following theorem is an informal version of the result in Section 4.
In the offline RL setting, suppose the data distributions have (polynomially) lower bounded eigenvalues, and the -functions of every policy are linear with respect to a given feature mapping. Any algorithm requires an exponential number of samples in the horizon to output a non-trivially accurate estimate of the value of any given policy , with constant probability.
This hardness result states that even if the -functions of all polices are linear with respect to the given feature mapping, we still require an exponential number of samples to evaluate any given policy. Note that this representation condition is significantly stronger than assuming realizability with regards to only a single target policy; it assumes realizability for all policies. Regardless, even under this stronger representation condition, it is hard to evaluate any policy, as specified in our hardness result.
This result also formalizes a key issue in offline reinforcement learning with function approximation: geometric error amplification. To better illustrate the issue, in Section 5, we analyze the classical Least-Squares Policy Evaluation (LSPE) algorithm under the realizability assumption, which demonstrates how the error propagates as the algorithm proceeds. Here, our analysis shows that, if we only rely on the realizability assumption, then a far more stringent condition is required for sample-efficient offline policy evaluation: the off-policy data distribution must be quite close to the distribution induced by the policy to be evaluated.
Our results highlight that sample-efficient offline RL is simply not possible unless either the distribution shift condition is sufficiently mild or we have stronger representation conditions that go well beyond realizability. See Section 5 for more details.
Furthermore, our hardness result implies an exponential separation on the sample complexity between offline RL and supervised learning, since supervised learning (which is equivalent to offline RL with ) is possible with polynomial number of samples under the same set of assumptions.
A few additional points are worth emphasizing with regards to our lower bound construction:
Our results imply that Least-Squares Policy Evaluation (LSPE, i.e., using Bellman backups with linear regression) will fail. Interestingly, while LSPE will provide an unbiased estimator, our results imply that it will have exponential variance in the problem horizon.
Our construction is simple and does not rely on having a large state or action space: the size of the state space is only where is the feature dimension and is the planning horizon, and the size of the action space is only is . This stands in contrast to other RL lower bounds, which typically require state spaces that are exponential in the problem horizon (e.g. see (Du et al. 2020)).
We provide two hard instances, one with a sparse reward (and stochastic transitions) and another with deterministic dynamics (and stochastic rewards). These two hard instances jointly imply that both the estimation error on reward values and the estimation error on the transition probabilities could be geometrically amplified in offline RL.
Of possibly broader interest is that our hard instances are, to our knowledge, the first concrete examples showing that geometric error amplification is real in RL problems (even with realizability). While this is a known concern in the analysis of RL algorithms, there have been no concrete examples exhibiting such behavior under only a realizability assumption.
Related Work
We now survey prior work on offline RL, largely focusing on theoretical results. We also discuss results on the error amplification issue in RL. Concurrent to this work, Xie and Jiang 2020a propose a offline RL algorithm under the realizability assumption, which requires stronger distribution shift conditions. We will discuss this work shortly.
Offline RL with value function approximation is closely related to Approximate Dynamic Programming (Bertsekas and Tsitsiklis 1995). Existing works (Munos 2003; Szepesvári and Munos 2005; Antos et al. 2008; Munos and Szepesvári 2008; Tosatto et al. 2017; Xie and Jiang 2020b) that analyze the sample complexity of approximate dynamic programming-based approaches usually make the following two categories of assumptions: (i) representation conditions that assume the function class approximates the value functions well and (ii) distribution shift conditions that assume the given data distribution has sufficient coverage over the state-action space. As mentioned in the introduction, the desired representation condition would be realizability, which only assumes the value function of the policy to be evaluated lies in the function class (for the case of offline policy evaluation) or the optimal value function lies in the function class (for the case of finding near-optimal policies), and existing works usually make stronger assumptions. For example, Szepesvári and Munos 2005 assume (approximate) closedness under Bellman updates, which is much stronger than realizability. Whether it is possible to design a sample-efficient offline RL method under the realizability assumption and reasonable data coverage assumption, is left as an open problem in (Chen and Jiang 2019).
To measure the coverage over the state-action space of the given data distribution, existing works assume the concentratability coefficient (introduced by Munos 2003) to be bounded. The concentratability coefficient, informally speaking, is the largest possible ratio between the probability for a state-action pair to be visited by a policy, and the probability that appears on the data distribution. Since we work with linear function approximation in this work, we measure the distribution shift in terms of the spectrum of the feature covariance matrices (see Assumption 2), which is a well-known sufficient condition in the context of supervised learning and is much more natural for the case of linear function approximation.
Concurrent to this work, Xie and Jiang 2020a propose an algorithm that works under the realizability assumption instead of other stronger representation conditions used in prior work. However, the algorithm in (Xie and Jiang 2020a) requires a much stronger data distribution condition which assumes a stringent version of concentrability coefficient introduced by (Munos 2003) to be bounded. In contrast, in this work we measure the distribution shift in terms of the spectrum of the feature covariance matrix of the data distribution, which is more natural than the concentrability coefficient for the case of linear function approximation.
Recently, there has been great interest in applying importance sampling to approach offline policy evaluation (Precup 2000). For a list of works on this topic, see (Dudík et al. 2011; Mandel et al. 2014; Thomas et al. 2015; Li et al. 2015; Jiang and Li 2016; Thomas and Brunskill 2016; Guo et al. 2017; Wang et al. 2017; Liu et al. 2018; Farajtabar et al. 2018; Xie et al. 2019; Kallus and Uehara 2019; Liu et al. 2019; Uehara and Jiang 2019; Kallus and Uehara 2020; Jiang and Huang 2020; Feng et al. 2020). Offline policy evaluation with importance sampling incurs exponential variance in the planning horizon when the behavior policy is significantly different from the policy to be evaluated. Bypassing such exponential dependency requires non-trivial function approximation assumptions (Jiang and Huang 2020; Feng et al. 2020; Liu et al. 2018). Finally, Kidambi et al. 2020 provides a model-based offline RL algorithm, with a theoretical analysis based on hitting times.
Hardness Results.
Historically, algorithm-specific hardness results have been known for a long time in the literature of Approximate Dynamic Programming. See Chapter 4 in (Van Roy 1994) and also (Gordon 1995; Tsitsiklis and Van Roy 1996). These works demonstrate that certain approximate dynamic programming-based methods will diverge on hard cases. However, such hardness results only hold for a restricted class of algorithms, and to demonstrate the fundamental difficulty of offline RL, it is more desirable to obtain information-theoretic lower bounds, as recently initiated by Chen and Jiang 2019.
Existing (information-theoretic) exponential lower bounds (Krishnamurthy et al. 2016; Sun et al. 2017; Chen and Jiang 2019) usually construct unstructured MDPs with an exponentially large state space. Du et al. 2020 prove an exponential lower bound for planning under the assumption that the optimal -function is approximately linear. The condition that the optimal -function is only approximately linear is crucial for the correctness of the hardness result in Du et al. 2020 The techniques in (Du et al. 2020) are later generalized to other settings, including (Kumar et al. 2020; Wang et al. 2020; Mou et al. 2020).
Error Amplification In RL.
Error amplification induced by distribution shift and long planning horizon is a known issue in the theoretical analysis of RL algorithms. See (Gordon 1995; Gordon 1996; Munos and Moore 1999; Ormoneit and Sen 2002; Kakade 2003; Zanette et al. 2019) for papers on this topic and additional assumptions that mitigate this issue. Error amplification in offline RL is also observed in empirical works (see e.g. (Fujimoto et al. 2019)). In this work, we provide the first information-theoretic lower bound showing that geometric error amplification is real in offline RL.
The Offline Policy Evaluation Problem
Throughout this paper, for a given integer , we use to denote the set .
A (stochastic) policy chooses an action randomly based on the current state . The policy induces a (random) trajectory , where , , , , etc. To streamline our analysis, for each , we use to denote the set of states at level , and we assume do not intersect with each other. We assume, almost surely, that for all .
Value Functions.
Given a policy , and , the -function and value function are defined as:
For a policy , we define to be the value of from the fixed initial state .
Linear Function Approximation.
Note that our assumption is substantially stronger than assuming realizability with regards to a single target policy (say the policy that we wish to evaluate); our assumption imposes realizability for all policies.
Offline Reinforcement Learning.
Notation.
The Lower Bound: Realizability and Coverage are Insufficient
We now present our main hardness result for offline policy evaluation with linear function approximation. It should be evident that without feature coverage in our dataset, realizability alone is clearly not sufficient for sample-efficient estimation. Here, we will make the strongest possible assumption, with regards to the conditioning of the feature covariance matrix.
For all , assume our feature map is bounded such that . Furthermore, suppose for each , the data distributions satisfy the following minimum eigenvalue condition:
Clearly, for the case where , the realizability assumption (Assumption 1), and feature coverage assumption (Assumption 2) imply that the ordinary least squares estimator will accurately estimate . For , the ordinary least squares estimator will satisfy that with high probability. See e.g. (Hsu et al. 2012b). Our main result now shows that these assumptions are not sufficient for offline policy evaluation for long horizon problems.
Suppose Assumption 2 holds. Fix an algorithm that takes as input both a policy and a feature mapping. There exists a (deterministic) MDP satisfying Assumption 1, such that for any policy , the algorithm requires samples to output the value of up to constant additive approximation error with probability at least .
Although we focus on offline policy evaluation in this work, our hardness result also holds for finding near-optimal policies under Assumption 1 in the offline RL setting with linear function approximation. Below we give a simple reduction. At the initial state, if the agent chooses action , then the agent receives a fixed reward value (say ) and terminates. If the agent chooses action , then the agent transits to our hard instance. Therefore, in order to find a policy with suboptimality at most , the agent must evaluate the value of the optimal policy in our hard instance up to an error of , and hence the hardness result holds.
As stated, the theorem uses a deterministic MDP (with stochastic rewards). See Appendix A for another hard case where the transition is stochastic and the reward is deterministic and sparse (only occurring at two states at ).
For offline policy evaluation with linear function approximation, the most naïve algorithm here would be LSPE, i.e., using ordinary least squares (OLS) to estimate , starting at level and then proceeding backwards to level , using the plug-in estimator from the previous level. Here, LSPE will provide an unbiased estimate (provided the feature covariance matrices are full rank, which will occur with high probability). Interestingly, as a direct corollary, the above theorem implies that LSPE has exponential variance in . See Section 5 for a more detailed discussion on LSPE. More generally, our theorem implies that there is no estimator that can avoid such exponential dependence in the offline setting.
In the offline setting, under Assumptions 1 and 2, in order to find a near-optimal policy, the most naïve algorithm here would be LSVI, i.e., using ordinary least squares (OLS) to estimate , starting at level and then proceeding backwards to level , using the plug-in estimator from the previous level and the bellman operator. As a corollary, the above theorem implies that LSVI will require an exponential number of samples to find a near-optimal policy. On the other hand, if the regression targets are collected by using rollouts (i.e. on-policy sampling) as in LSPI (Lagoudakis and Parr 2003), then a polynomial number of samples suffice. See Section D in (Du et al. 2020) for an analysis. Therefore, Theorem 4.1 implies an exponential separation on the sample complexity between LSVI and LSPI. Of course, LSPI requires adaptive data samples and thus does not work in the offline setting.
One may wonder if Theorem 4.1 still holds when the data distributions are induced by a policy. In Appendix A, we prove another exponential sample complexity lower bound under the additional assumption that the data distributions are induced by a fixed policy . However, under such an assumption, it is impossible to prove a hardness result as strong as Theorem 4.1 (which shows that evaluating any policy is hard), since one can at least evaluate the policy that induces the data distributions. Nevertheless, we are able to prove the hardness of offline policy evaluation, under a weaker version of Assumption 1. See Appendix A for more details.
In this section, we give the hard instance construction and the proof of Theorem 4.1. We use the denote the feature dimension, and we assume is even for simplicity. We use to denote for convenience. We also provide an illustration of the construction in Figure 1.
The action space . For each , contains states and . For each , for each , we have
Reward Distributions.
Let be a parameter to be determined. For each and , we set and . For the last level, for each and , we set
Feature Mapping.
Verifying Assumption 1.
Now we verify that Assumption 1 holds for our construction.
We first verify is linear for the first levels. For each , we have
then for all .
Now we verify that the -function is linear for the last level. Clearly, for all and , and . Thus by defining , we have for all .
The Data Distributions.
For each level , the data distribution is a uniform distribution over . Notice that is not in the support of for all . It can be seen that,
The Lower Bound.
We show that it is information-theoretically hard for any algorithm to distinguish the case and . We fix the initial state to be , and consider any policy . When , all reward values will be zero, and thus the value of would be zero. On the other hand, when , the value of would be . Thus, if the algorithm approximates the value of the policy up to an error of , then it must distinguish the case that and .
For all state-action pairs in the support of the data distributions of the first levels, the reward distributions will be identical. This is because for all and , we have . For the case and , for all state-action pairs in the support of the data distribution of the last level,
Therefore, to distinguish the case that and , the agent needs to distinguish two reward distributions
It is well known that in order to distinguish and with probability at least , any algorithm requires samples. See e.g. Lemma 5.1 in (Anthony and Bartlett 2009). See also (Chernoff 1972; Mannor and Tsitsiklis 2004).
The key in our construction is the state in each level, whose feature vector is defined to be . In each level, amplifies the -values by a factor, due to the linearity of the -function. After all the levels, the value will be amplified by a factor. Since is not in the support of the data distribution, the only way for the agent to estimate the value of the policy is to estimate the expected reward value in the last level. Our construction forces the estimation error of the last level to be amplified exponentially and thus implies an exponential lower bound.
We would like to remark that the design of the feature mapping in our construction could be flexible. It suffices if are only nearly orthogonal. Moreover, the feature of can be changed to for a general set of coefficients so long as is sufficiently large.
Upper Bounds: Low Distribution Shift or Policy Completeness are Sufficient
In order to illustrate the error amplification issue and discuss conditions that permit sample-efficient offline RL, in this section, we analyze Least-Squares Policy Evaluation when applied to the offline policy evaluation problem under the realizability assumption. The algorithm is presented in Algorithm 1. For simplicity here we assume the policy to be evaluated is deterministic.
Before presenting our analysis, we first define necessary notations. For each , define
to be the feature covariance matrix of the data distribution at level . Moreover, for each , define
Now we present a general lemma that characterizes the estimation error of Algorithm 1 by an equality. The proof can be found in Appendix B. In later parts of this section, we apply this general lemma to special cases.
In the remaining part of this section, we consider two special cases where the estimation error in Equation 1 can be upper bounded.
Low Distribution Shift.
The first special we focus on is the case where the distribution shift between the data distributions and the distribution induced by the policy to be evaluated is low. To measure the distribution shift formally, our main assumption is as follows.
We assume that for each , there exists such that .
For each , if for some , then we have . Therefore, Assumption 3 can be replaced with the assumption that . However, we stick to the original version of Assumption 3, since it gives a tighter characterization of the distribution shift when applying Algorithm 1 to off-policy evaluation under the realizability assumption.
Now we state the theoretical guarantee of Algorithm 1. The proof can be found in Appendix B.
The factor in Theorem 5.2 implies that the estimation error will be amplified geometrically as the algorithm proceeds. Now we briefly discuss how the error is amplified when running Algorithm 1 on the instance in Section 4 to better illustrate the issue. If we run Algorithm 1 on the hard instance in Section 4, when , the estimation error on would be roughly for each . When using the linear predictor at level to predict the value of , the error will be amplified by . When , the dataset contains only for , and the estimation error on the value of will be the same as that of , which is roughly . Again, the estimation error on the value of will be when using the linear predictor at level . As the algorithm proceeds, the error will eventually be amplified by a factor of , which corresponds to the factor in Theorem 5.2.
Policy Completeness.
In the offline RL literature, another common representation condition is closedness under Bellman update (Szepesvári and Munos 2005; Chen and Jiang 2019), which is stronger than realizability. In the context of offline policy evaluation, we have the following policy completeness assumption.
Before ending this section, we would like to note that the above analysis again implies that geometric error amplification is a real issue in offline RL, and sample-efficient offline RL is impossible unless the distribution shift is sufficiently low, i.e., is bounded, or stronger representation condition such as policy completeness is assumed as in prior works (Szepesvári and Munos 2005; Chen and Jiang 2019).
Conclusion
While the extant body of provable results in the literature largely focus on sufficient conditions for sample-efficient offline RL, this work focuses on obtaining a better understanding of the necessary conditions, where we seek to understand to what extent mild assumptions can imply sample-efficient offline RL. This work shows that for off-policy evaluation, even if we are given a representation that can perfectly represent the value function of the given policy and the data distribution has good coverage over the features, any provable algorithm still requires an exponential number of samples to non-trivially approximate the value of the given policy. These results highlight that provable sample-efficient offline RL is simply not possible unless either the distribution shift condition is sufficiently mild or we have stronger representation conditions that go well beyond realizability.
Acknowledgments
The authors would like to thank Akshay Krishnamurthy, Alekh Agarwal, Wen Sun, and Nan Jiang for numerous helpful discussion on offline RL. Sham Kakade gratefully acknowledges funding from the ONR award N00014-18-1-2247, and NSF Awards CCF-1703574 and CCF-1740551.
References
Appendix A Another Hard Instance
In this section, we adopt the following realizability assumption, which is a weaker version of Assumption 1.
In this hard case, the action space contains elements. contains a single state . For each , contains states and .
Let be a parameter to be determined. We first define the transition operator for the first level. We have
Now we define the transition operator when . For each , and , we have , and . For each and , we have . For all , we have
Now we define the transition operator for the second last level. For all and , we have
For all , we have and . For each , we have . For all , we have
Reward Values.
In this hard case, all reward values are deterministic, and reward values can be non-zero only for the last level. Formally, we have
Feature Mapping.
Now we define the feature mapping when . For each , and , , and . Moreover, for all actions ,
Clearly, for all , .
Verifying Assumption 5.
Now we consider the deterministic policy , which is defined to be for all . We show that Assumption 5 holds.
For each , define
For the second last level , define
Finally, for the last level , define
It can be verified that for each , for all .
The Data Distributions.
For the first level, the data distribution is defined to be the uniform distribution over . For each , the data distribution is a uniform distribution over
Notice that again is not in the support of for all actions . It can be seen that for all ,
The Lower Bound.
Now we show that it is information-theoretically hard for any algorithm to distinguish the case and in the offline setting by taking samples from the data distributions . Here we consider the above policy defined above which returns action for all input states. Notice that when , the value of the policy would be zero. On the other hand, when , the value of the policy would be . Therefore, if the algorithm approximates the value of the policy up to an approximation error of , then it must distinguish the case that and .
Now, for all state-action pairs in the support of the data distributions of the first levels (namely ), the transition operator will be identical. This is because changing only changes the transition distributions of , and such state-actions are not in the support of for all . Moreover, for any in the support of , will also be identical no matter or . For those state-action pairs in the support of with , we have
Again, this is because is not in the support of for all .
Therefore, in order to distinguish the case and , the agent needs distinguish two transition distributions
Again, by Lemma 5.1 in [Anthony and Bartlett 2009], in order to distinguish and with probability at least , one needs samples. Formally, we have the following theorem.
Suppose Assumption 2 holds, and rewards are deterministic and could be none-zero only for state-action pairs in the last level. Fix an algorithm that takes as input both a policy and a feature mapping. There exists an MDP satisfying Assumption 5, such that for a fixed policy , the algorithm requires samples to output the value of up to constant additive approximation error with probability at least .
Appendix B Analysis of Algorithm 1
B.2 Proof of Theorem 5.2
By matrix concentration inequality [Tropp 2015], we have the following lemma.
For each , with probability , for some universal constant , we have
Therefore, since , with probability , we have
which implies . Moreover, conditioned on the event in Lemma B.1,
Finally, by Theorem 1.2 in [Hsu et al. 2012a], with probability , for some constant , we have
Let be a large enough constant. We now have