Title: EFFICIENT EXPLORATION VIA STATE MARGINAL MATCHING

Abstract: Reinforcement learning agents need to explore their unknown environments to solve the tasks given to them. The Bayes optimal solution to exploration is intractable for complex environments, and while several exploration methods have been proposed as approximations, it remains unclear what underlying objective is being optimized by existing exploration methods, or how they can be altered to incorporate prior knowledge about the task. Moreover, it is unclear how to acquire a single exploration strategy that will be useful for solving multiple downstream tasks. We address these shortcomings by learning a single exploration policy that can quickly solve a suite of downstream tasks in a multi-task setting, amortizing the cost of learning to explore. We recast exploration as a problem of State Marginal Matching (SMM), where we aim to learn a policy for which the state marginal distribution matches a given target state distribution, which can incorporate prior knowledge about the task. We optimize the objective by reducing it to a two-player, zero-sum game between a state density model and a parametric policy. Our theoretical analysis of this approach suggests that prior exploration methods do not learn a policy that does distribution matching, but acquire a replay buffer that performs distribution matching, an observation that potentially explains prior methods' success in single-task settings. On both simulated and real-world tasks, we demonstrate that our algorithm explores faster and adapts more quickly than prior methods. 1

1. INTRODUCTION:

Reinforcement learning (RL) algorithms must be equipped with exploration mechanisms to effectively solve tasks with limited reward signals. These tasks arise in many real-world applications where providing human supervision is expensive. The inability of current RL algorithms to adequately explore limits their applicability to long-horizon control tasks.

A wealth of prior work has studied exploration for RL. While, in theory, the Bayes-optimal exploration strategy is optimal, it is intractable to compute exactly, motivating work on tractable heuristics for exploration. Exploration methods based on random actions have limited ability to cover a wide range of states. More sophisticated techniques, such as intrinsic motivation, accelerate learning in the single-task setting. However, these methods have two limitations. First, they do not explicitly define an objective to quantify "good exploration," but rather argue that exploration arises implicitly through some iterative procedure. Lacking a well-defined optimization objective, it remains challenging to understand what these methods are doing and why they work. Similarly, the lack of a metric to quantify exploration, even if only for evaluation, makes it challenging to compare exploration methods and assess progress in this area. The second limitation is that these methods target the single-task setting. Because these methods aim to converge to the optimal policy for a particular task, it is challenging to repurpose these methods to solve multiple tasks.

We address these shortcomings by considering a multi-task setting, where many different reward functions can be provided for the same set of states and dynamics. Rather than exploring from scratch for each task, we aim to learn a single, task-agnostic exploration policy that can be adapted to many possible downstream reward functions, amortizing the cost of learning to explore. This exploration policy can be viewed as a prior on the policy for solving downstream tasks. Learning will consist of two phases: during training, we acquire this task-agnostic exploration policy; during testing, we use this exploration policy to quickly explore and maximize the task reward.

Learning a single exploration policy is considerably more difficult than doing exploration throughout the course of learning a single task. The latter is done by intrinsic motivation (Pathak et al., 2017; Tang et al., 2017; Oudeyer et al., 2007) and count-based exploration methods (Bellemare et al., 2016) , which can effectively explore to find states with high reward, at which point the agent can decrease exploration and increase exploitation of those high-reward states. While these methods perform efficient exploration for learning a single task, the policy at any particular iteration is not a good exploration policy. For example, the final policy at convergence would only visit the high-reward states discovered for the current task.

What objective should be optimized to obtain a good exploration policy? We recast exploration as a problem of State Marginal Matching: given a desired state distribution, we learn a mixture of policies for which the state marginal distribution matches this desired distribution. Without any prior information, this objective reduces to maximizing the marginal state entropy H[s], which encourages the policy to visit as many states as possible. The distribution matching objective also provides a convenient mechanism to incorporate prior knowledge about the task, whether in the form of safety constraints that the agent should obey; preferences for some states over other states; reward shaping; or the relative importance of each state dimension for a particular task.

We also propose an algorithm to optimize the State Marginal Matching (SMM) objective. First, we reduce the problem of SMM to a two-player, zero-sum game between a policy player and a density player. We find a Nash Equilibrium for this game using fictitious play (Brown, 1951) , a classic procedure from game theory. Our resulting algorithm iteratively fits a state density model and then updates the policy to visit states with low density under this model. Our analysis of this approach sheds light on prior work on exploration. In particular, while the policy learned by existing exploration algorithms does not perform distribution matching, the replay buffer does, an observation that potentially explains the success of prior methods. On both simulated and real-world tasks, we demonstrate that our algorithm explores more effectively and adapts more quickly to new tasks than state-of-the-art baselines.

2. RELATED WORK:

Most prior work on exploration has looked at exploration bonuses and intrinsic motivation. One class of exploration methods uses prediction error of some auxiliary task as an exploration bonus, which provides high (intrinsic) reward in states where the predictive model performs poorly (Pathak et al., 2017; Oudeyer et al., 2007; Schmidhuber, 1991; Houthooft et al., 2016; Burda et al., 2018) . Another set of approaches (Tang et al., 2017; Bellemare et al., 2016; Schmidhuber, 2010) directly encourage the agent to visit novel states. While all methods effectively explore during the course of solving a single task (Taïga et al., 2019) , the policy obtained at convergence is often not a good exploration policy (see Section 4). In contrast, our method converges to a highly-exploratory policy by maximizing state entropy in the training objective (Eq. 2).

Many exploration algorithms can be classified by whether they explore in the space of actions, policy parameters, goals, or states. Common exploration strategies including -greedy and Ornstein-Uhlenbeck noise (Lillicrap et al., 2015) , as well as standard MaxEnt RL algorithms (Ziebart, 2010; Haarnoja et al., 2018) , explore in the action space. Recent work (Fortunato et al., 2017; Plappert et al., 2017) shows that adding noise to the parameters of the policy can result in good exploration. Most closely related to our work are methods that perform exploration in the space of states or goals (Colas et al., 2018; Held et al., 2017; Nair et al., 2018; Pong et al., 2019; Hazan et al., 2018) . In fact, Hazan et al. (2018) consider the same State Marginal Matching objective that we examine and propose a similar algorithm. In relation to Hazan et al. (2018) , our main contributions are (1) empirically showing that exploration based on state-entropy is competitive with existing state-of-the-art exploration methods, and (2) explaining how existing exploration methods based on prediction error are implicitly maximizing this state-entropy objective. In Appendix C.1, we also discuss how goal-conditioned RL (Kaelbling, 1993; Schaul et al., 2015) can be viewed as a special case of State Marginal Matching when the goal-sampling distribution is learned jointly with the policy.

The problems of exploration and meta-reinforcement learning are tightly coupled. Meta-reinforcement learning algorithms (Duan et al., 2016; Finn et al., 2017; Rakelly et al., 2019; Mishra et al., 2017) must perform effective exploration if they hope to solve a downstream task. Some prior work has explicitly looked at the problem of learning to explore (Gupta et al., 2018; Xu et al., 2018) . Our problem statement is similar to meta-learning, in that we also aim to learn a policy as a prior for solving downstream tasks. However, whereas meta-RL requires a distribution of task reward functions, our method will require only a single target state marginal distribution. Due to the simpler problem assumptions and training procedure, our method may be easier to apply in real-world domains.

Related to our approach are standard maximum action entropy algorithms (Haarnoja et al., 2018; Kappen et al., 2012; Rawlik et al., 2013; Ziebart et al., 2008; Theodorou & Todorov, 2012) . While these algorithms are referred to as MaxEnt RL, they are maximizing entropy over actions, not states. These algorithms can be viewed as performing inference on a graphical model where the likelihood of a trajectory is given by its exponentiated reward (Toussaint & Storkey, 2006; Levine, 2018; Abdolmaleki et al., 2018) . While distributions over trajectories induce distributions over states, computing the exact relationship requires integrating over all possible trajectories, an intractable problem for most MDPs. A related but distinct class of relative entropy methods use a similar entropy-based objective to limit the size of policy updates (Peters et al., 2010; Schulman et al., 2015) .

Finally, the idea of distribution matching has been employed successfully in imitation learning (Ziebart et al., 2008; Ho & Ermon, 2016; Finn et al., 2016; Fu et al., 2017) . Similar to some inverse RL algorithms (Ho & Ermon, 2016; Fu et al., 2018) , our method iterates between learning a policy and learning a reward function, though our reward function is obtained via a density model instead of a discriminator. While inverse RL algorithms assume access to expert trajectories, we instead assume access to the density of the target state marginal distribution. In many realistic settings, such as robotic control with many degrees of freedom, providing fully-specified trajectories may be much more challenging than defining a target state marginal distribution. The latter only requires some aggregate statistics about expert behavior, and does not even need to be realizable by any policy.

In summary, our work unifies prior exploration methods as performing approximate distribution matching, and explains how state distribution matching can be performed properly. This perspective provides a clearer picture of exploration, and this observation is useful particularly because many of the underlying ingredients, such as adversarial games and density estimation, have seen recent progress and therefore might be adopted to improve exploration methods.

3. STATE MARGINAL MATCHING:

In this section, we propose the State Marginal Matching problem as a principled objective for learning to explore, and offer an algorithm for optimizing it. We consider a parametric policy π θ ∈ Π {π θ | θ ∈ Θ} that chooses actions a ∈ A in a Markov Decision Process (MDP) M with fixed episode lengths T , dynamics distribution p(s t+1 | s t , a t ), and initial state distribution p 0 (s). The MDP M together with the policy π θ form an implicit generative model over states. We define the state marginal distribution ρ π (s) as the probability that the policy visits state s:

ρ π (s) E s1∼p0(S), at∼π θ (A|st) st+1∼p(S|st,at) 1 T T t=1 1(s t = s)

We emphasize that ρ π (s) is not a distribution over trajectories, and is not the stationary distribution of the policy after infinitely many steps, but rather the distribution over states visited in a finite-length episode. 2 We also note that any trajectory distribution matching problem can be reduced to a state marginal matching problem by augmenting the current state to include all previous states.

We assume that we are given a target distribution p * (s) over states s ∈ S that encodes our belief about the tasks we may be given at test-time. For example, a roboticist might assign small values of p * (s) to states that are dangerous, regardless of the desired task. Alternatively, we might also learn p * (s) from data about human preferences (Christiano et al., 2017) . For goal-reaching tasks, we can analytically derive the optimal target distribution (Appendix C). Given p * (s), our goal is to find a parametric policy that is "closest" to this target distribution, where we measure discrepancy using the Kullback-Leibler (KL) divergence:

max π∈Π F(ρ π (s), p * (s)) max π∈Π -D KL (ρ π (s) p * (s)) = max π∈Π E s∼ρπ(s) [log p * (s) -log ρ π (s)]

(1)

EQUATION

This is the same objective as in Hazan et al. (2018) . Note that we use the reverse-KL (Bishop, 2006) , which is mode-seeking (i.e., exploratory). We show in Appendix C that the policies obtained via State Marginal Matching provide an optimal exploration strategy for a particular distribution over reward functions. To gain intuition for the State Marginal Matching objective, we decomposed it in two ways. In Equation 2, we see that State Marginal Matching is equivalent to maximizing the reward function r(s) log p * (s) while simultaneously maximizing the entropy of states. Note that, unlike traditional MaxEnt RL algorithms (Ziebart et al., 2008; Haarnoja et al., 2018) , we regularize the entropy of the state distribution, not the conditional distribution of actions given states, which results in exploration in the space of states rather than in actions. Moreover, Equation 1 suggests that State Marginal Matching maximizes a pseudo-reward r(s) log p * (s) -log ρ π (s), which assigns positive utility to states that the agent visits too infrequently and negative utility to states visited too frequently (see Figure 1 ). We emphasize that maximizing this pseudo-reward is not a RL problem because the pseudo-reward depends on the policy.

3.1. OPTIMIZING THE STATE MARGINAL MATCHING OBJECTIVE:

Optimizing Equation 1 to obtain a single exploration policy is more challenging than standard RL because the reward function itself depends on the policy. To break this cyclic dependency, we introduce a parametric state density model q ψ (s) ∈ Q {q ψ | ψ ∈ Ψ} to approximate the policy's state marginal distribution, ρ π (s). We assume that the class of density models Q is sufficiently expressive to represent every policy: Assumption 1. For every policy π ∈ Π, there exists q ∈ Q such that D KL (ρ π (s) q(s)) = 0.

Under this assumption, optimizing the policy w.r.t. this approximate distribution q(s) will yield the same solution as Equation 1 (see Appendix A for the proof): Proposition 3.1. Let policies Π and density models Q satisfying Assumption 1 be given. For any target distribution p * , the following optimization problems are equivalent:

EQUATION

Solving the new max-min optimization problem is equivalent to finding the Nash equilibrium of a two-player, zero-sum game: a policy player chooses the policy π while the density player chooses the density model q. To avoid confusion, we use actions to refer to controls a ∈ A output by the policy π in the traditional RL problem and strategies to refer to the decisions π ∈ Π of the policy player and decisions q ∈ Q of the density player. The Nash existence theorem (Nash, 1951) proves that such a stationary point always exists for such a two-player, zero-sum game.

One common approach to saddle point games is to alternate between updating player A w.r. 

(m) ← arg max q E s∼B (m-1) [log q(s)] π (m) ← arg max π E s∼ρπ (s) [r(s)] where r(s) log p * (s) -log q (m) (s) B (m) ← B (m-1) ∪ {(st, at, st+1)} T t=1 with new transitions {(st, at, st+1)} T t=1 sampled from π (m) return historical policies {π (1) , • • • , π (m) }

Algorithm 1: An algorithm for optimizing the State Marginal Matching objective (Equation 1). The algorithm iterates between (1) fitting a density model q (m) and ( 2) training the policy π (m) with a RL objective to optimize the expected return w.r.t. the updated reward function r(s). The algorithm returns the collection of policies from each iteration, which do distribution matching in aggregate.

fictitious play (Brown, 1951) does converge to a Nash equilibrium in finite time (Robinson, 1951; Daskalakis & Pan, 2014) . At each iteration, each player chooses their best strategy in response to the historical average of the opponent's strategies. In our setting, fictitious play alternates between fitting the density model to the historical average of policies (Equation 4), and updating the policy with RL to minimize the log-density of the state, using a historical average of the density models (Equation 5):

q m+1 ← arg max q E s∼ ρm(s) [log q(s)]

where ρ(m)

π (s) 1 m m i=1 ρ πi (s) (4) π m+1 ← arg max π E s∼ρπ(s) [log p * (s) -log qm (s)] where qm (s) 1 m m i=1 q i (s) (5)

Crucially, the exploration policy is not the last policy, π m+1 , but rather the historical average policy: Definition 3.1. A historical average policy π(a | s), parametrized by a collection of policies π 1 , • • • , π m , is a policy that randomly samples one of the policy iterates

π i ∼ Unif[π 1 , • • • , π m ]

at the start of each episode and takes actions according to that policy for each step in the episode. A new policy is sampled for the next episode.

We summarize the resulting algorithm in Algorithm 1. In practice, we can efficiently implement Equation 4 and avoid storing the policy parameters from every iteration by instead storing sampled states from each iteration. 3 We cannot perform the same trick for Equation 5, and instead resort to approximating the historical average of density models with the most recent iterate. Algorithm 1 looks similar to prior exploration methods based on prediction-error, suggesting that we might use SMM to understand how these prior methods work.

4. WHY DOES PREDICTION-ERROR EXPLORATION WORK?:

Exploration methods based on prediction error (Burda et al., 2018; Stadie et al., 2015; Pathak et al., 2017; Schmidhuber, 1991; Chentanez et al., 2005) do not converge to an exploratory policy, even in the absence of extrinsic reward. For example, consider the asymptotic behavior of ICM (Pathak et al., 2017) in a deterministic MDP, such as the Atari games where it was evaluated. At convergence, the predictive model will have zero error in all states, so the exploration bonus is zero -the ICM objective has no effect on the policy at convergence. Similarly, consider the exploration bonus in Pseudocounts (Bellemare et al., 2016) : 1/n(s), where n(s) is the (estimated) number of times that state s has been visited. In the infinite limit, each state has been visited infinitely many times, so the Pseudocount exploration bonus also goes to zero -Pseudocounts has no effect at convergence. Similar reasoning can be applied to other methods based on prediction error (Burda et al., 2018; Stadie et al., 2015) . More broadly, we can extend this analysis to stochastic MDPs, where we consider an abstract exploration algorithm that alternates between computing some intrinsic reward and performing RL (to convergence) on that intrinsic reward. Existing prediction-error exploration methods are all special cases. At each iteration, the RL step solves a fully-observed MDP, which always admits a deterministic policy as a solution (Puterman, 2014). Thus, any exploration algorithm in this class cannot converge to a single, exploratory policy. Despite these observations, prior methods do excel at solving hard exploration tasks. We draw an analogy to fictitious play to explain their success. While these methods never acquire an exploratory policy, over the course of training they will eventually visit all states. In other words, the historical average over policies will visit a wide range of states. Since the replay buffer exactly corresponds to this historical average over states, these methods will obtain a replay buffer with a diverse range of experience, possibly explaining why they succeed at solving hard exploration tasks. Moreover, this analysis suggests a surprisingly simple method for obtaining an exploration from these prior methods: use a mixture of the policy iterates throughout training. The following section will not only compare SMM against prior exploration methods, but also show that this historical averaging trick can be used to improve existing exploration methods.

5. SIMULATED EXPERIMENTS:

We used simulated control tasks to determine if SMM learns an exploratory policy, to compare SMM to prior exploration methods, and to study the effect of historical averaging. More details can be found in Appendix D, and code will be released upon publication.

Baselines and Implementation Details: We compare to a state-of-the-art off-policy MaxEnt RL algorithm, Soft Actor-Critic (SAC) (Haarnoja et al., 2018) ; an inverse RL algorithm, Generative Adversarial Imitation Learning (GAIL) (Ho & Ermon, 2016) ; and three exploration methods:

• Count-based Exploration (C), which discretizes states and uses -log π(s) as an exploration bonus.

• Pseudo-counts (PC) (Bellemare et al., 2016) , which uses the recoding probability as a bonus.

• Intrinsic Curiosity Module (ICM) (Pathak et al., 2017) , which uses prediction error as a bonus.

We used SAC as the base RL algorithm for all exploration methods (SMM, C, PC, ICM). To implement SMM, we define the target distribution in terms of the extrinsic environment reward: p * (s) ∝ exp(r env (s)). We use a variational autoencoder (VAE) to model the density q(s) for both SMM and Pseudocounts (PC). For the GAIL baseline, we generated synthetic expert data by sampling expert states from the target distribution p * (s) (see Appendix D.2 for details). Results for all experiments are averaged over 4-5 random seeds.

We start with a sanity check: Is exploration in state space (as done by SMM) better than exploration in action space (as done by MaxEnt RL, e.g., SAC)? To study this question, we implemented a 2D Navigation environment, shown in Figure 2a . To evaluate each method, we counted the number of hallways that the agent fully explored (i.e., reached the end) during training. Figure 2b shows the state visitations for the three hallway environment, illustrating that SAC only explores one hallway, whereas SMM explores all three. Figure 2c also shows that SMM consistently explores 60% of hallways, whereas SAC rarely visits more than 20% of hallways.

The remaining simulated experiments used the Manipulation environment (Plappert et al., 2018) , shown in Figure 3a . Our first experiment evaluates whether the exploration policy acquired by SMM allows us to solve downstream tasks more quickly. We defined the target distribution to be uniform over the entire state space (joint + block configuration), with the constraints that we put low probability mass on states where the block has fallen off the table; that actions should be small; and that the arm should be close to the object. As shown in Figure 3b , SMM adapts substantially more quickly than other exploration methods, achieving a success rate 20% higher than the next best method, and reaching the same level of performance of the next baseline (ICM) in 4x fewer episodes. SMM without historical averaging attains similar performance as the next best baseline (ICM), suggesting that historical averaging is the key ingredient, while the particular choice of prediction error or VAE is less important. We provide further ablation studies of SMM in Appendix B.2.

While historical averaging is necessary to guarantee convergence ( § 3.1), most prior exploration methods do not employ historical averaging, raising the question of whether it is necessary in practice.

To answer this question, we compare SMM to three exploration methods. In Figure 3c , we compare the policy obtained at convergence with the historical average of policy iterates over training for each method. We measure how well each method explores by computing the marginal state entropy, which we compute by discretizing the state space. 4 The results show that SMM maximizes state entropy at least as effectively as prior methods, if not better. While this comparison is somewhat unfair, as we measure exploration using the objective that SMM maximizes, none of the methods we compare against propose metrics for exploration that we could use instead. Furthermore, we see that historical averaging is not only beneficial to SMM, but also improves the exploration of prior methods.

In our final simulated experiment, we check whether prior knowledge injected via the target distribution is reflected in the policy obtained from State Marginal Matching. Using the same Manipulation environment as above, we modified the target distribution to assign larger probability to states where the block was on the left half of the table than on the right half. In Figure 3d , we measure whether SMM is able to achieve the target distribution by measuring the discrepancy between the block's horizontal coordinate and the target distribution. Compared to the SAC baseline, SMM and the Count baseline are half the distance to the target distribution. No method achieves zero discrepancy, suggesting that future methods could be better at matching state marginals.

6. REAL-WORLD EXPERIMENTS:

While almost all research on exploration focus on simulated domains, attributes of the real world such as partial observability, nonstationarity, and stochasticity may make the exploration more challenging. The aim of this section is to see if SMM explores effectively on a real-world robotic control task. We used the D'Claw (Ahn et al., 2019) robotic manipulator, which is a 3-fingered hand positioned vertically above a handle that it can turn. For all experiments on the D'Claw, we used a target distribution that places uniform mass over all object angles [-180 In a first experiment, we trained SMM and other baselines in simulation, and then evaluated the acquired exploration policy on the real robot using two metrics: the total number of rotations (in either direction), and the maximum radians turned (in both directions). For each method, we computed the average metric across 100 evaluation episodes. We repeated this process for 5 independent training runs. Figure 4b shows that SMM turns the knob more than the baselines, and it turns the knob to a wider range of angles. To test for statistical significance, we used a 1-sided Student's t-test to test the hypothesis that SMM turned the knob more and to a wider range of angles than SAC. The p-values were all less than 0.05: p = 0.046 for number of rotations, p = 0.019 for maximum clockwise angle, and p = 0.001 for maximum counter-clockwise angle.

In our second experiment, we investigated whether it was possible to learn an exploration policy directly in the real world, without the need for a simulator. Learning to explore in the real world is quite important, as building faithful simulators of complex systems is challenging. The physical constraints of the real robot make data efficiency paramount, suggesting that learning to explore will require an effective exploration strategy. In Figure 4c , we plot the range of angles that the policy explores throughout training. Not only does SMM explore a wider range of angles than SAC, but its ability to explore increases throughout training, suggesting that the SMM objective is correlated with real-world metrics of exploration.

In summary, the results in this section suggests that exploration techniques may actually be useful in the real world, which may encourage future work to study exploration methods on real-world tasks.

7. DISCUSSION:

In this paper, we introduced a formal objective for exploration. While it is often unclear what existing exploration algorithms will converge to, our State Marginal Matching objective has a clear solution: at convergence, the policy should visit states in proportion to their density under a target distribution. Not only does this objective encourage exploration, it also provides human users with a flexible mechanism to bias exploration towards states they prefer and away from dangerous states. Upon convergence, the resulting policy can thereafter be used as a prior in a multi-task setting, amortizing exploration and enabling faster adaptation to new, potentially sparse, reward functions. The algorithm we proposed looks quite similar to previous exploration methods based on prediction error, suggesting that those methods are also performing some form of distribution matching. However, by deriving our method from first principles, we note that these prior methods omit a crucial historical averaging step, without which the algorithm is not guaranteed to converge. Experiments on both simulated and real-world tasks demonstrated how SMM learns to explore, enabling an agent to efficiently explore in new tasks provided at test time.

In future work, we aim to study connections between inverse RL, MaxEnt RL and state marginal matching, all of which perform some form of distribution matching. Empirically, we aim to scale to more complex tasks by parallelizing the training of all mixture components simultaneously. Broadly, we expect the state distribution matching problem formulation to enable the development of more effective and principled RL methods that reason about distributions rather than individual states.

A PROOFS:

Proof of Proposition 3.1. Note that

EQUATION

By Assumption 1, D KL (ρ π (s) q(s)) = 0 for some q ∈ Q, so we obtain the desired result:

max π min q E ρπ(s) [log p * (s) -log q(s)] = max π E ρπ(s) [log p * (s) -log ρ π (s)] + min q D KL (ρ π (s) q(s)) = max π E ρπ(s) [log p * (s) -log ρ π (s)].

B BETTER MARGINAL MATCHING WITH MIXTURES OF MIXTURES:

This section introduces an extension of SMM, SM4, that incorporates mixure modelling. Given the challenging problem of exploration in large state spaces, it is natural to wonder whether we can accelerate exploration by automatically decomposing the potentially-multimodal target distribution into a mixture of "easier-to-learn" distributions and learn a corresponding set of policies to do distribution matching for each component. Note that the mixture model we introduce here is orthogonal to the historical averaging step discussed before. Using ρ πz (s) to denote the state distribution of the policy conditioned on the latent variable z ∈ Z, the state marginal distribution of the mixture of policies is

EQUATION

where p(z) is a latent prior. As before, we will minimize the KL divergence between this mixture distribution and the target distribution. Using Bayes' rule to re-write ρ π (s) in terms of conditional probabilities, we obtain the following optimization problem:

max (πz) z∈Z E z∼p(z) s∼ρπ z (s)   log p * (s) ρπ z (s)p(z) p(z|s)   = E z∼p(z) s∼ρπ z (s)   log p * (s) (a)

-log ρ πz (s)

(b) + log p(z | s) (c) -log p(z) (d)    (8)

Intuitively, this says that the agent should go to states (a) with high density under the target state distribution, (b) where this agent has not been before, and (c) where this agent is clearly distinguishable from the other agents. The last term (d) says to explore in the space of mixture components z. This decomposition bears a resemblance to the mutual-information objectives in recent work (Achiam et al., 2018; Eysenbach et al., 2018; Co-Reyes et al., 2018) . Thus, one interpretation of our work is as explaining that mutual information objectives almost perform distribution matching. The caveat is that prior work omits the state entropy term -log ρ πz (s) which provides high reward for visiting novel states, possibly explaining why these previous works have failed to scale to complex tasks.

B.1 ALGORITHMIC SUMMARY:

We summarize the resulting procedure in Algorithm 2, which we refer to as SM4 (State Marginal Matching with Mixtures of Mixtures). The algorithm (1) fits a density model q (m) z (s) to approximate the state marginal distribution for each policy π z ; (2) learns a discriminator d (m) (z | s) to predict which policy π z will visit state s; and (3) uses RL to update each policy π z to maximize the expected return of its corresponding reward function r z (s) log p * (s) -log ρ πz (s) + log p(z | s) -log p(z) derived in Equation 8.

The only difference from Algorithm 1 is that we learn a discriminator d(z | s), in addition to updating the density models q z (s) and the policies π z (a | s). Jensen's inequality tells us that maximizing the log-density of the learned discriminator will maximize a lower bound on the true density (see Agakov (2004) ): 

E s∼ρπ z (s),z∼p(z) [log d(z | s)] ≤ E s∼ρπ z (s),z∼p(z) [log p(z | s)]

(m) z ← arg max q E {s|(z ,s)∼B (m-1) ,z =z} [log q(s)] d (m) ← arg max d E (z,s)∼B (m-1) [log d(z | s)]

(2) Update discriminator.

for z = 1, • • • , n do r (m) z (s) log p * (s) -log q (m) z (s) + log d (m) (z | s) -log p(z) π (m) z ← arg max π E ρπ(s) r (m) z (s) (3) Update each policy π z . Sample latent skill z (m) ∼ p(z) Sample transitions {(s t , a t , s t+1 )} T t=1 with π (m) z (a | s) B (m) ← B (m-1) ∪ {(z (m) , s t , a t , s t+1 )} T t=1 return {{π (1) 1 , • • • , π (1) n }, • • • , {π (m) 1 , • • • , π (m)

n }} Algorithm 2. An algorithm for learning a mixture of policies π1, π2, • • • , πn that do state marginal matching in aggregate. The algorithm (1) fits a density model q (m) z (s) to approximate the state marginal distribution for each policy πz; (2) learns a discriminator d (m) (z | s) to predict which policy πz will visit state s; and (3) uses RL to update each policy πz to maximize the expected return of its corresponding reward function derived in Equation 8: rz(s) log p * (s) -log ρπ z (s) + log p(z | s) -log p(z). In our implementation, the density model qz(s) is a VAE that inputs the concatenated vector {s, z} of the state s and the latent skill z used to obtain this sample s; and the discriminator is a feedforward MLP. The algorithm returns the historical average of mixtures of policies (a total of n • m policies).

In our implementation, the density model q z (s) is a VAE that inputs the concatenated vector {s, z} of the state s and the latent skill z used to obtain this sample s; and the discriminator is a feedforward MLP. The algorithm returns the historical average of mixtures of policies (a total of n • m policies). Our implementation uses a uniform categorical distribution for the prior p(z), and does not implement the update for p(z).

Note that the updates for each z can be conducted in parallel. A distributed implementation would emulate broadcast-collect algorithms (Lynch, 1996) , with each worker updating the policy independently, and periodically aggregating results to update the discriminator d(z | s). Such a distributed implementation has the appealing property that each compute node would explore a different part of the state space. While there has been some work on multi-agent coordinated exploration (Parisotto et al., 2019) and concurrent exploration (Dimakopoulou & Van Roy, 2018) , it remains a fairly unexplored area (pun intended) and we believe that SMM with Mixtures of Mixtures offers a simple approach to this problem.

B.2 ABLATION STUDY:

To understand the relative contribution of each component in the SM4 objective (Equation 8), we compare SM4 to baselines that lack conditional state entropy H πz [s] = -log ρ πz (s), latent conditional action entropy log p(z | s), or both (i.e, SAC). In Figure 5a , we plot the training time performance on the Navigation task with 3 halls of length 50. We see that SM4 relies heavily on both key differences from SAC.

In Figure 5b , we study the effect of mixture modelling on test-time exploration in the Manipulation environment. After running SMM/SM4 with a uniform distribution, we count the number of episodes required to find an (unknown) goal state. We run each method for the same number of environment transitions; a mixture of three policies does not get to take three times more transitions. We find that increasing the number of mixture components increases the agents success. However, the effect was smaller when using historical averaging. Taken together, this result suggests that efficient exploration requires either historical averaging or mixture modelling, but might not need both. On the Navigation task, we compare SM4 (with three mixture components) against ablation baselines that lack conditional state entropy, latent conditional action entropy, or both (i.e., SAC) in the SM4 objective (Equation 8). We see that both terms contribute heavily to the exploration ability of SM4, but the state entropy term is especially critical. (b): We compare SMM/SM4 with different numbers of mixtures, and with vs. without historical averaging. We found that increasing the number of latent mixture components n ∈ {1, 2, 4} accelerates exploration, as does historical averaging. Error bars show std. dev. across 4 random seeds.

C CHOOSING p * (s) FOR GOAL-REACHING TASKS

In general, the choice of the target distribution p * (s) will depend on the distribution of tasks.

In this section, we consider the special case where the test-time tasks correspond to goal-reaching derive the optimal target distribution p * (s). We consider the setting where goals g ∼ p g (g) are sampled from some known distribution. Our goal is to minimize the number of episodes required to reach that goal state. We define reaching the goal state as visiting a state that lies within an ball of the goal, where both > 0 and the distance metric are known.

We start with a simple lemma that shows that the probability that we reach the goal at any state in a trajectory is at least the probability that we reach the goal at a randomly chosen state in that same trajectory. Defining the binary random variable z t 1( s t -g ≤ ) as the event that the state at time t reaches the goal state, we can formally state the claim as follows: Lemma C.1.

EQUATION

Proof. We start by noting the following implication:

EQUATION

Thus, the probability of the event on the RHS must be at least as large as the probability of the event on the LHS:

EQUATION

Next, we look at the expected number of episodes to reach the goal state. Since each episode is independent, the expected hitting time is simply

EQUATION

Note that we have upper-bounded the hitting time using Lemma C.1. Since the goal g is a random variable, we take an expectation over g:

EQUATION

We can rewrite the RHS using p * (s) to denote the target state marginal distribution:

EQUATION

We will minimize F, an upper bound on the expected hitting time.

Lemma C.2. The state marginal distribution p * (s) ∝ p(s) minimizes F(p * ), where p(s) p g (s)1( s -s ≤ )ds is a smoothed version of the target density.

Before presenting the proof, we provide a bit of intuition. In the case where → 0, the optimal target distribution is p * (s) ∝ p g (s). For non-zero , the policy in Lemma C.2 is equivalent to convolving p g (s) with a box filter before taking the square root. In both cases, we see that the optimal policy does distribution matching to some function of the goal distribution. Note that p(•) may not sum to one and therefore is not a proper probability distribution.

Proof. We start by forming the Lagrangian:

EQUATION

The first derivative is

dL dp * (s) = -p g (s)1( s -s ≤ ) p * 2 (s) ds + λ = 0 (16)

Note that the second derivative is positive, indicating that this Lagrangian is convex, so all stationary points must be global minima:

EQUATION

Setting the first derivative equal to zero and rearranging terms, we obtain

EQUATION

Renaming s ↔ s, we obtain the desired result.

C.1 CONNECTIONS TO GOAL-CONDITIONED RL Goal-Conditioned RL (Kaelbling, 1993; Nair et al., 2018; Held et al., 2017) can be viewed as a special case of State Marginal Matching when the goal-sampling distribution is learned jointly with the policy.

In particular, consider the State Marginal Matching with a mixture policy (Algorithm 2), where the mixture component z maps bijectively to goal states g. In this case, we learn goal-conditioned policies of the form π(a | s, g). We start by swapping g for z in the SMM objective with Mixtures of Policies (Equation 8):

EQUATION

The second term p(g | s) is an estimate of which goal the agent is trying to reach, similar to objectives in intent inference (Ziebart et al., 2009; Xie et al., 2013) . The third term π(s | g) is the distribution over states visited by the policy when attempting to reach goal g. For an optimal goal-conditioned policy in an infinite-horizon MDP, both of these terms are Dirac functions:

EQUATION

In this setting, the State Marginal Matching objective simply says to sample goals g ∼ π(g) with probability equal to the density of that goal under the target distribution.

EQUATION

Whether goal-conditioned RL is the preferable way to do distribution matching depends on (1) the difficulty of sampling goals and (2) the supervision that will be provided at test time. It is natural to use goal-conditioned RL in settings where it is easy to sample goals, such as when the space of goals is small and finite or otherwise low-dimensional. If a large collection of goals is available apriori, we could use importance sampling to generate goals to train the goal-conditioned policy (Pong et al., 2019) . However, many real-world settings have high-dimensional goals, which can be challenging to sample. While goal-conditioned RL is likely the right approach when we will be given a test-time task, a latent-conditioned policy may explore better in settings where the goal-state is not provided at test-time.

D ADDITIONAL EXPERIMENTS & EXPERIMENTAL DETAILS D.1 ENVIRONMENT DETAILS:

We summarize the environment parameters for Navigation (Figures 2, 5a) , Manipulation (Figures 3, 5b, 7, 8, 9, 10) , and D'Claw (Figure 4 ) in Table 1 .

Navigation: Episodes have a maximum time horizon of 100 steps. The environment reward is

r env (s) = p i if s robot -g i 2 2 < for any i ∈ [n] 0 otherwise

where s xy is the xy-position of the agent. We used a uniform target distribution over the end of all m halls, so the environment reward at training time is r env (s) = 1 m if the robot is close enough to the end of any of the halls.

We used a fixed hall length of 10 in Figures 2b and 2c , and length 50 in Figure 5a . All experiments used m = 3 halls, except in Figure 2c where we varied the number of halls {3, 5, 7}.

Manipulation. We used the simulated Fetch Robotics arm5 implemented by Plappert et al. (2018) using the MuJoCo simulator Todorov et al. (2012) . The state vector s ∈ R 28 includes the xyzcoordinates s obj , s robot ∈ R 3 of the block and the robot gripper respectively, as well as their velocities, orientations, and relative position s obj -s robot . At the beginning of each episode, we spawn the object at the center of the table, and the robot gripper above the initial block position. We terminate each episode after 50 environment steps, or if the block falls off the table . We considered two target state marginal distributions. In Manipulation-Uniform, the target density is given by p * (s) ∝ exp (α 1 r goal (s) + α 2 r robot (s) + α 3 r action (s))

where α 1 , α 2 , α 3 > 0 are fixed weights, and the rewards r goal (s) := 1 -1(s obj is on the table surface) r robot (s) := 1( s obj -s robot 2 2 < 0.1) r action (s) := -a 2 2 correspond to (1) a uniform distribution of the block position over the table surface (the agent receives +0 reward while the block is on the table), (2) an indicator reward for moving the robot gripper close to the block, and (3) action penalty, respectively. The environment reward is a weighted sum of the three reward terms: r env (s) 20r goal (s) + r robot (s) + 0.1r action (s). At test-time, we sample a goal block location g ∈ R 3 uniformly on the table surface, and the goal is not observed by the agent.

In Manipulation-Half, the target state density places higher probability mass to states where the block is on the left-side of the table. This is implemented by replacing r goal (s) with a reward function that gives a slightly higher reward +0.1 for states where the block is on the left-side of the table. D'Claw. The D'Claw robot (Ahn et al., 2019; Zhu et al., 2019) 6 controls three claws to rotate a valve object. The environment consists of a 9-dimensional action space (three joints per claw) and a 12-dimensional observation space that encodes the joint angles and object orientation. We fixed each episode at 50 timesteps, which is about 5 seconds on the real robot. In the hardware experiments, each algorithm was trained on the same four D'Claw robots to ensure consistency.

We defined the target state distribution to place uniform probability mass over all object angles in [-180 • , 180 • ]. It also incorporates reward shaping terms that place lower probability mass on states with high joint velocity and on states with joint positions that deviate far from the initial position (see (Zhu et al., 2019) ).

D.2 GAIL:

GAIL assumes access to expert demonstrations, which SMM and the other exploration methods do not require. To compare GAIL with the exploration methods on a level footing, we sampled synthetic states from p * (s) to train GAIL, and restricted the GAIL discriminator input to states only (no actions).

For D'Claw (Fig. 4 ), we sampled the valve object angle uniformly in [-180 • , 180 • ]. For Manipulation-Uniform (Fig. 3c ), we sampled object positions s object uniformly on the table surface, and tried two different sampling distributions for the gripper position s robot (see Fig. 6 ). For both environments, all other state dimensions were sampled uniformly in [-10, 10], and used 1e4 synthetic state samples to train GAIL.

Since the state samples from p * (s) may not be reachable from the initial state, the policy may not be able to fool the discriminator. To get around this problem, we also tried training GAIL with the discriminator input restricted to only the state dimensions corresponding to the object position or gripper position (Manipulation), or the object angle (D'Claw). We summarize these GAIL ablation experiments in Fig. 6 . In our experiments, we used the best GAIL ablation model to compare against the exploration baselines in Figures 3c and 4 .

D.3 VAE DENSITY MODEL:

In our SMM implementation, we estimated the density of data x as p(x) ≈ decoder(x = x|z = encoder(x)). That is, we encoded x to z, reconstruction x from z, and then took the likelihood of the true data x under a unit-variance Gaussian distribution centered at the reconstructed x. The log-likelihood is therefore given by the mean-squared error between the data x and the reconstruction x, plus a constant that is independent of x: log q(x) = 1 2 x -x 2 2 + C.

D.4 COMPUTATIONAL COMPLEXITY:

We compare the wall-clock time of each exploration method in Table 2 . The computational cost of our method is comparable with prior work. We restricted the discriminator to the entire state vector s, or to the object angle and position s object . Analysis: In both domains, we observe that restricting the discriminator input to fewer state dimensions (e.g., to s object ) makes the discriminator less capable of distinguishing between expert and policy states (orange and green curves). On the other hand, training on the entire state vector s causes the discriminator loss to approach 0 (i.e., perfect classification), partly because some of the "expert" states sampled from p * (s) are not reachable from the initial state, and the policy is thus unable to fool the discriminator. (3) Last: Sample the N latest policies uniformly at random. We found that Uniform worked less well, possibly due to the policies at early iterations not being trained enough. We found negligible difference in the state entropy metric between Exponential vs. Last, and between sampling 5 vs. 10 historical policies, and we also note that it is unnecessary to keep checkpoints from every iteration.

Network Hyperparameters. For all algorithms, we use a Gaussian policy with two hidden layers with Tanh activation and a final fully-connected layer. The Value function and Q-function each are a feedforward MLP with two hidden layers with ReLU activation and a final fully-connected layer. Each hidden layer is of size 300 (SMM, SAC, ICM, C, PC) or 256 (GAIL). The same network configuration is used for the SMM discriminator, d(z | s), and the GAIL discriminator, but with different input and output sizes. The SMM density model, q(s), is modeled by a VAE with encoder and decoder networks each consisting of two hidden layers of size (150, 150) with ReLU activation. The same VAE network configuration is used for Pseudocount.

GAIL Hyperparameters::

The replay buffer is filled with 1e4 random actions before training, for training stability. We perform one discriminator update per SAC update. For both Manipulation and D'Claw, we used 1e4 states sampled from p * (s). Other hyperparameter settings, such as batch size for both discriminator and policy updates, are summarized in Table 3 . We observed that GAIL training is more unstable compared to the exploration baselines. Thus, for GAIL, we did not take the final iterate (e.g., policy at convergence) but instead used early termination (e.g., take the best iterate according to the state entropy metric).

D.6 VISUALIZING THE MANIPULATION ENVIRONMENT:

We visualize where different methods push the block in the Manipulation environment. More precisely, we visualize the log state marginal log ρ πz (s) over block XY-coordinates s = (x, y) in Figures 7 and 8 . In Figure 9 , we plot goals sampled at test-time, colored by the number of episodes each method required to push the block to that goal location. Blue dots indicate that the agent found the goal quickly. We observe that SMM has the most blue dots, indicating that it succeeds in exploring a wide range of states at test-time. 

:

Videos and code: https://sites.google.com/view/smm-anonymous

ρπ(s) approaches the policy's stationary distribution in the limit as the episodic horizon T → ∞.

One approach is to maintain an infinite-sized replay buffer, and fit the density to the replay buffer at each iteration. Alternatively, we can replace older samples in a fixed-size replay buffer less frequently such that sampling from B is uniform over iterations.

Discretization is used only for evaluation, no policy has access to it (except for Count).

https://fetchrobotics.com/

www.roboticsbenchmarks.org

Figures and Tables:

Figure 1: State Marginal Matching: (Left) Our goal is to learn a policy whose distribution over states (blue histogram) matches some target density (black line). Our algorithm iteratively increases the reward on states visited too infrequently (green arrow) and decreases the reward on states visited too frequently (red arrow). (Center) At convergence, these two distributions are equal. (Right) For complex target distributions, we use a mixture of policies ρπ(s) = ρπ z (s)p(z)dz. (See Appendix B.)

Figure 2: Exploration in State Space (SMM) vs. Action Space (SAC) for Navigation: (a): A point-mass agent is spawned at the center of m long hallways that extend radially outward, and the target state distribution places uniform probability mass 1 m at the end of each hallway. We can vary the length of the hallway and the number of hallways to control the task difficulty. (b) A heatmap showing states visited by SAC and SMM during training illustrates that SMM explores a wider range of states. (c) SMM reaches more goals than the MaxEnt baseline. SM4 is an extension of SMM that incorporates mixture modelling with n > 1 skills (see Appendix B), and further improves exploration of SMM.

Figure 3: Exploration for Manipulation. (a) Task: The robot agent controls a single gripper arm to move a block object to a goal location on the table surface. The goal is not observed by the robot, thus requiring the robot to explore by moving the block to different locations on the table. (b) Test-Time Exploration: At test-time, we sample goal locations uniformly on the table, and plot the percentage of goals found within N episodes. SMM and its mixture-model variant SM4 (Algorithm 2) both explore faster than the baselines, allowing it to successfully find the goal in fewer episodes. (c) State Entropy: After training, we rollout the policy for 1e3 epochs, and record the entropy of the object and gripper positions. SMM achieves higher state entropy than the other methods. Historical averaging also improves the exploration of prior methods. (d) Non-Uniform Exploration: We measure the discrepancy between the state marginal distribution, ρπ(s), and a non-uniform target distribution. SMM matches the target distribution better than SAC and is on par with Count. Error bars show std. dev. across 4 random seeds.

Figure 4: Real-World Exploration: (a) D'Claw is a 9-DoF robotic hand (Ahn et al., 2019) that is trained to turn a valve object. (b) Sim2Real: We trained each algorithm in simulation, and then measured how far the trained policy rotated the knob on the hardware robot. We also measured the maximum angle that the agent turned the knob in the clockwise and counter-clockwise directions within one episode. (c) Training on Hardware: We trained SAC and SMM on the real robot for 1e5 environment steps (about 9 hours in real time), and measured the maximum angle turned throughout training. We see that SMM moves the knob more and visits a wider range of states than SAC. All results are averaged over 4-5 seeds.

Figure 5: Ablation Analysis of State Marginal Matching with Mixtures of Mixtures (SM4). (a):On the Navigation task, we compare SM4 (with three mixture components) against ablation baselines that lack conditional state entropy, latent conditional action entropy, or both (i.e., SAC) in the SM4 objective (Equation8). We see that both terms contribute heavily to the exploration ability of SM4, but the state entropy term is especially critical. (b): We compare SMM/SM4 with different numbers of mixtures, and with vs. without historical averaging. We found that increasing the number of latent mixture components n ∈ {1, 2, 4} accelerates exploration, as does historical averaging. Error bars show std. dev. across 4 random seeds.

(a) GAIL ablations on Manipulation (b) GAIL ablations on D'Claw

Figure 6: GAIL Ablation Study: We studied the effect of restricting the GAIL discriminator input to fewer state dimensions. (a) Manipulation: We trained the GAIL discriminator on the entire state vector s; on the object and gripper positions {s object , s robot } only; or on the object position s object only. We also varied the sampling distribution for the gripper position, p * (s robot ): we compare using a normal distribution, N (s object , I 3 ), to sample gripper positions closer to the object, versus a uniform distribution, Uniform[-10, 10], for greater entropy of the sampled gripper positions. We observe that sampling gripper positions closer to the object position improves the entropy of the object position H π [s object ], but hurts the entropy of the gripper position H π [s robot ]. (b) D'Claw:We restricted the discriminator to the entire state vector s, or to the object angle and position s object . Analysis: In both domains, we observe that restricting the discriminator input to fewer state dimensions (e.g., to s object ) makes the discriminator less capable of distinguishing between expert and policy states (orange and green curves). On the other hand, training on the entire state vector s causes the discriminator loss to approach 0 (i.e., perfect classification), partly because some of the "expert" states sampled from p * (s) are not reachable from the initial state, and the policy is thus unable to fool the discriminator.

74s (+27%) 25.24s (+41%) 25.82s (+44%) 33.87s (+89%)D.5 ALGORITHM HYPERPARAMETERSWe summarize hyperparameter settings in Table3. All algorithms were trained for 1e5 steps on Navigation, 1e6 steps on Manipulation, 1e6 steps on D'Claw Sim2Real, and 1e5 steps on D'Claw hardware.Loss Hyperparameters. For each exploration method, we tuned the weights of the different loss components. SAC reward scale controls the weight of the action entropy reward relative to the extrinsic reward. Count coeff controls the intrinsic count-based exploration reward w.r.t. the extrinsic reward and SAC action entropy reward. Similarly, Pseudocount coeff controls the intrinsic pseudocount exploration reward. SMM coeff for H[s | z] and H[z | s] control the weight of the different loss components (state entropy and latent conditional entropy) of the SMM objective in Equation8.Historical Averaging. In the Manipulation experiments, we tried the following sampling strategies for historical averaging: (1) Uniform: Sample policies uniformly across training iterations. (2) Exponential: Sample policies, with recent policies sampled exponentially more than earlier ones.

Figure 7: The log state marginal log ρ π (s) over block XY-coordinates, averaged over 1e3 epochs.

Figure 8: SM4 with Eight Mixture Components. The log state marginal log ρ πz (s) over block XY-coordinates for each latent skill z ∈ {0, . . . , 7}, averaged over 1000 epochs.

Figure 9: Goals sampled uniformly on the table surface, colored by the number of episodes until the policy finds the goal. Red (100 episodes) indicates failure. The block always starts at the center.

Algorithm 2 State Marginal Matching with Mixtures of Mixtures (SM4)Input: Target distribution p * (s) Initialize policy π z (a | s), density model q z (s), discriminator d(z | s), and replay buffer B.

Table content: <table><tr><td>while not converged do</td><td/></tr><tr><td>for z = 1, • • • , n do</td><td>(1) Update density model for each policy π z .</td></tr><tr><td>q</td><td/></tr></table>

Environment parameters specifying the observation space dimension |S|; action space dimension |A|; max episode length T ; the environment reward, related to the target distribution by exp{r env (s)} ∝ p * (s), and other environment parameters.

Table content: <table><tr><td>Environment</td><td colspan="3">|S| |A| T</td><td colspan="3">Env Reward (log p  *  (s)) Other Parameters Figure</td></tr><tr><td>Navigation</td><td>2</td><td>2</td><td>100</td><td>Uniform over all m halls</td><td># Halls: 3, 5, 7 Hall length: 10</td><td>2</td></tr><tr><td/><td/><td/><td/><td>Uniform over all m halls</td><td># Halls: 3 Hall length: 50</td><td>5a</td></tr><tr><td>Manipulation</td><td>25</td><td>4</td><td>50</td><td>over table surface Uniform block pos.</td><td/><td>3b, 3c, 5b</td></tr><tr><td/><td/><td/><td/><td>More block pos. density</td><td/><td>3d</td></tr><tr><td/><td/><td/><td/><td>on left-half of table</td><td/><td/></tr><tr><td>D'Claw</td><td>12</td><td>9</td><td>50</td><td>Uniform object angle</td><td/><td>4</td></tr><tr><td/><td/><td/><td/><td>over [-180 • , 180 • ]</td><td/><td/></tr></table>

Per-epoch wall-clock time on the Manipulation environment. One epoch is 1e3 env. steps.

Table content: <table><tr><td>SAC</td><td>ICM</td><td>Count</td><td>SMM (ours)</td><td>PseudoCounts</td></tr><tr><td>17.95s (+0%) 22.</td><td/><td/><td/><td/></tr></table>

Peer review (iclr2020):
Summary: The paper proposes to frame exploration in reinforcement learning as a distribution matching problem. More specifically, the proposed method (SMM) aims to minimize the reverse KL between the state distribution induced by the policy and a desired state distribution. The desired state distribution can be used to guide exploration (e.g. by penalizing bad states) or can be chosen uniformly (resulting in a policy that maximizes state entropy). SMM iteratively optimizes the policy and a model for its induced state-distribution. The latter is used for approximating the policies state entropy. The algorithm is framed as a two-player zero-sum game between a *policy player* and a *density player*. In order to justify that one of the players is assumed fixed while optimizing the other player, SMM optimizes the players against a historical average of the opponent. Such approach is known as fictitious play in game theory and ensures convergence to a Nash equilibrium. The density player maximizes the likelihood of the states encountered during all previous roll-outs using a VAE. The policy update is framed as a standard reinforcement learning problem where the log-pdf of the target distribution serves as reward and the log-pdf of the model acts as cost. For practical reasons, the policy update does not consider an historical average but only uses the most recent density model. As the learned exploratory policy should correspond to an historical average exploration for the downstream task is achieved by sampling one of the learned policy at the beginning of each roll-out. The historical averaging also benefits prior exploration methods. Notably, the appendix also describes a modification that learns a mixture of policies in each iteration where a discriminator approximates the responsibilities for each component which is used as additional reward to divide the search space among the components. SMM is compared to prior exploration methods, ICM and Pseudo-Counts and standard SAC, on a simulated robotic box-pushing task and against SAC on simulated point-mass problem and a real-robot valve turning task. Significance: Efficient exploration is arguably the main challenge of reinforcement learning as providing shaped reward functions is difficult even for experts and may lead to undesired behavior. I think that maximizing the state-entropy (or matching target state-distributions if available) is a sound objective for learning exploratory policies and the paper could, thus, be of relatively broad interest. Novelty: Maximizing the state entropy for exploration has already been used by (Hazan et al., 2018, reference from manuscript). However, in contrast to this prior work, SSM does not need to learn oracles that predict optimal state-distributions/policies for any given policies/reward functions. While distribution matching is a common approach to imitation learning, it has been little employed for manually specified distributions. Still, a similar objective has been used to replace reward functions by desired distributions in a RL-like setting [1] (not for exploration). However, their approach is quite restricted by assuming Gaussian target distributions. Soundness: If I understand correctly, fictitious play assumes optimal responses to understand that the state distribution would often be more important than provably converge to a Nash equilibrium. The paper fails to provide stopping criteria for the optimization steps of the individual players; however, I assume that only few gradient steps are used for practical reasons. Hence, I am not sure whether the actual algorithm can be justified by the theory. The paper mentions that VAEs are used to model the state distribution. Given that VAEs are not likelihood-based, I do not understand how the reward term log(q(s)) can be computed. Clarity: The paper is well-written and the structure seems fine. I think that the density estimation should be better discussed. Models of the state distribution of the policy are often highly desirable, not only for optimizing its entropy, but also, for example, for importance sampling. However, modeling the state distribution is also inherently difficult--especially for large state spaces. Experiments: I like that the paper uses a real robot experiment and the ablations with respect to the historical averaging are interesting. Unfortunately, the paper only compares to standard SAC on the hallway task and on the real robot task. I would not consider the entropy regularization of SAC a proper baseline for a proposed exploration technique. Questions: Is the same extrinsic reward, i.e. log(p*), also provided to the other exploration methods? Some imitation learning methods such as GAIL are also able to match desired state-distributions. I think that these methods could be in principle also applied to the setting considered in the manuscript by using samples from the desired distribution as demonstrations. The paper briefly mentions that IRL methods are not applicable because they require access to trajectories, however, the discriminator of GAIL is only trained on individual state samples. I also do not see a problem of providing unachievable demonstrations to such imitation learning methods because, such like SS?M, they would try to minimize the divergence. I think that GAIL would actually be an important baseline for the proposed method. How does the method scale with the dimensions of the state? SSM has only be evaluated on relatively low-dimensional problems (compared to some rllab/mujoco tasks with >100 states). I would assume that obtaining meaningful density estimates in such settings might be problematic. May imitation learning methods based on discriminators actually be more promising? SMM only considers matching state distributions. If I understand correctly, the approach could be easily generalized to state-action distributions, correct? Wouldn*t it make sense for some tasks to also explore in the action space? Decision: I like the paper in general. The optimization problem seems well-motivated and the algorithm seems reasonable fine. I also like that the paper includes a real robot experiment. However, I am not convinced by the derivation of SMM based on fictitous play and I think that it should be better evaluated with respect to existing exploration methods and also with respect to imitation learning methods. I am therefore slightly leaning towards rejection, currently. Typo: *Note[sic] only does SMM explore a wider range of angles than SAC, but its ability to explore increasing[sic] throughout training, suggesting that the SMM objective is correlated with real-world metrics of exploration.* [1] Arenz, Oleg, Hany Abdulsamad, and Gerhard Neumann. *Optimal control and inverse optimal control by distribution matching.* 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2016.