Year: 2019

Abstract:
We study the problem of representation learning in goal-conditioned hierarchical reinforcement learning. In such hierarchical structures, a higher-level controller solves tasks by iteratively communicating goals which a lower-level policy is trained to reach. Accordingly, the choice of representation – the mapping of observation space to goal space – is crucial. To study this problem, we develop a notion of sub-optimality of a representation, defined in terms of expected reward of the optimal hierarchical policy using this representation. We derive expressions which bound the sub-optimality and show how these expressions can be translated to representation learning objectives which may be optimized in practice. Results on a number of difficult continuous-control tasks show that our approach to representation learning yields qualitatively better representations as well as quantitatively better hierarchical policies, compared to existing methods.12

heading: 1 INTRODUCTION
text: Hierarchical reinforcement learning has long held the promise of extending the successes of existing reinforcement learning (RL) methods (Gu et al., 2017; Schulman et al., 2015; Lillicrap et al., 2015) to more complex, difficult, and temporally extended tasks (Parr & Russell, 1998; Sutton et al., 1999; Barto & Mahadevan, 2003). Recently, goal-conditioned hierarchical designs, in which higher-level policies communicate goals to lower-levels and lower-level policies are rewarded for reaching states (i.e. observations) which are close to these desired goals, have emerged as an effective paradigm for hierarchical RL (Nachum et al. (2018); Levy et al. (2017); Vezhnevets et al. (2017), inspired by earlier work Dayan & Hinton (1993); Schmidhuber & Wahnsiedler (1993)). In this hierarchical design, representation learning is crucial; that is, a representation function must be chosen mapping state observations to an abstract space. Goals (desired states) are then specified by the choice of a point in this abstract space.
Previous works have largely studied two ways to choose the representation: learning the representation end-to-end together with the higher- and lower-level policies (Vezhnevets et al., 2017), or using the state space as-is for the goal space (i.e., the goal space is a subspace of the state space) (Nachum et al., 2018; Levy et al., 2017). The former approach is appealing, but in practice often produces poor results (see Nachum et al. (2018) and our own experiments), since the resulting representation is under-defined; i.e., not all possible sub-tasks are expressible as goals in the space. On the other hand, fixing the representation to be the full state means that no information is lost, but this choice is difficult to scale to higher dimensions. For example, if the state observations are entire images, the higher-level must output target images for the lower-level, which can be very difficult.
We instead study how unsupervised objectives can be used to train a representation that is more concise than the full state, but also not as under-determined as in the end-to-end approach. In order to do so in a principled manner, we propose a measure of sub-optimality of a given representation. This measure aims to answer the question: How much does using the learned representation in place of the full representation cause us to lose, in terms of expected reward, against the optimal policy? This question is important, because a useful representation will compress the state, hopefully making ∗Also at UC Berkeley. 1See videos at https://sites.google.com/view/representation-hrl 2Find open-source code at https://github.com/tensorflow/models/tree/master/ research/efficient-hrl
the learning problem easier. At the same time, the compression might cause the representation to lose information, making the optimal policy impossible to express. It is therefore critical to understand how lossy a learned representation is, not in terms of reconstruction, but in terms of the ability to represent near-optimal policies on top of this representation.
Our main theoretical result shows that, for a particular choice of representation learning objective, we can learn representations for which the return of the hierarchical policy approaches the return of the optimal policy within a bounded error. This suggests that, if the representation is learned with a principled objective, the ‘lossy-ness’ in the resulting representation should not cause a decrease in overall task performance. We then formulate a representation learning approach that optimizes this bound. We further extend our result to the case of temporal abstraction, where the higher-level controller only chooses new goals at fixed time intervals. To our knowledge, this is the first result showing that hierarchical goal-setting policies with learned representations and temporal abstraction can achieve bounded sub-optimality against the optimal policy. We further observe that the representation learning objective suggested by our theoretical result closely resembles several other recently proposed objectives based on mutual information (van den Oord et al., 2018; Ishmael Belghazi et al., 2018; Hjelm et al., 2018), suggesting an intriguing connection between mutual information and goal representations for hierarchical RL. Results on a number of difficult continuous-control navigation tasks show that our principled representation learning objective yields good qualitative and quantitative performance compared to existing methods.

heading: 2 FRAMEWORK
text: Following previous work (Nachum et al., 2018), we consider a two-level hierarchical policy on an MDP M = (S,A,R, T ), in which the higher-level policy modulates the behavior of a lowerlevel policy by choosing a desired goal state and rewarding the lower-level policy for reaching this state. While prior work has used a sub-space of the state space as goals (Nachum et al., 2018), in more general settings, some type of state representation is necessary. That is, consider a state representation function f : S → Rd. A two-level hierarchical policy on M is composed of a higher-level policy πhi(g|s), where g ∈ G = Rd is the goal space, that samples a high-level action (or goal) gt ∼ πhi(g|st) every c steps, for fixed c. A non-stationary, goal-conditioned, lower-level policy πlo(a|st, gt, st+k, k) then translates these high-level actions into low-level actions at+k ∈ A for k ∈ [0, c − 1]. The process is then repeated, beginning with the higher-level policy selecting another goal according to st+c. The policy πlo is trained using a goal-conditioned reward; e.g. the reward of a transition g, s, s′ is −D(f(s′), g), where D is a distance function.
In this work we adopt a slightly different interpretation of the lower-level policy and its relation to πhi. Every c steps, the higher-level policy chooses a goal gt based on a state st. We interpret this state-goal pair as being mapped to a nonstationary policy π(a|st+k, k), π ∈ Π, where Π denotes the set of all possible c-step policies acting on M. We use Ψ to denote this mapping from S × G to Π. In other words, on every cth step, we encounter some state st ∈ S. We use the higher-level policy to sample a goal
gt ∼ πhi(g|st) and translate this to a policy πt = Ψ(st, gt). We then use πt to sample actions at+k ∼ πt(a|st+k, k) for k ∈ [0, c− 1]. The process is then repeated from st+c. Although the difference in this interpretation is subtle, the introduction of Ψ is crucial for our subsequent analysis. The communication of gt is no longer as a goal which πhi desires to reach, but rather more precisely, as an identifier to a low-level behavior which πhi desires to induce or activate.
The mapping Ψ is usually expressed as the result of an RL optimization over Π; e.g.,
Ψ(st, g) = arg max π∈Π c∑ k=1 γk−1EPπ(st+k|st)[−D(f(st+k), g)], (1)
where we use Pπ(st+k|st) to denote the probability of being in state st+k after following π for k steps starting from st. We will consider variations on this low-level objective in later sections. From Equation 1 it is clear how the choice of representation f affects Ψ (albeit indirectly).
We will restrict the environment reward function R to be defined only on states. We use Rmax to denote the maximal absolute reward: Rmax = supS |R(s)|.

heading: 3 HIERARCHICAL POLICY SUB-OPTIMALITY
text: In the previous section, we introduced two-level policies where a higher-level policy πhi chooses goals g, which are translated to lower-level behaviors via Ψ. The introduction of this hierarchy leads to a natural question: How much do we lose by learning πhi which is only able to act on M via Ψ? The choice of Ψ restricts the type and number of lower-level behaviors that the higher-level policy can induce. Thus, the optimal policy onM is potentially not expressible by πhi. Despite the potential lossy-ness of Ψ, can one still learn a hierarchical policy which is near-optimal?
To approach this question, we introduce a notion of sub-optimality with respect to the form of Ψ: Let π∗hi(g|s,Ψ) be the optimal higher-level policy acting onG and using Ψ as the mapping fromG to low-level behaviors. Let π∗hier be the corresponding full hierarchical policy onM. We will compare π∗hier to an optimal hierarchical policy π
∗ agnostic to Ψ. To define π∗ we begin by introducing an optimal higher-level policy π∗∗hi (π|s) agnostic to Ψ; i.e. every c steps, π∗∗hi samples a low-level behavior π ∈ Π which is applied toM for the following c steps. In this way, π∗∗hi may express all possible low-level behaviors. We then denote π∗ as the full hierarchical policy resulting from π∗∗hi .
We would like to compare π∗hier to π ∗. A natural and common way to do so is in terms of state values. Let V π(s) be the future value achieved by a policy π starting at state s. We define the sub-optimality of Ψ as
SubOpt(Ψ) = sup s∈S
V π ∗ (s)− V π ∗ hier(s). (2)
The state values V π ∗ hier(s) are determined by the form of Ψ, which is in turn determined by the choice of representation f . However, none of these relationships are direct. It is unclear how a change in f will result in a change to the sub-optimality. In the following section, we derive a series of bounds which establish a more direct relationship between SubOpt(Ψ) and f . Our main result will show that if one defines Ψ as a slight modification of the traditional objective given in Equation 1, then one may translate sub-optimality of Ψ to a practical representation learning objective for f .

heading: 4 GOOD REPRESENTATIONS LEAD TO BOUNDED SUB-OPTIMALITY
text: In this section, we provide proxy expressions that bound the sub-optimality induced by a specific choice of Ψ. Our main result is Claim 4, which connects the sub-optimality of Ψ to both goalconditioned policy objectives (i.e., the objective in 1) and representation learning (i.e., an objective for the function f ).
4.1 SINGLE-STEPS (c = 1) AND DETERMINISTIC POLICIES
For ease of presentation, we begin by presenting our results in the restricted case of c = 1 and deterministic lower-level policies. In this setting, the class of low-level policies Π may be taken to be simply A, where a ∈ Π corresponds to a policy which always chooses action a. There is no temporal abstraction: The higher-level policy chooses a high-level action g ∈ G at every step, which is translated via Ψ to a low-level action a ∈ A. Our claims are based on quantifying how many of the possible low-level behaviors (i.e., all possible state to state transitions) can be produced by Ψ for different choices of g. To quantify this, we make use of an auxiliary inverse goal model ϕ(s, a), which aims to predict which goal g will cause Ψ to yield an action ã = Ψ(s, g) that induces a next state distribution P (s′|s, ã) similar to P (s′|s, a).3 We have the following theorem, which bounds the sub-optimality in terms of total variation divergences between P (s′|s, a) and P (s′|s, ã): Theorem 1. If there exists ϕ : S ×A→ G such that,
sup s∈S,a∈A
DTV(P (s ′|s, a)||P (s′|s,Ψ(s, ϕ(s, a)))) ≤ , (3)
then SubOpt(Ψ) ≤ C , where C = 2γ(1−γ)2Rmax.
3In a deterministic, c = 1 setting, ϕmay be seen as a state-conditioned action abstraction mappingA→ G.
Proof. See Appendices A and B for all proofs.
Theorem 1 allows us to bound the sub-optimality of Ψ in terms of how recoverable the effect of any action in A is, in terms of transition to the next state. One way to ensure that effects of actions in A are recoverable is to have an invertible Ψ. That is, if there exists ϕ : S × A → G such that Ψ(s, ϕ(s, a)) = a for all s, a, then the sub-optimality of Ψ is 0.
However, in many cases it may not be desirable or feasible to have an invertible Ψ. Looking back at Theorem 1, we emphasize that its statement requires only the effect of any action to be recoverable. That is, for any s,∈ S, a ∈ A, we require only that there exist some g ∈ G (given by ϕ(s, a)) which yields a similar next-state distribution. To this end, we have the following claim, which connects the sub-optimality of Ψ to both representation learning and the form of the low-level objective.
Claim 2. Let ρ(s) be a prior and f, ϕ be so that, for K(s′|s, a) ∝ ρ(s′) exp(−D(f(s′), ϕ(s, a))),4
sup s∈S,a∈A
DKL(P (s ′|s, a)||K(s′|s, a)) ≤ 2/8. (4)

heading: If the low-level objective is defined as
text: Ψ(s, g) = arg max a∈A
EP (s′|s,a)[−D(f(s′), g) + log ρ(s′)− logP (s′|s, a)], (5)
then the sub-optimality of Ψ is bounded by C .
We provide an intuitive explanation of the statement of Claim 2. First, consider that the distribution K(s′|s, a) appearing in Equation 4 may be interpreted as a dynamics model determined by f and ϕ. By bounding the difference between the true dynamics P (s′|s, a) and the dynamics K(s′|s, a) implied by f and ϕ, Equation 4 states that the representation f should be chosen in such a way that dynamics in representation space are roughly given by ϕ(s, a). This is essentially a representation learning objective for choosing f , and in Section 5 we describe how to optimize it in practice.
Moving on to Equation 5, we note that the form of Ψ here is only slightly different than the onestep form of the standard goal-conditioned objective in Equation 1.5 Therefore, all together Claim 2 establishes a deep connection between representation learning (Equation 4), goal-conditioned policy learning (Equation 5), and sub-optimality.
4.2 TEMPORAL ABSTRACTION (c ≥ 1) AND GENERAL POLICIES We now move on to presenting the same results in the fully general, temporally abstracted setting, in which the higher-level policy chooses a high-level action g ∈ G every c steps, which is transformed via Ψ to a c-step lower-level behavior policy π ∈ Π. In this setting, the auxiliary inverse goal model ϕ(s, π) is a mapping from S × Π to G and aims to predict which goal g will cause Ψ to yield a policy π̃ = Ψ(s, g) that induces future state distributions Pπ̃(st+k|st) similar to Pπ(st+k|st), for k ∈ [1, c]. We weight the divergences between the distributions by weights wk = 1 for k < c and wk = (1 − γ)−1 for k = c. We denote w = ∑c k=1 γ
k−1wk. The analogue to Theorem 1 is as follows:
Theorem 3. Consider a mapping ϕ : S ×Π→ G and define k : S ×Π→ R for k ∈ [1, c] as,
k(st, π) = DTV(Pπ(st+k|st)||PΨ(st,ϕ(st,π))(st+k|st)). (6)
If
sup st∈S,π∈Π
1
w c∑ k=1 γk−1wk k(st, π) ≤ , (7)
then SubOpt(Ψ) ≤ C , where C = 2γ1−γcRmaxw.
For the analogue to Claim 2, we simply replace the single-step KL divergences and low-level rewards with a discounted weighted sum thereof:
4K may be interpreted as the conditional P (state = s′|repr = ϕ(s, a)) of the joint distribution P (state = s′)P (repr = z|state = s′) = ρ(s′) exp(−D(f(s′), z))/Z for normalization constant Z.
5As evident in the proof of this Claim (see Appendix), the form of Equation 5 is specifically designed so that it corresponds to a KL between P (s′|s, a) and a distribution U(s′|s, g) ∝ ρ(s′) exp(−D(f(s′), g)).
Claim 4. Let ρ(s) be a prior over S. Let f, ϕ be such that,
sup st∈S,π∈Π
1
w c∑ k=1 γk−1wkDKL(Pπ(st+k|st)||K(st+k|st, π)) ≤ 2/8, (8)
where K(st+k|st, π) ∝ ρ(st+k) exp(−D(f(st+k), ϕ(st, π))).

heading: If the low-level objective is defined as
text: Ψ(st, g) = arg max π∈Π c∑ k=1 γk−1wkEPπ(st+k|st)[−D(f(st+k), g)+log ρ(st+k)−logPπ(st+k|st)], (9)
then the sub-optimality of Ψ is bounded by C .
Claim 4 is the main theoretical contribution of our work. As in the previous claim, we have a strong statement, saying that if the low-level objective is defined as in Equation 9, then minimizing the sub-optimality may be done by optimizing a representation learning objective based on Equation 8. We emphasize that Claim 4 applies to any class of low-level policies Π, including either closed-loop or open-loop policies.

heading: 5 LEARNING
text: We now have the mathematical foundations necessary to learn representations that are provably good for use in hierarchical RL. We begin by elaborating on how we translate Equation 8 into a practical training objective for f and auxiliary ϕ (as well as a practical parameterization of policies π as input to ϕ). We then continue to describe how one may train a lower-level policy to match the objective presented in Equation 9. In this way, we may learn f and lower-level policy to directly optimize a bound on the sub-optimality of Ψ. A pseudocode of the full algorithm is presented in the Appendix (see Algorithm 1).

heading: 5.1 LEARNING GOOD REPRESENTATIONS
text: Consider a representation function fθ : S → Rd and an auxiliary function ϕθ : S × Π → Rd, parameterized by vector θ. In practice, these are separate neural networks: fθ1 , ϕθ2 , θ = [θ1, θ2].
While the form of Equation 8 suggests to optimize a supremum over all st and π, in practice we only have access to a replay buffer which stores experience s0, a0, s1, a1, . . . sampled from our hierarchical behavior policy. Therefore, we propose to choose st sampled uniformly from the replay buffer and use the subsequent c actions at:t+c−1 as a representation of the policy π, where we use at:t+c−1 to denote the sequence at, . . . , at+c−1. Note that this is equivalent to setting the set of candidate policies Π toAc (i.e., Π is the set of c-step, deterministic, open-loop policies). This choice additionally simplifies the possible structure of the function approximator used for ϕθ (a standard neural net which takes in st and at:t+c−1). Our proposed representation learning objective is thus,
J(θ) = Est,at:t+c−1∼replay[J(θ, st, at:t+c−1)], (10) where J(θ, st, at:t+c−1) will correspond to the inner part of the supremum in Equation 8.
We now define the inner objective J(θ, st, at:t+c−1). To simplify notation, we use Eθ(s′, s, π) = exp(−D(fθ(s′), ϕθ(s, π))) and use Kθ(s′|s, π) as the distribution over S such that Kθ(s′|s, π) ∝ ρ(s′)Eθ(s ′, s, π). Equation 8 suggests the following learning objective on each st, π ≡ at:t+c−1:
J(θ, st, π) = c∑ k=1 γk−1wkDKL(Pπ(st+k|st)||Kθ(st+k|st, π)) (11)
= B + c∑ k=1 −γk−1wkEPπ(st+k|st) [logKθ(st+k|st, π)] (12)
= B + c∑ k=1 −γk−1wkEPπ(st+k|st) [logEθ(st+k, st, π)] + γ k−1wk logEs̃∼ρ [Eθ(s̃, st, π)] , (13)
where B is a constant. The gradient with respect to θ is then, c∑
k=1
−γk−1wkEPπ(st+k|st) [∇θ logEθ(st+k, st, π)] + γ k−1wk Es̃∼ρ [∇θEθ(s̃, st, π)] Es̃∼ρ [Eθ(s̃, st, π)]
(14)
The first term of Equation 14 is straightforward to estimate using experienced st+1:t+k. We set ρ to be the replay buffer distribution, so that the numerator of the second term is also straightforward. We approximate the denominator of the second term using a mini-batch S̃ of states independently sampled from the replay buffer:
Es̃∼ρ [Eθ(s̃, st, π)] ≈ |S̃|−1 ∑ s̃∈S̃ Eθ(s̃, st, π). (15)
This completes the description of our representation learning algorithm.
Connection to Mutual Information Estimators. The form of the objective we optimize (i.e. Equation 13) is very similar to mutual information estimators, mostly CPC (van den Oord et al., 2018). Indeed, one may interpret our objective as maximizing a mutual informationMI(st+k; st, π) via an energy function given by Eθ(st+k, st, π). The main differences between our approach and these previous proposals are as follows: (1) Previous approaches maximize a mutual information MI(st+k; st) agnostic to actions or policy. (2) Previous approaches suggest to define the energy function as exp(f(st+k)TMkf(st)) for some matrix Mk, whereas our energy function is based on the distance D used for low-level reward. (3) Our approach is provably good for use in hierarchical RL, and hence our theoretical results may justify some of the good performance observed by others using mutual information estimators for representation learning. Different approaches to translating our theoretical findings to practical implementations may yield objectives more or less similar to CPC, some of which perform better than others (see Appendix D).

heading: 5.2 LEARNING A LOWER-LEVEL POLICY
text: Equation 9 suggests to optimize a policy πst,g(a|st+k, k) for every st, g. This is equivalent to the parameterization πlo(a|st, g, st+k, k), which is standard in goal-conditioned hierarchical designs. Standard RL algorithms may be employed to maximize the low-level reward implied by Equation 9:
−D(f(st+k), g) + log ρ(st+k)− logPπ(st+k|st), (16)
weighted bywk and where π corresponds to πlo when the state st and goal g are fixed. While the first term of Equation 16 is straightforward to compute, the log probabilities log ρ(st+k), logPπ(st+k|st) are in general unknown. To approach this issue, we take advantage of the representation learning objective for f, ϕ. When f, ϕ are optimized as dictated by Equation 8, we have
logPπ(st+k|st) ≈ log ρ(st+k)−D(f(st+k), ϕ(st, π))− logEs̃∼ρ[E(s̃, st, π)]. (17)
We may therefore approximate the low-level reward as
−D(f(st+k), g) +D(f(st+k), ϕ(st, π)) + logEs̃∼ρ[E(s̃, st, π)]. (18)
As in Section 5.1, we use the sampled actions at:t+c−1 to represent π as input to ϕ. We approximate the third term of Equation 18 analogously to Equation 15. Note that this is a slight difference from standard low-level rewards, which use only the first term of Equation 18 and are unweighted.

heading: 6 RELATED WORK
text: Representation learning for RL has a rich and diverse existing literature, often interpreted as an abstraction of the original MDP. Previous works have interpreted the hierarchy introduced in hierarchical RL as an MDP abstraction of state, action, and temporal spaces (Sutton et al., 1999; Dietterich, 2000; Thomas & Barto, 2012; Bacon et al., 2017). In goal-conditioned hierarchical designs, although the representation is learned on states, it is in fact a form of action abstraction (since goals g are high-level actions). While previous successful applications of goal-conditioned hierarchical designs have either learned representations naively end-to-end (Vezhnevets et al., 2017), or not learned them at all (Levy et al., 2017; Nachum et al., 2018), we take a principled approach to representation learning in hierarchical RL, translating a bound on sub-optimality to a practical learning objective.
Bounding sub-optimality in abstracted MDPs has a long history, from early work in theoretical analysis on approximations to dynamic programming models (Whitt, 1978; Bertsekas & Castanon, 1989). Extensive theoretical work on state abstraction, also known as state aggregation or model minimization, has been done in both operational research (Rogers et al., 1991; Van Roy, 2006) and RL (Dean & Givan, 1997; Ravindran & Barto, 2002; Abel et al., 2017). Notably, Li et al. (2006)
introduce a formalism for categorizing classic work on state abstractions such as bisimulation (Dean & Givan, 1997) and homomorphism (Ravindran & Barto, 2002) based on what information is preserved, which is similar in spirit to our approach. Exact state abstractions (Li et al., 2006) incur no performance loss (Dean & Givan, 1997; Ravindran & Barto, 2002), while their approximate variants generally have bounded sub-optimality (Bertsekas & Castanon, 1989; Dean & Givan, 1997; Sorg & Singh, 2009; Abel et al., 2017). While some of the prior work also focuses on learning state abstractions (Li et al., 2006; Sorg & Singh, 2009; Abel et al., 2017), they often exclusively apply to simple MDP domains as they rely on techniques such as state partitioning or Q-value based aggregation, which are difficult to scale to our experimented domains. Thus, the key differentiation of our work from these prior works is that we derive bounds which may be translated to practical representation learning objectives. Our impressive results on difficult continuous-control, high-dimensional domains is a testament to the potential impact of our theoretical findings.
Lastly, we note the similarity of our representation learning algorithm to recently introduced scalable mutual information maximization objectives such as CPC (van den Oord et al., 2018) and MINE (Ishmael Belghazi et al., 2018). This is not a surprise, since maximizing mutual information relates closely with maximum likelihood learning of energy-based models, and our bounds effectively correspond to bounds based on model-based predictive errors, a basic family of bounds in representation learning in MDPs (Sorg & Singh, 2009; Brunskill & Li, 2014; Abel et al., 2017). Although similar information theoretic measures have been used previously for exploration in RL (Still & Precup, 2012), to our knowledge, no prior work has connected these mutual information estimators to representation learning in hierarchical RL, and ours is the first to formulate theoretical guarantees on sub-optimality of the resulting representations in such a framework.

heading: 7 EXPERIMENTS
text: We evaluate our proposed representation learning objective compared to a number of baselines:
We evaluate on the following continuous-control MuJoCo (Todorov et al., 2012) tasks (see Appendix C for details):
• Ant (or Point) Maze: An ant (or point mass) must navigate a ⊃-shaped corridor. • Ant Push: An ant must push a large block to the side to reach a point behind it. • Ant Fall: An ant must push a large block into a chasm so that it may walk over it to the
other side without falling.
• Ant Block: An ant must push a small block to various locations in a square room. • Ant Block Maze: An ant must push a small block through a ⊃-shaped corridor.
In these tasks, the raw observation is the agent’s x, y coordinates and orientation as well as local coordinates and orientations of its limbs. In the Ant Block and Ant Block Maze environments we also include the x, y coordinates and orientation of the block. We also experiment with more difficult raw representations by replacing the x, y coordinates of the agent with a low-resolution 5 × 5 × 3 top-down image of the agent and its surroundings. These experiments are labeled ‘Images’.
For the baseline representation learning methods which are agnostic to the RL training (VAE and E2C), we provide comparative qualitative results in Figure 2. These representations are the result
Ant and block Ant pushing small block through corridor Representations
of taking a trained policy, fixing it, and using its sampled experience to learn 2D representations of the raw observations. We find that our method can successfully deduce the underlying near-optimal x, y representation, even when the raw observation is given as an image.
We provide quantitative results in Figure 3. In these experiments, the representation is learned concurrently while learning a full hierarchical policy (according to the procedure in Nachum et al. (2018)). Therefore, this setting is especially difficult since the representation learning must learn good representations even when the behavior policy is very far from optimal. Accordingly, we find that most baseline methods completely fail to make any progress. Only our proposed method is able to approach the performance of the XY oracle.
For the ‘Block’ environments, we were curious what our representation learning objective would learn, since the x, y coordinate of the agent is not the only near-optimal representation. For example, another suitable representation is the x, y coordinates of the small block. To investigate this, we plotted (Figure 4) the trajectory of the learned representations of a successful policy (cyan), along with the representations of the same observations with agent x, y perturbed (green) or with block x, y perturbed (magenta). We find that the learned representations greatly emphasize the block x, y coordinates over the agent x, y coordinates, although in the beginning of the episode, there is a healthy mix of the two.

heading: 8 CONCLUSION
text: We have presented a principled approach to representation learning in hierarchical RL. Our approach is motivated by the desire to achieve maximum possible return, hence our notion of sub-optimality is in terms of optimal state values. Although this notion of sub-optimality is intractable to optimize directly, we are able to derive a mathematical relationship between it and a specific form of representation learning. Our resulting representation learning objective is practical and achieves impressive results on a suite of high-dimensional, continuous-control tasks.

heading: ACKNOWLEDGMENTS
text: We thank Bo Dai, Luke Metz, and others on the Google Brain team for insightful comments and discussions.

heading: A PROOF OF THEOREM 3 (GENERALIZATION OF THEOREM 1)
text: Consider the sub-optimality with respect to a specific state s0, V π ∗ (s0) − V π ∗ hier(s0). Recall that π∗ is the hierarchical result of a policy π∗∗hi : S → ∆(Π), and note that π∗∗hi may be assumed to be deterministic due to the Markovian nature ofM. We may use the mapping ϕ to transform π∗∗hi to a high-level policy πhi on G and using the mapping Ψ:
g ∼ πhi(−|s) ≡ π ∼ π∗∗hi (−|s), g := ϕ(s, π). (19)
Let πhier be the corresponding hierarchical policy. We will bound the quantity V π ∗ (s0)−V πhier(s0), which will bound V π ∗ (s0)− V π ∗ hier(s0). We follow logic similar to Achiam et al. (2017) and begin by bounding the total variation divergence between the γ-discounted state visitation frequencies of the two policies.
Denote the k-step state transition distributions using either π∗ or πhier as,
P k∗ (s ′|s) = Pπ∗∗hi (s)(st+k = s ′|st = s), (20)
P khier(s ′|s) = PΨ(s,πhi(s))(st+k = s ′|st = s), (21)
for k ∈ [1, c]. Considering P∗, Phier as linear operators, we may express the state visitation frequencies d∗, dhier of π∗, πhier, respectively, as
d∗ = (1− γ)A∗(I − γcP c∗ )−1µ, (22) dhier = (1− γ)Ahier(I − γcP chier)−1µ, (23)
where µ is a Dirac δ distribution centered at s0 and
A∗ = I + c−1∑ k=1 γkP k∗ , (24)
Ahier = I + c−1∑ k=1 γkP khier. (25)
We will use dc∗, d c hier to denote the every-c-steps γ-discounted state frequencies of π ∗, πhier; i.e.,
dc∗ = (1− γc)(I − γcP c∗ )−1µ, (26) dchier = (1− γc)(I − γcP chier)−1µ. (27)
By the triangle inequality, we have the following bound on the total variation divergence |dhier−d∗|:
|dhier − d∗| ≤ (1− γ)|Ahier(I − γcP chier)−1µ−Ahier(I − γcP c∗ )−1µ| + (1− γ)|Ahier(I − γcP c∗ )−1µ−A∗(I − γcP c∗ )−1µ|. (28)
We begin by attacking the first term of Equation 28. We note that
|Ahier| ≤ |I|+ c−1∑ k=1 γk|P khier| = 1− γc 1− γ . (29)
Thus the first term of Equation 28 is bounded by
(1− γc)|(I − γcP chier)−1µ− (I − γcP c∗ )−1µ| = (1− γc)|(I − γcP chier)−1((I − γcP c∗ )− (I − γcP chier))(I − γcP c∗ )−1µ|
= γc|(I − γcP chier)−1(P chier − P c∗ )dc∗|. (30)
By expressing (I − γcP chier)−1 as a geometric series and employing the triangle inequality, we have |(I − γcP chier)−1| ≤ (1− γc)−1, and we thus bound the whole quantity (30) by
γc(1− γc)−1|(P chier − P c∗ )dc∗|. (31)
We now move to attack the second term of Equation 28. We may express this term as
(1− γ)(1− γc)−1|(Ahier −A∗)dc∗|. (32)
Furthermore, by the triangle inequality we have
|(Ahier −A∗)dc∗| ≤ c−1∑ k=1 γk|(P khier − P k∗ )dc∗|. (33)
Therefore, recalling wk = 1 for k < c and wk = (1 − γ)−1 for k = c, we may bound the total variation of the state visitation frequencies as
|dhier − d∗| ≤ γ(1− γ)(1− γc)−1 c∑
k=1
γk−1wk|(P khier − P k∗ )dc∗| (34)
= 2γ(1− γ)(1− γc)−1 c∑
k=1
γk−1wkEs∼dc∗ [DTV(P k ∗ (s ′|s)||P khier(s′|s))] (35)
= 2γ(1− γ)(1− γc)−1Es∼dc∗
[ c∑
k=1
γk−1wkDTV(P k ∗ (s ′|s)||P khier(s′|s))
] . (36)
By condition 7 of Theorem 3 we have,
|dhier − d∗| ≤ 2γ(1− γ)(1− γc)−1w (37)
We now move to considering the difference in values. We have
V π ∗ (s0) = (1− γ)−1 ∫ S d∗(s)R(s) ds, (38)
V πhier(s0) = (1− γ)−1 ∫ S dhier(s)R(s) ds. (39)
Therefore, we have
|V π ∗ (s0)− V πhier(s0)| ≤ (1− γ)−1Rmax|dhier − d∗| (40)
≤ 2γ 1− γc Rmaxw , (41)
as desired.

heading: B PROOF OF CLAIM 4 (GENERALIZATION OF CLAIM 2)
text: Consider a specific st, π. Let K(s′|st, π) ∝ ρ(s′) exp(−D(f(s′), ϕ(st, π))). Note that the definition of Ψ(st, ϕ(st, π)) may be expressed in terms of a KL:
Ψ(st, ϕ(st, π)) = arg min π′∈Π
1
w c∑ k=1 γk−1wkDKL(Pπ′(st+k|st)||K(st+k|st, π)). (42)
Therefore we have,
1
w c∑ k=1 γk−1wkDKL(PΨ(st,ϕ(st,π))(st+k|st)||K(st+k|st, π))
≤ 1 w c∑ k=1 γk−1wkDKL(Pπ(st+k|st)||K(st+k|st, π)). (43)
By condition 8 we have,
1
w c∑ k=1 γk−1wkDKL(Pπ(st+k|st)||K(st+k|st, π)) ≤ 2/8. (44)
Jensen’s inequality on the sqrt function then implies
1
w c∑ k=1 γk−1wk √ 2DKL(Pπ(st+k|st)||K(st+k|st, π)) ≤ /2. (45)
Pinsker’s inequality now yields,
1
w c∑ k=1 γk−1wkDTV(Pπ(st+k|st)||K(st+k|st, π)) ≤ /2. (46)
Similarly Jensen’s and Pinsker’s inequality on the LHS of Equation 43 yields
1
w c∑ k=1 γk−1wkDTV(PΨ(st,ϕ(st,π))(st+k|st)||K(st+k|st, π)) ≤ /2. (47)
The triangle inequality and Equations 46 and 47 then give us,
1
w c∑ k=1 γk−1wkDTV(Pπ(st+k|st)||PΨ(s,ϕ(s,π))(st+k|st))
≤ 1 w c∑ k=1 γk−1wk ( DTV(Pπ(st+k|st)||K(st+k|st, π)) +DTV(PΨ(st,ϕ(st,π))(st+k|st)||K(st+k|st, π)) ) ≤ , (48)
as desired.

heading: C EXPERIMENTAL DETAILS
text: C.1 ENVIRONMENTS
The environments for Ant Maze, Ant Push, and Ant Fall are as described in Nachum et al. (2018). During training, target (x, y) locations are selected randomly from all possible points in the environment (in Ant Fall, the target includes a z coordinate as well). Final results are evaluated on a single difficult target point, equal to that used in Nachum et al. (2018).
The Point Maze is equivalent to the Ant Maze, with size scaled down by a factor of 2 and the agent replaced with a point mass, which is controlled by actions of dimension two – one action determines a rotation on the pivot of the point mass and the other action determines a push or pull on the point mass in the direction of the pivot.
For the ‘Images’ versions of these environments, we zero-out the x, y coordinates in the observation and append a low-resolution 5× 5× 3 top-down view of the environment. The view is centered on the agent and each pixel covers the size of a large block (size equal to width of the corridor in Ant Maze). The 3 channels correspond to (1) immovable blocks (walls, gray in the videos), (2) movable blocks (shown in red in videos), and (3) chasms where the agent may fall.
The Ant Block environment puts the ant in a 16 × 16 square room next to a 0.8 × 0.8 × 0.4 small movable block. The agent is rewarded based on negative L2 distance of the block to a desired target location. During training, these target locations are sampled randomly from all possible locations. Evaluation is on a target location diagonally opposite the ant.
The Ant Block Maze environment consists of the same ant and small movable block in a ⊃-shaped corridor. During training, these target locations are sampled randomly from all possible locations. Evaluation is on a target location at the end of the corridor.
C.2 TRAINING DETAILS
We follow the basic training details used in Nachum et al. (2018). Some differences are listed below:
• We input the whole observation to the lower-level policy (Nachum et al. (2018) zero-out the x, y coordinates for the lower-level policy).
• We use a Huber function forD, the distance function used to compute the low-level reward.
• We use a goal dimension of size 2. We train the higher-level policy to output actions in [−10, 10]2. These actions correspond to desired deltas in state representation.
• We use a Gaussian with standard deviation 5 for high-level exploration.
• Additional differences in low-level training (e.g. reward weights and discounting) are implemented according to Section 5.
We parameterize fθ with a feed-forward neural network with two hidden layers of dimension 100 using relu activations. The network structure for ϕθ is identical, except using hidden layer dimensions 400 and 300. We also parameterize ϕ(s, π) := fθ(s) + ϕθ(s, π). These networks are trained with the Adam optimizer using learning rate 0.0001.

heading: D OBJECTIVE FUNCTION EVALUATION
text: E β-VAE

heading: G ADDITIONAL QUALITATIVE RESULTS

heading: F GENERALIZATION CAPABILITY

heading: H COMPARISON TO HIRO
text: Algorithm 1 Representation learning for hierarchical RL. Input: Replay buffer D, number of training steps N , batch size B, parameterizations fθ, ϕθ, π φ hi, π φ lo
function EstLogPart(S̃, st, at:t+c−1) ## Equation 15 Return log 1
|S̃|
∑ s̃∈S̃ exp(−D(fθ(s̃), ϕθ(st, at:t+c−1))).
end function
function CompLowReward(g, st, s′, at:t+c−1, L) ## Equation 18 Return −D(fθ(s′), g) +D(fθ(s′), ϕθ(st, at:t+c−1)) + L. end function
function CompReprLoss(st, s′, at:t+c−1, s̃, L) ## Equation 14 Compute attractive term Jatt = D(fθ(s′), ϕθ(st, at:t+c−1)). Compute repulsive term Jrep = exp(−D(fθ(s̃), ϕθ(st, at:t+c−1))− stopgrad(L)). Return Jatt + Jrep. end function
for T = 1 to N do
Sample experience g, s, a, r, s′ and add to replay buffer D (Nachum et al., 2018). Sample batch of c-step transitions {(g(i), s(i)t:t+c, a (i) t:t+c−1, r (i) t:t+c−1)}Bi=1 ∼ D. Sample indices into transition: {k(i)}Bi=1 ∼ [1, c]B . Sample batch of states S̃ = {s̃(i)}Bi=1 ∼ D. Estimate log-partitions {L(i)}Bi=1 = {EstLogPart(S̃, s (i) t , a (i) t:t+c−1)}Bi=1.
// Reinforcement learning Compute low-level rewards {r̃(i)}Bi=1 = {CompLowReward(g(i), s (i) t , s (i) t+k(i) , a (i) t:t+c−1, L
(i))}Bi=1. Update πφlo (Nachum et al., 2018) with experience {(g(i), s (i) t+k(i)−1, a (i) t+k(i)−1, r̃ (i), s (i) t+k(i) )}Bi=1. Update πφhi (Nachum et al., 2018) with experience {(g(i), s (i) t:t+c, a (i) t:t+c−1, r (i) t:t+c−1)}Bi=1.
// Representation learning Compute loss J = 1B ∑B i=1 wk(i)γ k(i)−1CompReprLoss(k(i), s (i) t , s (i) t+k(i) , a (i) t:t+c−1, s̃ (i), L(i)).
Update θ based on ∇θJ .
end for

Review summaries:
The authors proposes a novel approach in learning a representation for HRL. They define the notion of sub-optimality of a representation (a mapping from observation space to goal space) for a goal-conditioned HRL that measure the loss in the value as a result of using a representation. Authors then state an intriguing connection between representation learning and bounding the sub-optimality which results in a gradient based algorithm. 

The paper studies the problem of representation learning in the context of hierarchical reinforcement learning by building on the framework of  HIRO (Nachum et al. (2018)). The papers propose a way to handle sub-optimality in the context of learning representations which basically refers to the overall sub-optimality of the entire hierarchical polity with respect to the task reward. And hence, the only practical different from the HIRO paper is that the proposed method considers representation learning for the goals, while HIRO was directly using the state space.