Reward-Free Exploration for Reinforcement Learning

Chi Jin, Akshay Krishnamurthy, Max Simchowitz, Tiancheng Yu

Introduction

In reinforcement learning (RL), an agent repeatedly interacts with an unknown environment with the goal of maximizing its cumulative reward. To do so, the agent must engage in exploration, learning to visit states in order to investigate whether they hold high reward.

Exploration is widely regarded as the most significant challenge in RL, because the agent may have to take precise sequences of actions to reach states with high reward. Here, simple randomized exploration strategies provably fail: for example, a random walk can take exponential time to reach the corner of the environment where the agent can accummulate high reward (Li, 2012). While reinforcement learning has seen a tremendous surge of recent research activity, essentially all of the standard algorithms deployed in practice employ simple randomization or its variants, and consequently incur extremely high sample complexity.

On the other hand, sophisticated exploration strategies which deliberately incentivize the agent to visit new states are provably sample-efficient (c.f., Kearns and Singh (2002); Brafman and Tennenholtz (2002); Azar et al. (2017); Dann et al. (2017); Jin et al. (2018)), with recent work providing a nearly-complete theoretical understanding for maximizing a single prespecified reward function Dann and Brunskill (2015); Azar et al. (2017); Zanette and Brunskill (2019); Simchowitz and Jamieson (2019). In practice, however, reward functions are often iteratively engineered to encourage desired behavior via trial and error (e.g. in constrained RL formulations (Altman, 1999; Achiam et al., 2017; Tessler et al., 2018; Miryoosefi et al., 2019)). In such cases, repeatedly invoking the same reinforcement learning algorithm with different reward functions can be quite sample inefficient.

One solution to avoid excessive data collection in such settings is to first collect a dataset with good coverage over all possible scenarios in the environment, and then apply a “Batch-RL” algorithm. Indeed many algorithms are known for computing near optimal policies from previously collect data, provided that the dataset has good coverage (Munos and Szepesvári, 2008; Antos et al., 2008; Chen and Jiang, 2019; Agarwal et al., 2019). However, prior work provides little guidance into how to obtain such good coverage.

In this paper, we aim to develop an end-to-end instantiation of this proposal. To this end we ask:

How can we efficiently explore an environment without using any reward information?

In particular, by exploring the environment, we aim to gather sufficient information so that we can compute the near-optimal policies for any reward function after-the-fact.

In this paper, we present the first near-optimal upper and lower bounds which characterize the sample complexity of achieving provably sufficient coverage for Batch-RL. We do so by adopting a novel “reward-free RL” paradigm: During an exploration phase, the agent collects trajectories from an MDP M\mathcal{M} without a pre-specified reward function. Then, in a planning phase, it is tasked with computing near-optimal policies under the transitions of M\mathcal{M} for a large collection of given reward functions.

Our exploration phase is conceptually simple, using an existing RL algorithm as a black-box (Zanette and Brunskill, 2019), and our planning phase accommodates arbitrary Batch-RL solvers. We instantiate our result with value iteration and natural policy gradient as special cases. By decoupling exploration and planning, our work sheds light on the algorithmic mechanisms required for sample efficient reinforcement learning. We hope that this insight will be useful in the design of provably efficient algorithms for more practically relevant RL settings, such as those where function approximation is required.

In addition to our algorithmic results, we establish a nearly-matching Ω(S2AH2/ϵ2)\Omega(S^{2}AH^{2}/\epsilon^{2}) lower bound, demonstrating the near-optimality of our algorithm in this paradigm. Notably, this lower bound quantifies a price of “good-coverage” in the reward-free setting: while RL with a pre-specified reward has sample complexity of only Θ~(SAH2/ϵ2)\widetilde{\Theta}(SAH^{2}/\epsilon^{2}) (Dann and Brunskill, 2015), the reward-free sample complexity is a factor of SS larger.

The main technical challenge in our work involves handling environments with states that are difficult to reach. In such cases, we cannot learn the transition operator to high accuracy uniformly over the environment, simply because we cannot reach these states to collect enough data. With λ(s)\lambda(s) denoting the maximal probability of visiting state ss under any policy, our key observation is that we can partition the state space into two groups: the states with λ(s)\lambda(s) so small that they have negligible contribution to reward optimization, and the rest. We introduce a rigorous analysis which enables us to “ignores” the difficult-to-visit states altogether and only requires that we visit the remaining states with probability proportional λ(s)\lambda(s). To achieve this latter guarantee, we conduct our exploration with the Euler algorithm (Zanette and Brunskill, 2019), which in our context yields refined sample complexity guarantees in terms of λ(s)\lambda(s). We believe that this decomposition of states into their ease of being reached may be of broader interest. Our lower bound also adopts a novel and sophisticated construction, detailed in Section 4.

For reward-free exploration in the tabular setting, we are aware of only a few prior approaches. First, when one runs a PAC-RL algorithm like RMax with no reward function (Brafman and Tennenholtz, 2002), it does visit the entire state space and can be shown to provide a coverage guarantee. However, for RMax in particular the resulting sample complexity is quite poor, and significantly worse than our near-optimal guarantee (See Appendix A for a detailed calculation). We expect similar behavior from other PAC algorithms, because reward-dependent exploration is typically suboptimal for the reward-free setting.

Second, one can extract the exploration component of recent results for RL with function approximation (Du et al., 2019; Misra et al., 2019). Specifically, the former employs a model based approach where a model is iteratively refined by planning to visit unexplored states, while the latter uses model free dynamic programming to identify and reach all states. While these papers address a more difficult setting, it is relatively straightforward to specialize their results to the tabular setting. In this case, both methods guarantee coverage, but they have suboptimal sample complexity and require that all states can be visited with significant probability. In contrast, our approach requires no visitation probability assumptions and achieves the optimal sample complexity.

The last point of comparison is a recent result of Hazan et al. (2018), that gives an efficient algorithm for finding a certain exploratory policy. They use a Frank-Wolfe style algorithm to find a policy whose state occupancy measure has maximum entropy. One can show that an exact optimizer for their objective has a similar coverage property to our exploratory policy, but the Frank-Wolfe style algorithm can only guarantee an approximate optimizer. They do not analyze how the optimization error enters in the coverage guarantee, but we are able to show that setting the error to O(1/S)O(1/S) suffices (see Appendix B). Unfortunately, this implies that their sample complexity scales with S5S^{5}, which is much worse than ours. More generally, their result is not end-to-end in that they do not show how to use their policy for planning, and they do not establish a final sample complexity bound, both of which we do here.

Finally, the main source of motivation for our work is recent and classical results on batch reinforcement learning (Munos and Szepesvári, 2008; Antos et al., 2008; Chen and Jiang, 2019; Agarwal et al., 2019), a setting where the goal is to find a near optimal policy, given an a priori dataset collected by some logging policy that satisfies certain coverage properties. In this paper, we show how to find such a logging policy for the tabular setting, which enables straightforward application of these batch RL results. As an example, we show how to apply both value iteration and natural policy gradient to optimize the policy given any reward function. More generally, these works typically also consider the function approximation setting, and we believe our modular approach will facilitate development of provably efficient algorithms for these challenging settings.

Preliminaries

where we define VH+1π(s)=VH+1⋆(s)=0V^{\pi}_{H+1}(s)=V^{\star}_{H+1}(s)=0 for any s∈Ss\in\mathcal{S}.

The RL objective is to find an ϵ\epsilon-optimal policy π\pi, satisfying

In the reward-free setting, we would like to design algorithms that efficiently explore the state space without the guidance of reward information. Formally, the agent interacts with the environment through Protocol 1—a reward-free version of the MDP, where the agent can transit as usual but does not collect any rewards. Over the course of KK episodes following Protocol 1, the agent collects a dataset of visisted states, actions, and transitions D={sh(k),ah(k)}(k,h)∈[K]×[H]\mathcal{D}=\{s^{(k)}_{h},a^{(k)}_{h}\}_{(k,h)\in[K]\times[H]}, which is the outcome of the exploration phase.

The effectiveness of the exploration strategy is evaluated in the next phase—the planning phase—in which the agent is no longer allowed to interact with the MDP. In this phase, the agent is given a reward function r(⋅,⋅)r(\cdot,\cdot) that can be potentially adversarily designed, and the objective here is to compute a near optimal policy for this reward function using the dataset D\mathcal{D}. Performance is measured in terms of how many episodes KK are required in the exploration phase so that the agent can reliably achieve the objective above. As notation, we use V(⋅;r)V(\cdot;r) to emphasize that the value function depends on the reward rr.

We remark that providing the reward function after the exploration phase (as opposed to before) makes the setting more challenging, and so our algorithm applies to the easier setting. We also note that our results address the setting where the reward is observed through interaction with the environment, as learning the reward is typically not the statistical barrier to efficient RL. Indeed, a provably effective reward-free exploration strategy must visit all “significant” state-action pairs (see Definition 3.2) sufficiently many times anyway, and this experience is sufficient to learn the reward function.

Main Results

Ther exists an absolute constant c>0c>0 and a reward-free exploration algorithm such that, for any p∈(0,1)p\in(0,1), with probability at least 1−p1-p, the algorithm outputs ϵ\epsilon-optimal policies for an arbitrary number of adaptively chosen reward functions. The number of episodes collected in the exploration phase is bounded by

where ι:=log⁡(SAH/(pϵ))\iota\mathrel{\mathop{:}}=\log(SAH/(p\epsilon)).

We emphasize that the correctness guarantee here is quite strong: the dataset D\mathcal{D} collected by the algorithm is such that any number of adaptively chosen reward functions can be optimized with no further data collection. In contrast, if we naïvely deployed a reward-sensitive RL algorithm, we would have to collect additional trajectories for each reward function, which could be quite sample inefficient. We emphasize that requiring near-optimal policies for many reward functions is quite common in applications, especially when we design reward functions by trial and error to elicit specific behaviors.

Our algorithm proceeds with following high level steps:

learn a set of policies Ψ\Psi which allow us to visit all “significant” states with reasonable probability.

collect a sufficient amount of data by executing policies in Ψ\Psi.

The first two steps are performed in the exploration phase, while the latter two steps are performed in the planning phase. In Section 3.1 and Section 3.2, we will present our formal algorithms and the corresponding theoretical guarantees for two phases separately. One important feature of our algorithm is that we can use existing approximate MDP solvers or batch-RL algorithms in the last step. We demonstrate with two examples, namely Value Iteration (VI) and Natural Policy Gradient (NPG), in Section 3.3.

1 Exploration Phase

The goal of exploration is to visit all possible states so that the agent can gather sufficient information in order to find the optimal policy eventually. However, rather different from the bandit setting where agent can select an arbitrary arm to pull, it is possible that certain state in the MDP is very difficult to reach no matter what policy the agent is taking. Therefore, we first introduce the concept of the state being “significant”. See Figure 1 for illustrations.

A state ss in step hh is δ\delta-significant if there exists a policy π\pi, so that the probability to reach ss following policy π\pi is greater than δ\delta. In symbol:

Intuitively, with limited budeget of samples and runtime, one can be only hopefully to visit all significant states. On the other hand, since insignificant states can be rarely visited no matter what policy is used, they will not significantly change the value from the initial states. Thus, for the sake of finding near-optimal policies, it is sufficient to visit all significant states with proper significance level ϵ\epsilon. Indeed, Algorithm 2 is able to provide such a guarantee as follows.

There exists absolute constant c>0c>0 such that for any ϵ>0\epsilon>0 and p∈(0,1)p\in(0,1), if we set N0≥cS2AH4ι03/δN_{0}\geq cS^{2}AH^{4}\iota_{0}^{3}/\delta where ι0:=log⁡(SAH/(pδ))\iota_{0}\mathrel{\mathop{:}}=\log(SAH/(p\delta)), then with probability at least 1−p1-p, that Algorithm 2 will returns a dataset D\mathcal{D} consisting of NN trajectories {zn}n=1N\{z_{n}\}_{n=1}^{N}, which are i.i.d sampled from a distribution μ\mu satisfying:

Theorem 3.3 claims that using Algorithm 2, we can collect data from a underlying distribution μ\mu, which ensures that for policy π\pi, the ratio Phπ(s,a)/μh(s,a)P_{h}^{\pi}(s,a)/\mu_{h}(s,a) will be upper bounded for any significant state and action. That is, all significant state and action will be visited by distribution μ\mu with reasonable amount of probability. Notice as δ\delta becomes smaller, there will be more significant states and the condition (4) becomes stronger. As a result we need to take larger N0N_{0}. As we will see later, the δ\delta we take eventually will be ϵ/(2SH2)\epsilon/\left(2SH^{2}\right), where ϵ\epsilon is the suboptimality of the policy we find in the planning phase.

Algorithm 2 can be decompose into two parts, where Line 3-7 learns a set of exploration policies Ψ\Psi and Line 8-11 simply collects data by uniformly executing policies in Ψ\Psi. Therefore, the key mechanism lies in how to learn the set of exploration policies Ψ\Psi. Our strategy is to first learn the best policies that maximize the probability to research each state ss at step hh individually, and then combine them.

There exists absolute constant c>0c>0 such that for any N0>0N_{0}>0 and p∈(0,1)p\in(0,1), with probability at least 1−p1-p, if we run Euler algorithm for N0N_{0} episodes, it will output a policy set Φ\Phi with ∣Φ∣=N0|\Phi|=N_{0} that satisfies:

where ι0=log⁡(SAHN0/p)\iota_{0}=\log\left(SAHN_{0}/p\right).

2 Planning Phase

There exists absolute constant c>0c>0, for any ϵ>0\epsilon>0, p∈(0,1)p\in(0,1), assume dataset D\mathcal{D} has NN i.i.d. samples from distribution μ\mu which satisfies Eq.(4) with δ=ϵ/(2SH2)\delta=\epsilon/\left(2SH^{2}\right), and N≥cH5S2Aι/ϵ2N\geq cH^{5}S^{2}A\iota/\epsilon^{2}, then with probability at least 1−p1-p, for any reward function rr simultanouesly, the output policy π^\hat{\pi} of Algorithm 3 is 3ϵ3\epsilon-suboptimal. That is:

Under the preconditions of Theorem 3.5, with probability at least 1−p1-p, for any reward function rr and any policy π\pi, we have:

where evaluation errors are bounded by ϵ\epsilon by Lemma 3.6 and optimization error is bounded by ϵ\epsilon by assumption. ∎

3 Approximate MDP Solvers

Another popular approach frequently used in practice is the Natural Policy Gradient (NPG) algorithm as shown in Algorithm 4. In each iteration, the algorithm first evaluates the value of policy π(t)\pi^{(t)} using Bellman equation Eq.(1). Then it updates the policy by first scale it with the exponential of learning η\eta times value Qπ(t)Q^{\pi^{(t)}}, and then performs a normalization. For completeness, we provides its guarantee here. Similar analysis also appears in Agarwal et al. (2019).

for any learning rate η\eta and iteration number TT, the output policy π(T)\pi^{(T)} of Algorithm 4 satisfies the following:

Therefore, it is easy to verify, by choosing η=log⁡A/HT\eta=\sqrt{\log A/HT} and T=4H3log⁡A/ϵ2T=4H^{3}\log A/\epsilon^{2}, the policy π(T)\pi^{(T)} returned by NPG is ϵ\epsilon-optimal.

Lower Bound

In this section, we establish that Ω(H2S2A/ϵ2)\Omega(H^{2}S^{2}A/\epsilon^{2}) trajectories are necessary to satisfy the guarantee from Theorem 3.1.

Let C>0C>0 be a universal constant. Then for A≥2A\geq 2, S≥Clog⁡2AS\geq C\log_{2}A, H≥Clog⁡2SH\geq C\log_{2}S, and any ϵ≤min⁡{1/4,H/48}\epsilon\leq\min\{1/4,H/48\}, any reward-free exploration algorithm Alg\mathsf{Alg} which statisfies the guarantee of Theorem 3.1 with p=1/2p=1/2 and accuracy parameter ϵ\epsilon must collect Ω(S2AH2/ϵ2)\Omega(S^{2}AH^{2}/\epsilon^{2}) trajectories in expectation. This is true even if Alg\mathsf{Alg} can return randomized or history-dependent (non-Markov) policies, and holds even if the rewards and transitions are identical across stages hh.

In particular, Theorem 4.1 shows that our upper bound (Theorem 3.1) is tight in S,A,ϵS,A,\epsilon, up to logarithmic factors and lower-order terms. Note that lower bound holds against querying an unlimited number of reward vectors. It is left as an open question whether such a lower bound holds when the algorithm is only required to ensure correctness over a smaller number of reward vectors pre-determined in advance. In what follows, we sketch a proof of Theorem 4.1; a formal proof is given in Appendix D.

The learner is then tasked with learning near optimal policies for reward vectors rνr_{\nu} parametrized by ν∈2n\nu\in^{2n}, which assigns a state-dependent but action-independent reward ν(s)\nu(s) to states s∈[2n]s\in[2n], and no reward to x1=0x_{1}=0. The blue (“left”) transitions or red (“right”) transition in Figure 2 mirror this construction, which we formalize in Definition D.1. We show that reward-free exploration essentially forces the learner to learn the probability vectors q(⋅,a)q(\cdot,a) in total-variation distance for each a∈[A]a\in[A], yielding an Ω(nA/ϵ2)\Omega(nA/\epsilon^{2}) lower bound for this construction. A formal statement is of the following Lemma is given in Lemma D.2 in the appendix.

Suppose S≥Clog⁡2(A)S\geq C\log_{2}(A) for a universal constant C>0C>0. Suppose Alg\mathsf{Alg}, when faced with the instances described above (with qq satisfying Eq. (6)) successfully returns ϵ\epsilon-suboptimal policies for exponentially many reward vectors with total failure probability 1/21/2. Then Alg\mathsf{Alg} requires Ω(SA/ϵ2)\Omega(SA/\epsilon^{2}) trajectories in expectation.

Unfortunately, we cannot show a direct reduction from estimating qq in total variation to learning near optimal-policies. Instead, by selecting appropriate reward vectors rνr_{\nu}, the algorithm can decode a packing of exp⁡(Ω(n))\exp(\Omega(n)) transition vectors q(⋅,a)q(\cdot,a) for each action a∈[A]a\in[A]. By a variant of Fano’s inequality, this leads to the same Ω(nA/ϵ2)\Omega(nA/\epsilon^{2}) lower bound that would be obtained by a direct reduction. ∎

Lemma 4.2 differs from existing Ω(SA/ϵ2)\Omega(SA/\epsilon^{2}) lower bounds in that the only quantities unknown to the learner are the transition probabilities associated with the single state . This is in contrast to most existing lower bounds where the learner needs to collect transition information at multiple states. In particular, here the factor of SS arises because the transition is to Θ(S)\Theta(S) states, while in most constructions this factor arises because transitions from Θ(S)\Theta(S) states must be estimated.

2 Lower Bound for Multiple States

The only part unknown to the learner are the transition vectors {qx}x∈[n]\{q_{x}\}_{x\in[n]}, where qx(s,a)q_{x}(s,a) describes the probability of transitioning to leaf (s,1+log⁡2n)(s,1+\log_{2}n) when taking action aa from state (x,log⁡2n)(x,\log_{2}n). We now index rewards by (x,ν)∈[n]×2n(x,\nu)\in[n]\times^{2n}, where rx,νr_{x,\nu} places action-independent reward 11 on state (x,log⁡2n)(x,\log_{2}n), action-independent reward ν(s)\nu(s) on states (s,1+log⁡2n)(s,1+\log_{2}n), and reward everywhere.

Assume that the transitions qxq_{x} satisfy the near-uniformity condition of (6) for ϵ=1/4H\epsilon=1/4H. Then, for reward rx,νr_{x,\nu}, the high reward of 11 at (x,log⁡2n)(x,\log_{2}n) forces any near-optimal policy to visit (x,log⁡2n)(x,\log_{2}n) and subsequently play near optimal actions at this state. However, playing optimally at (x,log⁡2n)(x,\log_{2}n) under reward rx,νr_{x,\nu} for all ν\nu is equivalent to reward-free learning of a single instance of the construction from Lemma 4.2. By varying x∈[n]x\in[n] for the reward vectors rx,νr_{x,\nu}, the learner is forced to learn nn such instances, yielding the Ω(n⋅nA/ϵ2)=Ω(S2A/ϵ2)\Omega(n\cdot nA/\epsilon^{2})=\Omega(S^{2}A/\epsilon^{2}) lower bound. This can be improved to Ω(H2S2A/ϵ2)\Omega(H^{2}S^{2}A/\epsilon^{2}) by using the absorbing states to create a chain of Ω(H)\Omega(H) rewards.

Conclusion

In this paper, we propose a new “reward-free RL” framework, comprising of two phases. In the exploration phase, the learner first collects trajectories from an MDP M\mathcal{M} without receiving any reward information. After the exploration phase, the learner is no longer allowed to interact with the MDP and she is instead tasked with computing near-optimal policies under for M\mathcal{M} for a collection of given reward functions. This framework is particularly suitable when there are many reward functions of interest, or when we are interested in learning the transition operator directly.

Another interesting direction is to design reward-free RL algorithms for settings with function approximation. We believe our work highlights and introduces some mechanisms that may be useful in the function approximation setting, such as the concept of significant states (Definition 3.2) and the coverage guarantee (4). How do we generalize these concepts to the function approximation setting?

We hope to pursue these directions in future work.

References

Appendix A The ZeroRMax algorithm

RMax is a well-known PAC exploration algorithm Brafman and Tennenholtz . Here, we show that a modified version of RMax, which we call ZeroRMax, addresses the reward-free exploration setting. The difference between ZeroRMax and RMax is that we set the reward in “known” states to instead of the true reward, which explains the name. We briefly describe the algorithm and derive the PAC bound relying heavily on prior arguments. Details about RMax and its analysis can be found in prior work Brafman and Tennenholtz , Kakade .

Following the reward-free exploration framework proposed in Section 2, the ZeroRMax algorithm first collects samples without knowledge about reward (exploration) and then computes a policy for each configuration of reward function (planning). We define set of known states K\mathcal{K} to be

where Nh(s,a)N_{h}\left(s,a\right) counts how many times ss has been visited and aa was taken in the hh-th step and mm is a parameter to be specified later. The set K\mathcal{K} contains states that we have visited enough times to estimate the corresponding transition kernel, and is typically referred to as the “known set” in the literature. For (s,h)(s,h) not in K\mathcal{K}, we call them “unknown.”

Now ZeroRMax explores as follows. In each episode i∈[N]i\in[N], the agent has a known set Ki\mathcal{K}_{i} and

builds an empirical MDP M^i,Ki\hat{\mathcal{M}}_{i,\mathcal{K}_{i}} with parameters

computes πi=πM^i,Ki⋆\pi_{i}=\pi_{\hat{\mathcal{M}}_{i,\mathcal{K}_{i}}}^{\star} on M^i,Ki\hat{\mathcal{M}}_{i,\mathcal{K}_{i}} by value iteration.

samples a trajectory from the environment following πi\pi_{i}.

constructs Ki+1\mathcal{K}_{i+1} for the next episode

For the planning phase, we first sample an index i∈[N]i\in[N] uniformly and construct the MDP M^i,Ki\hat{\mathcal{M}}_{i,\mathcal{K}_{i}}. Then given reward function, we can just perform value iteration on M^i,Ki\hat{\mathcal{M}}_{i,\mathcal{K}_{i}}, which gives us a near optimal policy.

A central concept for analyzing the sample complexity of ZeroRMax is the escape probability, which is the probability of visiting the unknown states. Formally,

The above definition also depends on the corresponding MDP M\mathcal{M}. Since we only care about the escape probability w.r.t the true MDP M\mathcal{M}, we will omit this dependence. The key observation is that there cannot be too many episodes where the escape probability is large. The inuition is that, if the escape probability is big, then the agent will soon visit an unknown states. However, the agent can visit unknown states at most mSAmSA times in total.

Let πi\pi_{i} be the policy followed in the ithi^{\textrm{th}}episode and Ki\mathcal{K}_{i} be corresponding set of known states. Then with probability 1−p1-p, there can be at most O(mSAεlog⁡SANHp)\mathcal{O}\left(\frac{mSA}{\varepsilon}\log\frac{SANH}{p}\right) episodes where pKiπi>εp_{\mathcal{K}_{i}}^{\pi_{i}}>\varepsilon.

As a result, we have the following corollary.

If we sample ii uniformly from 11 to KK, then with probability 1−p−O(mSAεNlog⁡SANHp)1-p-\mathcal{O}\left(\frac{mSA}{\varepsilon N}\log\frac{SANH}{p}\right), we have pKiπi≤εp_{\mathcal{K}_{i}}^{\pi_{i}}\leq\varepsilon.

In what follows, we focus on a single “good” episode ii where pKiπi≤εp_{\mathcal{K}_{i}}^{\pi_{i}}\leq\varepsilon. Since we focus on a single episode, let us denote Ki\mathcal{K}_{i} by K\mathcal{K} and πi\pi_{i} by πM^K⋆\pi_{\hat{\mathcal{M}}_{\mathcal{K}}}^{\star}. There are three MDPs of interest, with important details presented in Table 1.

M\mathcal{M} is the true MDP of interest, that we will use to measure the performance of the policy we find in the planning phase. M^K\hat{\mathcal{M}}_{\mathcal{K}} is the MDP we use for computing policies in both exploration and planning phases. The final MDP, MK\mathcal{M}_{\mathcal{K}} is an intermediate MDP which agrees with M\mathcal{M} on the known set but follows self-loops in the unknown states. Our plan is to prove with high probability, the value of any policyπ\pi on M\mathcal{M} and M^K\hat{\mathcal{M}}_{\mathcal{K}} are close, which implies the desired sample complexity result using the same argument as in Theorem 3.5.

The first step is to prove that for any policy π\pi, the values on MK\mathcal{M}_{\mathcal{K}} and M^K\hat{\mathcal{M}}_{\mathcal{K}} are similar.

With probability 1−p1-p, for any policy π\pi and reward function rr,

We apply Lemma C.1 to MK\mathcal{M}_{\mathcal{K}} and M^K\hat{\mathcal{M}}_{\mathcal{K}}, since the reward function is the same and the transition kernel is the same for unknown states,

The second step is to prove that for any policy π\pi, the values on MK\mathcal{M}_{\mathcal{K}} and M\mathcal{M} are similar, which is less straightforward.

With probability 1−p1-p and ii is a ”good” episode, for any policy π\pi,

Notice that for any policy π\pi, if we can upper bound the escape probability, then MK\mathcal{M}_{\mathcal{K}} and M\mathcal{M} must be similar for this policy. Fortunately, this is actually the case, due to our setting of the reward function in the exploration phase, following (7). Then by definition for any ss,

However, since we are considering a good episode, we know that for the optimal policy on M^K\hat{\mathcal{M}}_{\mathcal{K}}, πM^K∗\pi_{\hat{\mathcal{M}}_{\mathcal{K}}}^{*}, we have pKπM^K∗≤εp_{\mathcal{K}}^{\pi_{\hat{\mathcal{M}}_{\mathcal{K}}}^{*}}\leq\varepsilon. Therefore,

Now notice MK\mathcal{M}_{\mathcal{K}} and M\mathcal{M} are only different on unknown states, which will not influence the agent unless the agent escapes from K\mathcal{K}. Using Lemma C.1 on MK\mathcal{M}_{\mathcal{K}} and M\mathcal{M} we have

Finally we can put everything together. Again following the argument in Theorem 3.5, we have

With probability 1−2p−O(mSAεKlog⁡SANHp)1-2p-\mathcal{O}\left(\frac{mSA}{\varepsilon K}\log\frac{SANH}{p}\right), given any reward function, the ZeroRMax algorithm can output a policy π\pi such that

This sample complexity is quite poor because it scales with ϵ−3\epsilon^{-3} and polynomially, rather than logarithmically, with 1/p1/p.

Appendix B MaxEnt Exploration

At this point we can see that if α≥1/S\alpha\geq 1/S then this expression is negative, so the mixture policy with large α\alpha does not yield any improvement in objective. On the other hand, for any α<1/S\alpha<1/S then this inner expression is Θ(S)\Theta(S). So if we set α=Θ(1/S)\alpha=\Theta(1/S) the overall improvement in objective is Ω(1/S)\Omega(1/S). This means that if we want establish the guarantee in Theorem 3.3, we must set ε=1/S\varepsilon=1/S, at which point the overall sample complexity scales with S5S^{5}, which is quite poor.

Note that this calculation shows that O(S5)O(S^{5}) samples is sufficient for the maximum entropy approach to find a suitable exploratory policy, but we do not claim that it is necessary for this method. A sharper analysis may be possible, but we are not aware of any such results.

Appendix C Proof for Main Results

In this section, we present proofs for results in Section 3.

We begin with the proof of Lemma 3.4, which is a simple modification of the Theorem 1 in Zanette and Brunskill .

We use an alternative upper-bound for equation (156) in Zanette and Brunskill , which gives:

where πk\pi_{k} is the policy used in Euler in the kk-th episode. Step (i) is because using the reward function designed in Line 4 in Algorithm 2, we have all reward equal to zero except one state. Therefore, we have ∑h=1Hr(sh,ah)≤1\sum_{h=1}^{H}r(s_{h},a_{h})\leq 1 and V1π(s1)≤1V_{1}^{\pi}(s_{1})\leq 1. Therefore, we have replace the upper bound G2\mathcal{G}^{2} in (156) of Zanette and Brunskill by 4V1⋆(s1)4V_{1}^{\star}(s_{1}).

This allows us also replace the G2\mathcal{G}^{2} in Theorem 1 of Zanette and Brunskill by 4V1⋆(s1)4V_{1}^{\star}(s_{1}), which gives the regret of algorithm (note Zanette and Brunskill is for stationary MDP, while our paper is for non-stationary MDP, thus SS in Zanette and Brunskill need to be replaced by SHSH in our paper due to state augmentation, which creates new states as (s,h)(s,h)):

Finally, plug in T=N0HT=N_{0}H, we finish the proof. ∎

Now we can prove the main result in this section.

In the following we can fix a state (s,h)(s,h) and consider the corresponding policy given by Euler. Remember in our setting (Line 4 in Algorithm 2),

Therefore the regret guarantee Lemma 3.4 implies

for some absolute constant c0c_{0}. Therefore, in order to make the following true

We simply need to choose N0N_{0} large enough so that:

for a sufficient small absolute constant c1c_{1}. Combining with the fact that for \text{~{}\delta-significant~{}}(s,h), max⁡πPhπ(s)≥δ\max_{\pi}P_{h}^{\pi}(s)\geq\delta, we know choosing N0=O(S2AH4ι03/δ)N_{0}=\mathcal{O}(S^{2}AH^{4}\iota_{0}^{3}/\delta) is sufficient. As a result, we have

Since Algorithm 2 sets all policy in Φ(s,h)\Phi^{(s,h)} to choose action uniformly randomly at (s,h)(s,h), this implies

Finally, we can apply the same argument for all δ\delta-significant (s,h)(s,h), and let Ψ=∪{Φ(s,h)}(s,h)\Psi=\cup\{\Phi^{(s,h)}\}_{(s,h)} which gives:

C.2 Planning Phase

The following lemma (E.15 in Dann et al. ) will be useful to characterize the difference between Vhπ(s;r)V_{h}^{\pi}(s;r) and V^hπ(s;r)\hat{V}_{h}^{\pi}(s;r) .

With this decomposition in mind, we can prove Lemma 3.6.

Let Shδ:={s:max⁡πPhπ(s)≥δ}\mathcal{S}_{h}^{\delta}:=\{s:\underset{\pi}{\max}P_{h}^{\pi}(s)\geq\delta\} be the set of δ\delta-significant states in the hh-th step. We further have:

By definition of insignificant state, we have:

On the other hand, by Cauchy-Shwartz inequality, we have:

We note since V^h+1π\hat{V}_{h+1}^{\pi} only depends on π\pi at h+1,⋯ ,Hh+1,\cdots,H steps, it does not depends on πh\pi_{h}. Therefore, we have:

where the last step is because the maximization over πh′\pi^{\prime}_{h} achieves at deterministic polices.

Recall that by preconditions, we have 4 holds for δ=ϵ/(2SH2)\delta=\epsilon/(2SH^{2}). That is, for any s∈Shδs\in\mathcal{S}_{h}^{\delta} we always have

Therefore, for any (s,a)(s,a) pair, we can design a policy π′\pi^{\prime} so that πh′′=πh′\pi^{\prime}_{h^{\prime}}=\pi_{h^{\prime}} for all h′<hh^{\prime}<h, and πh′(s)=a\pi^{\prime}_{h}(s)=a. This will give that

Therefore, combine all equations above, we have

Recall our choice δ=ϵ/(2SH2)\delta=\epsilon/(2SH^{2}) and N≥cH5S2Aϵ2log⁡(SAHpϵ)N\geq c\frac{H^{5}S^{2}A}{\epsilon^{2}}\log(\frac{SAH}{p\epsilon}) for sufficiently large absolute constant cc, which finishes the proof. ∎

To simplify the notation, when some property of YiY_{i} holds for any ii, we just use the notation YY to describe a generic YiY_{i}.

We first state some properties of the random variables YiY_{i}, which are justified at the end of the proof.

(Empirical risk minimization) ∑i=1NYi≤0\sum_{i=1}^{N}{Y_{i}}\leq 0

We can simply choose ε=HS/36N\varepsilon=HS/36N and thus

Taking union bound w.r.t. hh, the claim holds for any hh with probability 1−p1-p.

Finally we give the proofs for the claimed three properties of YiY_{i}. We begin with the expectation property:

The emipirical risk minimization property is true because the evaluation rule is essentially minimizing the empirical Bellman error for each (s,a)(s,a) pair separately. Mathematically,

C.3 Proof of Theorem 3.1

Putting everything together we can prove the main theorem.

We only need to choose the parameter δ\delta and N0N_{0}. From the proof of Lemma 3.6 we can see, we need δ=ϵ/(2SH2)\delta=\epsilon/(2SH^{2}) and thus N0≥cS3AH6ι3/ϵN_{0}\geq cS^{3}AH^{6}\iota^{3}/\epsilon. Since we need N0N_{0} episodes for each (s,h)(s,h), the total number episodes required for finding Ψ\Psi is O(cS4AH7ι3/ϵ)\mathcal{O}(cS^{4}AH^{7}\iota^{3}/\epsilon), which gives the second term in (3). The proof is completed by combining Theorem 3.5, which gives the first term in (3). ∎

C.4 Approximate MDP Solvers

The convergence of NPG is well studied in Agarwal et al. (tabluar & infinite horizon) and Cai et al. (linear approximation). However, the episodic setting has some unique characters (For example, we not every state can be arrive at the first step and the corresponding analysis in Agarwal et al. does not apply). Therefore the guarantee given in Proposition 3.7 is different.

Since we only need to prove the guarantee on the true MDP, we will not distinguish true MDP M\mathcal{M} and estimated MDP M^\hat{\mathcal{M}} here. Remember the NPG is defined by

where Qh(t)(s,a):=Qhπ(t)(s,a)Q_{h}^{(t)}(s,a):=Q_{h}^{\pi^{(t)}}(s,a) is computed following the value iteration procedure. Similarly we define Vh(t)(s):=Vhπ(t)(s)V_{h}^{(t)}(s):=V_{h}^{\pi^{(t)}}(s). The normalization constant can be written explicitly as

Notice the definition of the normalization constant is not unique. Here we choose the form that makes the following proof simpler but different choice will essentially gives exactly the same algorithm.

We begin with a lemma showing that the value function monotonically increases.

By performance difference lemma Kakade and Langford ,

because Vh(t)(s)=∑a∈Aπh(t)(a∣s)Qh(t)(s,a)V_{h}^{(t)}(s)=\sum_{a\in\mathcal{A}}{\pi_{h}^{(t)}(a|s)Q_{h}^{(t)}(s,a)} by definition. ∎

Equipped with the monotone property, we can simply prove an upper bound for the cumulative regret, which immediately implies the convergence rate for the last iteration.

Now we can upper bound the regret of π(T−1)\pi^{(T-1)} by upper bound the cumulative regret using Lemma C.3

Therefore we only need to bound log⁡Zh(t)(sh)\log Z_{h}^{(t)}(s_{h}), where the technique in Agarwal et al. does not apply and we use a different approach. Notice for x≤1x\leq 1, exp⁡{x}≤1+x+x2\exp\{x\}\leq 1+x+x^{2}. So as long as η≤1H\eta\leq\frac{1}{H}, η[Qh(t)(s,a)−Vh(t)(s)]≤1\eta[Q_{h}^{(t)}(s,a)-V_{h}^{(t)}(s)]\leq 1 and we have

Appendix D Proof of Lower Bound

In this section, we prove our lower bound, Theorem 4.1. First, we develop further notation in Section D.1 which will aid in distinguishing between multiple possible instances. Next, Section D.2 states Lemma D.2, the formal analogue of Lemma 4.2, which describes a lower bound for learning transitions at a single state. Then, Section D.3 embeds the construction to obtain an instance where the learner to learn transitions at nn states, yielding the lower bound Theorem 4.1. Finally, Section D.4 details the proof of the 11-state lower bound, Lemma 4.2.

For the lower bound, we allow the policies π\pi prescribed by Alg\mathsf{Alg} to be arbitrary randomized mappings form observed histories, that is, Alg\mathsf{Alg} selects a random seed ξ\xi from some distribution; that is the policy at stage hh is a map

D.2 Learning A Single Instance

In this section, we define a triple (E,R,P)(\mathscr{E},\mathscr{R},\mathscr{P}) on O(n)\mathcal{O}\left(n\right)-states which forces the learner to spend Ω(nA/ϵ2)\Omega(nA/\epsilon^{2}) trajectories to learn the transition probabilities at a given state.

Due to its level of technical, the proof of Lemma D.2 is given in Section D.4.

D.3 Learning Transitions at n𝑛n states: Proof of Theorem 4.1

Suppose that a (possibly randomized, non-Markovian) policy π\pi satisfies, for ϵ≤1/4\epsilon\leq 1/4 and ϵ0≤1/8H\epsilon_{0}\leq 1/8H,

Due to the structure of the transitions and rewards, the value of any policy π\pi is

To prove Theorem 4.1, we use the following lemma:

We directly construct the map Ψ\Psi. Observe that policies π(x)\pi^{(x)} on the single state environment can be discred by a distribution over which actions a∈[A]a\in[A] they select at the initial state xx. Thus identifying policies as elements of Δ(A)\Delta(A), we set

We now conclude with the proof of our main theorem:

Since S/8≤n≤SS/8\leq n\leq S, for the above conditions to hold, it suffices that, for a sufficiently large constant CC, S≥Clog⁡2AS\geq C\log_{2}A, ϵ≤min⁡{14,H48}\epsilon\leq\min\{\frac{1}{4},\frac{H}{48}\}, and H≥Clog⁡2SH\geq C\log_{2}S. Moreover, n2AH2ϵ2=Ω(S2AH2ϵ2)\frac{n^{2}AH^{2}}{\epsilon^{2}}=\Omega(\frac{S^{2}AH^{2}}{\epsilon^{2}}), as needed. ∎

D.4 Proof of Lemma D.2

For a cardinality parameter MM to be chosen shortly, we consider a packing of vectors

Throughout, we shall consider packings VA,M\mathcal{V}_{A,M} which are uncorrelated in the following sense:

For γ∈(0,1)\gamma\in(0,1), we say that VA,M\mathcal{V}_{A,M} is γ\gamma-uncorrelated if, for any pair (a,j),(a′,j′)(a,j),(a^{\prime},j^{\prime}) with either a≠a′a\neq a^{\prime} or j≠j′j\neq j^{\prime}, it holds that ∣⟨va,j,va′,j′⟩∣<2nγ.|\langle v_{a,j},v_{a^{\prime},j^{\prime}}\rangle|<2n\gamma..

The following lemma shows that the exist γ\gamma-uncorrelated packings of size eΩ(nγ2)e^{\Omega(n\gamma^{2})}:

Fix γ∈(0,1)\gamma\in(0,1), and suppose that 2log⁡(M)≤nγ2−log⁡(4n)−2log⁡(A)2\log(M)\leq n\gamma^{2}-\log(4n)-2\log(A). Then, there exists a γ\gamma-uncorrelated packing VA,M\mathcal{V}_{A,M}.

Given a γ\gamma-uncorrelated packing VA,M\mathcal{V}_{A,M}, define transition vectors

As a consequence, we find that if γ≤1/10\gamma\leq 1/10 and Alg\mathsf{Alg} is (ϵ/24,p)(\epsilon/24,p)-correct,

In particular, if log⁡M≥4log⁡2\log M\geq 4\log 2 and p≤1/2p\leq 1/2, then,

Take γ=1/10\gamma=1/10. For constants c0,c1c_{0},c_{1} sufficiently large, we can ensure that if n≥c0log⁡2An\geq c_{0}\log_{2}A, then M=e−n/c1M=e^{-n/c_{1}} statisfies 2log⁡(M)≤nγ2−log⁡(4n)−2log⁡(A)2\log(M)\leq n\gamma^{2}-\log(4n)-2\log(A) and log⁡M≥4log⁡2\log M\geq 4\log 2. Thus, we can construct a γ\gamma-uncorrelated packing of cardinality log⁡M≥n/c1\log M\geq n/c_{1},

D.4.1 Proof of Lemma D.6

We begin with the following concentration inequality:

For any fixed (a,j)(a,j) and (a′,j′)(a^{\prime},j^{\prime}), we have

By permuting coordinates, we may assume that

where we set Z=∣{s∈[n]:va,j[s]=1}∣Z=|\{s\in[n]:v_{a,j}[s]=1\}|. Hence, if ∣⟨va,j,va′,j′⟩∣≥2γn|\langle v_{a,j},v_{a^{\prime},j^{\prime}}\rangle|\geq 2\gamma n, we need

We now finish the proof of our intended lemma:

By a union bound over at most A2M2−1A^{2}M^{2}-1 pairs (a,j),(a′,j′)(a,j),(a^{\prime},j^{\prime}), there exists a γ\gamma-uncorrelated packing for any MM satisfying

Taking logarithms, we require 2log⁡(M)≤nγ2−log⁡(4n)−2log⁡(A)2\log(M)\leq n\gamma^{2}-\log(4n)-2\log(A).

D.4.2 Proof of Lemma D.7

To begin, let us state a variant of Fano’s inequality, which replaces mutual-information with an arbitrary comparison measure:

This follows from the standard statement of Fano’s inequality, where we use that

For reference, see e.g. Equation (11) in Chen et al. . ∎

where (i)(i) uses 1+ϵvj,a[s]≥01+\epsilon v_{j,a}[s]\geq 0 and the identity log⁡(1+x)≤x\log(1+x)\leq x, and (ii)(ii) uses the fact that vj,a[s]2=1v_{j,a}[s]^{2}=1 and ∑s=12nvj,a[s]=0\sum_{s=1}^{2n}v_{j,a}[s]=0 for vj,a∈Kv_{j,a}\in\mathcal{K}. Thus, by Eq 11,

By taking an expectation over index tuples JJ drawn uniformly from [A]M[A]^{M}, we have

D.4.3 Proof of Lemma D.8

which can be checked to lie 2n^{2n}. We shall establish the following lemma, which says that for sufficciently uncorrelated packings, the vectors ν(… )\nu_{(\dots)} witness separations between qa1,j1q_{a_{1},j_{1}} and qa2,j2q_{a_{2},j_{2}} for different actions a1,a2a_{1},a_{2}:

Fix a1∈[A]a_{1}\in[A] and j1∈[M]j_{1}\in[M], and suppose the packing is γ=1/10\gamma=1/10-uncorrelated: Then, for any a2≠a1a_{2}\neq a_{1} and j2∈[M]j_{2}\in[M], the following holds

where we use the fact that va,j⊤1=1v_{a,j}^{\top}\mathbf{1}=1 for all a,ja,j. If a1′=a1a^{\prime}_{1}=a_{1} and j1′=j1j_{1}^{\prime}=j_{1}, and the packing is γ≤1/6\gamma\leq 1/6-uncorrelated

On the other hand, if j1≠j1′j_{1}\neq j_{1}^{\prime}, but (a2,j2)=(a2′,j2′)(a_{2},j_{2})=(a_{2}^{\prime},j_{2}^{\prime}) then a similar computation reveals that for γ≤1/10\gamma\leq 1/10,

We can now conclude the proof of our reduction:

We conclude our proof by showing that, on the good event Eq. (12), the condition in Eq. (13) holds if and only if j=Jaj=J_{a}. To this end, define the short hand

so that on the good event of Eq. 12, we have