<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Unsupervised Methods For Subgoal Discovery During Intrinsic Motivation in Model-Free Hierarchical Reinforcement Learning</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Jacob Rafati and David C. Noelle Electrical Engineering and Computer Science Computational Cognititve Neurosceince Laboratory University of California</institution>
          ,
          <addr-line>Merced 5200 North Lake Road, Merced, CA 95343</addr-line>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Common approaches to Reinforcement Learning (RL) are seriously challenged by large-scale applications involving huge state spaces and sparse delayed reward feedback. Hierarchical Reinforcement Learning (HRL) methods attempt to address this scalability issue by learning action selection policies at multiple levels of temporal abstraction. Abstraction can be had by identifying a relatively small set of states that are likely to be useful as subgoals, in concert with the learning of corresponding skill policies to achieve those subgoals. Many approaches to subgoal discovery in HRL depend on the analysis of a model of the environment, but the need to learn such a model introduces its own problems of scale. Once subgoals are identified, skills may be learned through intrinsic motivation, introducing an internal reward signal marking subgoal attainment. In this paper, we present a novel modelfree method for subgoal discovery using incremental unsupervised learning over a small memory of the most recent experiences (trajectories) of the agent. When combined with an intrinsic motivation learning mechanism, this method learns both subgoals and skills, based on experiences in the environment. Thus, we offer an original approach to HRL that does not require the acquisition of a model of the environment, suitable for large-scale applications. We demonstrate the efficiency of our method on two RL problems with sparse delayed feedback: a variant of the rooms environment and the first screen of the ATARI 2600 Montezuma's Revenge game.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The reinforcement learning problem suffers from serious
scaling issues. Hierarchical Reinforcement Learning (HRL)
is an important computational approach intended to tackle
problems of scale by learning to operate over different levels
of temporal abstraction
        <xref ref-type="bibr" rid="ref16">(Sutton, Precup, and Singh 1999)</xref>
        .
The acquisition of hierarchies of reusable skills is one of the
distinguishing characteristics of biological intelligence, and
the learning of such hierarchies is an important open
problem in computational reinforcement learning. Also, in the
context of games, the development of robust HRL methods
will provide a means to acquire relevant knowledge at
multiple levels of abstraction, potentially speeding learning and
supporting generalization.
      </p>
      <p>A number of approaches to HRL have been suggested.
One approach focuses on action sequences, subpolicies, or
“options” that appear repeatedly during the learning of a
set of tasks. Such frequently reused subpolicies can be
abstracted into skills that can be treated as individual actions
at a higher level of abstraction. A somewhat different
approach to temporal abstraction involves identifying a set of
states that make for useful subgoals. This introduces a major
open problem in HRL: that of subgoal discovery.</p>
      <p>
        A variety of researchers have proposed approaches
to identifying useful subpolicies and reifying them as
skills
        <xref ref-type="bibr" rid="ref11 ref17 ref18">(Pickett and Barto 2002; Thrun and Schwartz 1995)</xref>
        .
For example,
        <xref ref-type="bibr" rid="ref16">(Sutton, Precup, and Singh 1999)</xref>
        proposed
the options framework, which involves abstractions over the
space of actions. At each step, the agent chooses either a
one-step “primitive” action or a “multi-step” action policy
(an option). Each option defines a policy over actions
(either primitive or other options) and comes to completion
according to a termination condition. Other researchers have
focused on identifying subgoals — states that are generally
useful to attain — and learning a collection of skills that
allow the agent to efficiently reach those subgoals. Some
approaches to subgoal discovery maintain the value function
in a large look-up table
        <xref ref-type="bibr" rid="ref1 ref16 ref4">(Sutton, Precup, and Singh 1999;
Goel and Huber 2003; S¸ims¸ek, Wolfe, and Barto 2005)</xref>
        ,
and most of these methods require building the state
transition graph, providing a model of the environment and
the agents possible interactions with it
        <xref ref-type="bibr" rid="ref1 ref13 ref4">(Machado,
Bellemare, and Bowling 2017; S¸ ims¸ek, Wolfe, and Barto 2005;
Goel and Huber 2003)</xref>
        . Formally, the state transition graph
is a directed graph G = (V; E) with a set of vertices, V S
and set of edges E A(S ), where S is the set of states
and A(S ) is the set of allowable actions. Since actions
typically modify the state of the agent, each directed edge,
(s; s0) 2 E, indicates an action that takes the agent from
state s to state s0. In nondeterministic environments, a
probability distribution over subsequent states, given the current
state and an action, p(s0js; a), is maintained as part of the
model of the environment. One method of this kind that was
applied to a somewhat larger scale task — the first screen
of the ATARI 2600 game called Montezuma’s Revenge —
is that of
        <xref ref-type="bibr" rid="ref8">Machado &amp; Bowling (2016)</xref>
        . This method
constructs the combinatorial transition graph Laplacian matrix,
and an eigen-decomposition of that matrix produces
candidate subgoals. While it was shown that some of these
candidates make for useful subgoals, only heuristic
domainsensitive methods have been reported for identifying useful
subgoals from the large set of candidates (e.g., thousands).
Thus, previously proposed subgoal discovery methods have
provided useful insights and have been demonstrated to
improve learning, but there continue to be challenges with
regard to scalability and generalization. Scaling to large state
spaces will generally mandate the use of some form of
nonlinear function approximator to encode the value function,
rather than a look-up table. More importantly, as the scale of
reinforcement learning problem increases, the tractability of
obtaining a good model of the environment, capturing all
relevant state transition probabilities, precipitously decreases.
      </p>
      <p>
        Once useful subgoals are discovered, an HRL agent
should be able to learn the skills to attain those subgoals
through the use of intrinsic motivation — artificially
rewarding the agent for attaining selected subgoals. The nature
and origin of “good” intrinsic reward functions is an open
question in reinforcement learning, however, and a number
of approaches have been proposed.
        <xref ref-type="bibr" rid="ref14">Singh et al. (2010)</xref>
        explored agents with intrinsic reward structures in order to
learn generic options that can apply to a wide variety of
tasks. Value functions have also been generalized to
consider goals along with states
        <xref ref-type="bibr" rid="ref19">(Vezhnevets et al. 2017)</xref>
        . Such
a parameterized universal value function, q(s; g; a; w),
integrates the value functions for multiple skills into a single
function taking the current subgoal, g, as an argument.
      </p>
      <p>
        Recently,
        <xref ref-type="bibr" rid="ref6">Kulkarni et al. (2016)</xref>
        proposed a scheme for
temporal abstraction that involves simultaneously learning
options and a hierarchical control policy in a deep
reinforcement learning framework. Their approach does not use
separate Q-functions for each option, but, instead, treats the
option as an argument. This method lacks a technique for
automatic subgoal discovery, however, forcing the system
designer to specify a set of promising subgoal candidates
in advance. The approach proposed in this paper is inspired
by
        <xref ref-type="bibr" rid="ref6">Kulkarni et al. (2016)</xref>
        , which has advantages in terms of
scalability and generalization, but it incorporates automatic
subgoal discovery.
      </p>
      <p>
        It is important to note that model-free HRL, which does
not require a model of the environment, still often requires
the learning of useful internal representations of states.
When learning the value function using a nonlinear
function approximator, such as a deep neural network,
relevant features of states must be extracted in order to
support generalization at scale. A number of methods have
been explored for learning such internal representations
during model-free reinforcement learning
        <xref ref-type="bibr" rid="ref10 ref13 ref17">(Tesauro 1995;
Rafati and Noelle 2017; Mnih et al. 2015)</xref>
        .
      </p>
      <p>In this paper, we seek to address major open problems in
the integration of internal representation learning, temporal
abstraction, automatic subgoal discovery, and intrinsic
motivation learning, all within the model-free HRL framework.
We propose and implement efficient and general
methods for subgoal discovery using unsupervised learning and
anomaly (outlier) detection. These methods do not require
information beyond that which is typically collected by the
agent during model-free reinforcement learning, such as a
small memory of recent experiences (agent trajectories). Our
methods are fundamentally constrained in three ways, by
design. First, we remain faithful to a model-free
reinforcement learning framework, eschewing any approach that
requires the learning or use of an environment model.
Second, we are devoted to integrating subgoal discovery with
intrinsic motivation learning. Specifically, we conjecture that
intrinsic motivation learning can increase appropriate state
space coverage, supporting more efficient subgoal
discovery. Lastly, we focus on subgoal discovery algorithms that
are likely to scale to large reinforcement learning tasks. The
result is a unified model-free HRL algorithm that
incorporates the learning of useful internal representations of states,
automatic subgoal discovery, intrinsic motivation learning
of skills, and the learning of subgoal selection by a
“metacontroller”. We demonstrate the effectiveness of this
algorithm by applying it to a variant of the rooms task (illustrated
in Figure 2(a)), as well as the initial screen of the ATARI
2600 game called Montezuma’s Revenge (illustrated in
Figure 3(a)).</p>
    </sec>
    <sec id="sec-2">
      <title>Reinforcement Learning Problem</title>
      <p>
        The Reinforcement Learning (RL) problem is learning
through interaction with an environment
        <xref ref-type="bibr" rid="ref15">(Sutton and Barto
1998)</xref>
        . At each time step the agent receives a representation
of the environment’s state, s 2 S, where S is the set of all
possible states. On that basis, the agent selects an action,
a 2 A, where A is the set of all available actions. One time
step later, as a consequence of the agent’s action, the agent
receives a reward, r 2 R, and also an update on the agent’s
new state, s0, from the environment. Each cycle of
interaction is called a transition experience, e = (s; a; r; s0). At
each time step, the agent implements a mapping from states
to possible actions, : S ! A, called its policy. The goal
of the RL agent is to find an optimal policy that maximizes
the expected value of the return, i.e. the cumulative sum of
future rewards, Gt = PtT0=t t0 trt0+1, where 2 (0; 1]
is the discount factor and T is a final step. The Temporal
Difference (TD) learning approach is a class of model-free
RL methods that attempt to learn a policy without learning a
model of the environment. It is often useful to define a value
function q : S A ! R to estimate the expected value of
the return, following policy . When the state space is large,
or not all states are observable, we can use a nonlinear
function approximator, such as an artificial neural network
        <xref ref-type="bibr" rid="ref10">(Mnih
et al. 2015)</xref>
        , or a linear approximation (Liang et al. 2016),
to calculate Q(s; a; w), an estimate the value function q ,
parameterized by w. Q-learning is a TD algorithm that
attempts to find the optimal value function by minimizing the
loss function L(w), which is defined as the expectation of
squared TD error over a recent transition experience
memory, D:
L(w) , Ee D
h
r +
max Q(s0; a0; w)
a0
      </p>
      <p>Q(s; a; w)
2i
:</p>
    </sec>
    <sec id="sec-3">
      <title>A Unified Model-Free HRL Framework</title>
      <p>
        In Hierarchical Reinforcement Learning (HRL), a central
goal is to support the learning of representations at multiple
levels of abstraction. As a simple example, consider the task
of navigation in the 4-room environment with a key and a
lock in Figure 2(a). This is a variant of the rooms task
        <xref ref-type="bibr" rid="ref16">(Sutton, Precup, and Singh 1999)</xref>
        . The 4-room is a grid-world
environment consisting of 4 rooms. Each grid square is a
state, and the agent has access to the Cartesian location of
each grid square. Actions allow the agent to move to an
adjacent grid square. The 4 rooms are connected through
doorways. The agent is rewarded for entering the grid square
containing the key, and it is more substantially rewarded for
entering the grid square with the lock after obtaining the key.
Learning this task based on sparse delayed feedback is
challenging for a reinforcement learning agent.
      </p>
      <p>Our intuition, shared with other researchers, is that
hierarchies of abstraction will be critical for successfully solving
problems of this kind. To be successful, the agent should
represent knowledge at multiple levels of spatial and temporal
abstraction. Appropriate abstraction can be had by
identifying a relatively small set of states that are likely to be useful
as subgoals and jointly learning the corresponding skills of
achieving these subgoals, using intrinsic motivation.</p>
      <p>In this section, we introduce a unified method for
modelfree HRL. The major components of our framework, and the
information flow between them, are sketched in Figure 1.
Before describing the unified method, we introduce the
various components of our framework.</p>
      <sec id="sec-3-1">
        <title>Meta-Controller and Controller Framework</title>
        <p>
          Inspired by
          <xref ref-type="bibr" rid="ref6">Kulkarni et al. (2016)</xref>
          , we start by using two
levels of hierarchy (Figure 1). The more abstract level of this
hierarchy is managed by a meta-controller which guides the
action selection processes of the lower level controller.
Separate value functions are learned for the meta-controller and
the controller. At time step t, the meta-controller receives
a state observation, s = st, from the environment. It has a
policy for selecting a subgoal, g = gt, from a set of
subgoals, G. In our implementation, the policy arises from
estimating the value of each subgoal, Q(s; g; W ), and selecting
the goal of highest estimated value (except when
performing random exploration). With the current subgoal selected,
the controller uses its policy to select an action, a 2 A,
based on the current state, s, and the current subgoal, g. In
our implementation, this policy involves selecting the action
that results in the highest estimate of the controller’s value
function, q(s; g; a; w). Actions continue to be selected by the
controller while an internal critic monitors the current state,
comparing it to the current subgoal, and delivering an
appropriate intrinsic reward, r~, to the controller on each time step.
Each transition experience, (s; g; a; r~; s0), is recorded in the
controller’s experience memory set, D1, to support learning.
When the subgoal is attained, or a maximum amount of time
has passed, the meta-controller observes the resulting state,
st0 = st+T +1, and selects another subgoal, g0 = gt+T +1,
at which time the process repeats, but not before recording
a transition experience for the meta-controller, (s; g; G; st0 )
in the meta-controller’s experience memory set, D2. The
parameters of the value function approximators are adjusted
based on the collections of recent experiences. For training
the meta-controller value function, we minimize a loss
function based on the reward received from the environment:
2
Li(W ) , E(s;g;G;st0 ) D2
        </p>
        <p>Y</p>
        <p>Q(s; g; W )
;
(1)
where G = Ptt0+=Tt t0 trt0 is the accumulated external
reward (return) between the selection of consecutive
subgoals. The target value for the expected return at the time
that the meta-controller selected subgoal g is Y = G +
maxg0 Q(s0; g0; W ). The controller improves its subpolicy,
(ajs; g), by learning its value function, q(s; g; a; w), over
the set of recorded transition experiences. The controller
updates its value function approximator parameters, w, so as to
minimize its loss function:</p>
        <p>Li(w) , E(s;g;a;r~;s0) D1
y
q(s; g; a; w)
2
;
(2)
where y = r~ + max0a q(s0; g; a0; w) is the target expected
intrinsic return value.
Intrinsic motivation learning is the core idea behind the
learning of value functions in the meta-controller and the
controller. In some tasks with sparse delayed feedback, a
standard RL agent cannot effectively explore the state space
so as to have a sufficient number of rewarding experiences
to learn how to maximize rewards. In contrast, the
intrinsic critic in our HRL framework can send much more
regular feedback to the controller, since it is based on
attaining subgoals, rather than ultimate goals. As an example, our
implementation typically awards an intrinsic reward of +1
when the agent attains the current subgoal, g, and 1 for any
other state transition. Successfully solving a difficult task not
only depends on such an intrinsic motivation learning
mechanism, but also on the meta-controller’s ability to learn how
to choose the right subgoal for any given state, s, from a set
of candidate subgoals. Indeed, identifying a good set of
candidate subgoals is an additional prerequisite for success, and
it is discussed next.</p>
      </sec>
      <sec id="sec-3-2">
        <title>Unsupervised Subgoal Discovery</title>
        <p>The performance of the meta-controller/controller
framework depends critically on selecting good candidate
subgoals for the meta-controller to consider.</p>
        <p>What is a subgoal? In our framework, a subgoal is a state,
or a set of related states, that satisfies at least one of these
conditions:
1. It is close (in terms of actions) to a rewarding state. For
example, in the rooms task in Figure 2(a), the key and lock
are rewarding states.
2. It represents a set of states, at least some of which tend to
be along a state transition path to a rewarding state.
For example, in the rooms task, the red room should be
visited to move from the purple room to the blue room in order
to pick up the key. Thus any state in the red room is a
reasonably good subgoal for an agent currently in the purple room.
Similarly, the states in the blue room are all reasonably good
subgoals for an agent currently in the red room. The
doorways between rooms can also be considered as good
subgoals, since entering these states allows for the transition to
a set of states that may be closer to rewarding states.</p>
        <p>Our strategy involves leveraging the set of recent
transition experiences that must be recorded for value function
learning, regardless. Unsupervised learning methods applied
to sets of experiences can be used to identify sets of states
that may be good subgoal candidates. We focus specifically
on two kinds of analysis that can be performed on the set of
transition experiences. We hypothesize that good subgoals
might be found by (1) attending to the states associated with
anomalous transition experiences and (2) clustering
experiences based on a similarity measure and collecting the set
of associated states into a potential subgoal. Thus, our
proposed method merges anomaly (outlier) detection with the
K-means clustering of experiences.</p>
        <p>Anomaly Detection The anomaly (outlier) detection
process identifies states associated with experiences that differ
significantly from the others. In the context of subgoal
discovery, a relevant anomalous experience would be one that
includes a substantial positive reward in an environment in
which reward is sparse. We propose that the states associated
with these experiences make for good candidate subgoals.
For example, in the rooms task, transitions that arrive at the
key or the lock are quite dissimilar to most transitions, due
to the large positive reward that is received at that point.</p>
        <p>
          Since the goal of RL is maximizing accumulated
(discounted) reward, these anomalous experiences, involving
large rewards, are ideal as subgoal candidates. (Experiences
involving large negative rewards are also anomalous, but
make for poor subgoals. As long as these sorts of
anomalies do not greatly outnumber others, we expect that the
meta-controller can efficiently learn to avoid poor subgoal
choices.) Large changes in state features can also be marked
as anomalous. In some computer games, like Montezuma’s
Revenge, each screen represents a room, and the screen
changes quickly when the agent moves from one room to
another. This produces a large distance between two
consecutive states. Such a transition can be recognized simply
by the large instantaneous change in state features,
marking the associated states as reasonable candidate subgoals.
There is a large literature on anomaly detection
          <xref ref-type="bibr" rid="ref5">(Hodge and
Austin 2004)</xref>
          , in general, offering methods for applying this
insight. Heuristic meta-parameter thresholds can be used to
identify dissimilarities that warrant special attention, or
unsupervised machine learning methods can be used to model
the joint probability distribution of state variables, with low
probability states seen as anomalous.
        </p>
        <p>K-Means Clustering The idea behind using a clustering
algorithm is “spatial” state space abstraction and
dimensionality reduction with regard to the internal representations of
states. If a collection of transition experiences are very
similar to each other, this might suggest that the associated states
are all roughly equally good as subgoals. Thus, rather than
considering all of those states, the learning process might be
made faster by considering a representative state (or smaller
set of states), such as the centroid of a cluster, as a subgoal.
Furthermore, using a simple clustering technique like
Kmeans clustering to find a small number of centroids in the
space of experiences is likely to produce centroid subgoals
that are dissimilar from each other. Since rewards are sparse,
this dissimilarity will be dominated by state features. For
example, in the rooms task, the centroids of K-means
clusters, with K = 4, lie close to the geometric center of each
room, with the states within each room coming to belong
to the corresponding subgoal’s cluster. In this way, the
clustering of transition experiences can approximately produce
a coarser representation of state space, in this case
replacing the fine grained “grid square location” with the coarser
“room location”.</p>
      </sec>
      <sec id="sec-3-3">
        <title>A Unified Framework</title>
        <p>These conceptual components can be unified into a single
model-free HRL framework. The major components of this
framework, and the information flow between these
components, are schematically displayed in Figure 1. At time t, the
meta-controller observes the state, s = st, from the
environment and chooses a subgoal, g = gt, either from the
discovered subgoals or from a random set of states (to promote
exploration). The controller receives an input tuple, (s; g),
and is expected to learn to implement a subpolicy, (ajs; g),
that solves the subtask of reaching from s to g. The
controller selects an action, a, based on its policy, in our case
directly derived from its value function, q(s; g; a; w).
After one step, the environment updates the state to s0 and
sends a reward r. The transition experience (s; g; a; r~; s0)
is then stored in the experience memory for the controller,
D1. If the internal critic detects that the resulting state, s0,
is the current goal, g, the experience (st; g; G; st0 ) is stored
in the meta-controller experience memory, D2, where st is
the state that prompted the selection of the current subgoal,
and st0 = st+T is the state when the meta-controller
assigns the next subgoal, g0 = gt0 . The experience memory
sets are typically used to train the value function
approximators for the meta-controller and the controller by sampling a
random minibatch of recent experiences. The subgoal
discovery mechanism exploits the underlying structure in the
experience memory sets using unsupervised anomaly
detection and experience clustering. A detailed description of this
process is outlined in Algorithm 1.</p>
        <p>Algorithm 1 Unified Model-Free HRL Algorithm
Initialize discovered subgoals set G ;
Initialize experience memories D, D1 and D2
Initialize parameters w and W randomly
Inputs: learning rate , exploration rate
Choose Phase I or Phase II
for episode = 1; : : : ; M do</p>
        <p>Initialize state s0 2 S, s s0
Initialize episode return G 0
if Phase I of learning then</p>
        <p>Choose a subgoal g randomly form S
else if Phase II of learning then</p>
        <p>g EPSILON-GREEDY(Q(s; G; W); )
end if</p>
      </sec>
      <sec id="sec-3-4">
        <title>Intrinsic Motivation Learning Algorithm:</title>
        <p>repeat for each step t = 1; : : : ; T
compute q(s; g; a; w)
a EPSILON-GREEDY(q(s; g; A; w); )
Take action a, observe s0 and external reward r
Compute intrinsic reward r~ from internal critic
Store (s; g; a; r~; s0) to D1
Store (s; a; r; s0) to D
Sample J1 D1 and compute rL
Update w; w w rL
if Phase II of learning then</p>
        <p>Sample J2 D2 and compute rL</p>
        <p>Update W; W W rL
end if
s s0; G G + r</p>
        <p>Decay exploration rate
until s is terminal or subgoal g is attained
Store (s0; g; G; s0) to D2
if Phase I of training then</p>
        <p>Run Unsupervised Subgoal Discovery
end if
end for
====================================</p>
      </sec>
      <sec id="sec-3-5">
        <title>Unsupervised Subgoal Discovery Algorithm</title>
        <p>for each e = (s; a; r; s0) stored in D do
if experience e is an outlier (anomaly) then</p>
        <p>Store s0 to the subgoals set G</p>
        <p>Remove e from D
end if
end for
Fit a K-means Clustering Algorithm on D using previous
centroids as initial points
Store the updated centroids to the subgoals set G</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Experiments</title>
      <p>We conducted simulation experiments in order to investigate
the ability of our unsupervised subgoal discovery method
to discover useful subgoals, as well as the efficiency of
our unified model-free hierarchical reinforcement learning
framework. The simulations were conducted in two
environments with sparse delayed feedback: a variant of the rooms
task, shown in Figure 2(a), and the “Montezumas Revenge”
game, shown in Figure 3(a).</p>
      <p>In these simulations, learning occurred in two phases. In
Phase I of learning, the controller learned how to navigate
in the state space, from any arbitrary state to any other state,
using intrinsic motivation learning. The agent’s trajectories,
(s; a; r; s0), during this pretraining phase were stored in D,
and our unsupervised subgoal discovery method extracted
the structure of D by performing K-means clustering and
anomaly detection. The discovered subgoals were stored
in G. In Phase II of learning, the meta-controller learned
meta-policies over G, and the controller had opportunities
to refine its ability to navigate from any arbitrary state, s,
to any assigned subgoal, g 2 G. We separated the
learning process into phases for two reasons: (1) to focus on the
knowledge extracted from game environments using our
approach to unsupervised subgoal discovery during intrinsic
motivation learning; (2) to avoid complications that arise in
meta-controller learning when the set of subgoals, G, is not
fixed. Integrating these phases into a uniform and
incremental HRL process is a central apsect of our future work.</p>
      <sec id="sec-4-1">
        <title>4-Room Task with Key and Lock</title>
        <p>
          Consider the task of navigation in the 4-room environment
with a key and a lock, as shown in Figure 2(a). This task
was inspired by the rooms environment introduced by
          <xref ref-type="bibr" rid="ref16">Sutton, et al. (1999)</xref>
          , but it is much more complex. The agent
not only needs to learn how to navigate form any
arbitrary state to any other state, but also it needs to visit some
states in a specific temporal order. At the beginning of each
episode, the agent is initialized in an arbitrary location in an
arbitrary room. The agent has four possible move actions,
A = fN orth; South; East; W estg, on each time step.
The agent receives r = +10 reward for reaching the key
and r = +40 if it moves to the lock while carrying the key
(i.e., any time after visiting the key location during the same
episode). Bumping into a wall boundary is punished with a
reward of r = 2. There is no reward for just exploring
the space. Learning in this environment with sparse delayed
feedback is challenging for a reinforcement learning agent.
To successfully solve the task, the agent should represent
knowledge at multiple levels of spatial and temporal
abstractions. The agent should also learn to explore the environment
efficiently.
        </p>
        <p>We first examined the unsupervised subgoal discovery
algorithm over the course of a random walk. The agent
was allowed to explore the 4-room environment for 10,000
episodes. Each episode ended either when the task was
completed or after reaching a maximum time step limit of 200.
The agent’s experiences, e = (s; a; r; s0), were collected
in an experience memory, D. The stream of external
rewards for each transition was used to detect anomalous
subgoals (Figure 2(c)). We applied a heuristic anomaly
detection method for the streaming rewards that was able to
differentiate between the rare large positive rewards and the
regular small ones. These peaks, as shown in Figure 2(c),
corresponded to the experiences in which the key was reached
(r = +10) or the experience of reaching the lock after
obtaining the key.</p>
        <p>We also applied a K-means clustering algorithm to the
experience memory. (See Algorithm 1.) The centroids of the
50
40
n
ru30
t
e
R
e20
d
o
s
ip10
E
0
(a)
Our Unified Model-Free HRL Method</p>
        <p>Regular RL
40000 60000
Training steps</p>
        <p>(e)
0
20000
80000
100000
0
20000
80000
100000
K-means clusters (with K = 4) are plotted in Figure 2(b).
We found these centroids to roughly correspond to the
centers of the rooms. (We experimented with K = 8 and saw
equally useful clusters, with each room containing two
cluster centroids. We will investigate methods for choosing K in
future work.) The clusters, along with the anomalous states,
were collected into the set of subgoals.</p>
        <p>Phase I learning consisted of 100,000 episodes. Value
function approximators were implemented as multi-layer
artificial neural networks augmented to encourage the
learn40000 60000
Training steps
(d)
Our Unified Model-Free HRL Method</p>
        <p>
          Regular RL
40000 60000
Training steps
(f)
ing of sparse internal representations of states
          <xref ref-type="bibr" rid="ref12">(Rafati and
Noelle 2015)</xref>
          . The controller network, q(s; g; a; w), took the
state, s, and the goal, g, as inputs. States were presented to
the network as Cartesian coordinates, with separate pools of
inputs for each of the two dimensions. During this
learning phase, the subgoal was initially chosen randomly from
the state space. After unsupervised subgoal discovery, the
subgoal was chosen randomly from the subgoals set, G. In
this way, the controller was trained to navigate from any
arbitrary state, s, to any subgoal state. When a centroid was
selected as a subgoal, if the agent entered any state in the
corresponding cluster, the subgoal was considered attained.
Thus, the controller essentially learned how to navigate from
any location to any state cluster (room) and also to any of
the anomalous subgoals (key and door). The learning rate
was = 0:001, the discount factor was = 0:99, and the
exploration rate was set to = 0:2. The average success rate
(over 10 consecutive episodes) for the first phase of intrinsic
motivation learning is shown in Figure 2(d).
        </p>
        <p>Phase II learning involved training both the
metacontroller and the controller, together, using the discovered
subgoals, G. (See Algorithm 1.) The subgoal set regularly
came to contain a total of 6 subgoals: 2 anomalous ones and
4 centroids. The system was trained for 100,000 episodes.
The meta-controller’s value function approximation network
consisted of two layers. The first layer, was a one-hot
encoding of the conjunction of the current subgoal and the state,
computed by converting the state to the index of the
corresponding subgoal. This was connected directly to the
output layer. The average return, over 10 consecutive episodes,
is shown in Figure 2(e). The agent very quickly converged
on the optimal policies and collected the maximum reward
(+50). The high exploration rate, = 0:2, caused high
stochasticity, but the meta-controller and controller could
robustly solve the task on more than 90% of the episodes very
early in training. After about 40,000 episodes, the success
rate was 100%, as shown in Figure 2(f).</p>
        <p>
          We compared the learning efficiency of our unified HRL
method with the performance resulting from training a value
approximation network with a regular, non-hierarchical, RL
algorithm, TD SARSA
          <xref ref-type="bibr" rid="ref15">(Sutton and Barto 1998)</xref>
          . The
function approximator that we used for Q(s; a; w) matched that
of the controller, equating for computational resources, and
we used the same values for the training hyper-parameters.
The regular RL agent could only reach the key before
becoming stuck in that region, due to the high local reward.
Despite the very high exploration rate used, the regular RL
agent was not motivated to explore the rest of the state space
to reach the lock and solve the task. Results are shown in
Figure 2(e) and (f) (red plots).
        </p>
        <p>It is worth noting that this task involves a partially
observable Markov decision process (POMDP), because
information about whether or not the agent has the key is not visible
in the state. This hidden state information poses a serious
problem for standard RL algorithms, but our HRL agent was
able to overcome this obstacle. Through Phase II learning,
the hidden information became implicit in the selected
subgoal, with the meta-controller changing the current subgoal
once the key is obtained. In this way, our HRL framework
is able to succeed in task environments that are effectively
outside of the scope of standard RL approaches.</p>
      </sec>
      <sec id="sec-4-2">
        <title>Montezuma’s Revenge</title>
        <p>We applied our HRL approach to the first room of the game
Montezuma’s Revenge. (See Figure 3(a).) The game is
wellknown as a challenge for RL agents because it requires
solving many subtasks while avoiding traps. Having only sparse
delayed reward feedback to drive learning makes this RL
problem extremely difficult. The agent should learn to
navigate the man in red to the key by: (1) climbing the middle
ladder (2) climbing the bottom right ladder (3) climbing the
bottom left ladder (4) moving to the key. After picking up
the key (r = +100), the agent should return back,
reversing the previous action sequence, and attempt to reach the
door (r = +300) and exit the room. The moving skull at the
bottom of the screen, which ends an episode upon contact,
makes obtaining the key extremely difficult. The episode
also ends unsuccessfully if the man falls off of a platform.</p>
        <p>
          DeepMind’s Deep Q-Learning (DQN) algorithm
          <xref ref-type="bibr" rid="ref10">(Mnih
et al. 2015)</xref>
          , which surpassed human performance on many
ATARI 2600 games, failed to learn this game since the agent
did not reach any rewarding state during exploration.
        </p>
        <p>
          In this problem, the agent requires the skills arising from
intrinsic motivation learning in order to explore the
environment in a more efficient way
          <xref ref-type="bibr" rid="ref6">(Kulkarni et al. 2016)</xref>
          . Our
HRL approach supports the learning of such skills. As
before, the meta-controller and the controller were trained in
two phases. In Phase I, the controller was trained to move
the man from any location in the given frame, s, to any other
location specified in a subgoal frame, g. An initial set of
“interesting” subgoal locations were identified using a
custom edge detection algorithm, avoiding empty regions as
subgoals. Unsupervised object detection using computer
vision algorithms can be challenging
          <xref ref-type="bibr" rid="ref2 ref6">(Kulkarni et al. 2016;
Fragkiadaki et al. 2015)</xref>
          . We made the simplifying
assumption that, in many games, edges were suggestive of objects,
and the locations of objects made for good initial subgoals.
These locations were used in Phase I of training to train
the controller through intrinsic motivation. Note that edge
detection was only performed to identify Phase I subgoals.
Specifically, it was not used to change or augment the state
representation in any way.
        </p>
        <p>We used a variant of the DQN deep Convolutional
Neural Network (CNN) architecture (Figure 3(b)) for
approximation of the controller’s value function, q(s; g; a; w). The
input to the controller network consisted of four
consecutive frames of size 84 84, encoding the state, s, and an
additional frame binary mask encoding the subgoal, g. The
concatenated state and subgoal frames were passed to the
network, and the controller then selected one of 18 different
joystick actions based on a policy derived from q(s; g; a; w).</p>
        <p>
          During intrinsic motivation learning, the recent
experiences were saved in an experience memory, D, with a size
of 106. In order to support comparison to previously
published results, we used the same learning parameters of
DeepMind’s DQN
          <xref ref-type="bibr" rid="ref10">(Mnih et al. 2015)</xref>
          . Specifically, the
learning rate, , was set to to be 0:00025, with a discount rate
(b)
(c)
(d)
s%80
l
a
o
g
b
u60
s
g
n
i
h
ca40
e
r
n
i
ss20
e
c
c
u
S 0
        </p>
        <p>
          Our Unified Model-Free HRL Method
DeepMind DQN Algorithm
          <xref ref-type="bibr" rid="ref10">(Mnih et. al., 2015)</xref>
          1000000 1500000
Training steps
(f)
400
se350
d
isp300
e
10250
r
eov200
n
rtu150
e
re100
g
reav 50
A 0
(a)
        </p>
        <p>
          Our Unified Model-Free HRL Method
DeepMind DQN Algorithm
          <xref ref-type="bibr" rid="ref10">(Mnih et. al., 2015)</xref>
          1000000 1500000
Training steps
        </p>
        <p>
          (e)
0
500000
2000000
2500000
0
500000
2000000
2500000
of = 0:99. During Phase I learning, we trained the
network for a total of 2:5 106 time steps. The exploration
probability parameter, , decreased from 1:0 to 0:1 in the
first million steps and remained fixed after that. After
every 100; 000 time steps, we applied our unsupervised
subgoal discovery method to the contents of the experience
memory in order to find new subgoals, both anomalies and
centroids, using K-means clustering with K = 10. As
shown in Figure 3(d), the unsupervised learning algorithm
managed to discover the location of the key and the doors
in this way. It also identified useful objects such as
ladders, platforms, and the rope. In Phase II, we trained the
meta-controller and the controller jointly. We used an
architecture based on the DQN CNN
          <xref ref-type="bibr" rid="ref10">(Mnih et al. 2015)</xref>
          , as
shown in Figure 3(c), for the meta-controller’s value
function, Q(s; g; W). We used the non-overlapping discovered
subgoals, which resulted in a set of 11 subgoals, G. At the
beginning of each episode, the meta-controller assigned a
subgoal, g 2 G, based on an epsilon-greedy policy derived
from Q(s; g; W). The controller then attempted to reach
these subgoals. The controller’s experience memory, D1,
had a size of 106, and the size of the meta-controller’s
experience memory, D2, was 5 104. The cumulative rewards for
the game episodes is shown in Figure 3(e). After about 1.5
million time steps, the controller managed to reach the key
subgoal more frequently. The success of the intrinsic
motivation learning is depicted in Figure 3(f). At the end of the
second phase of learning (after 2.5 million learning steps),
the meta-controller regularly chose the proper subgoals for
collecting the maximum reward (+400).
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>We have proposed and demonstrated a novel model-free
HRL method for subgoal discovery using unsupervised
learning over a small memory of the most recent
experiences (trajectories) of the agent. When combined with an
intrinsic motivation learning mechanism, this method learns
subgoals and skills together, based on experiences in the
environment. Thus, we offer an HRL approach that does not
require a model of the environment, making it suitable for
larger-scale applications.</p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgments</title>
      <p>We acknowledge the valuable comments of the anonymous
reviewers of this paper. The computations are conducted on
the MERCED cluster at UC Merced, which was funded by
National Science Foundation Grant No. ACI-1429783.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>S¸ims¸ek</article-title>
          , O.;
          <string-name>
            <surname>Wolfe</surname>
            ,
            <given-names>A. P.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Barto</surname>
            ,
            <given-names>A. G.</given-names>
          </string-name>
          <year>2005</year>
          .
          <article-title>Identifying useful subgoals in reinforcement learning by local graph partitioning</article-title>
          .
          <source>In Proceedings of the 22nd International Conference on Machine Learning</source>
          ,
          <fpage>816</fpage>
          -
          <lpage>823</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Fragkiadaki</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Arbelaez</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ; Felsen,
          <string-name>
            <given-names>P.</given-names>
            ; and
            <surname>Malik</surname>
          </string-name>
          ,
          <string-name>
            <surname>J.</surname>
          </string-name>
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <article-title>Learning to segment moving objects in videos</article-title>
          .
          <source>In IEEE Conference on Computer Vision and Pattern Recognition (CVPR)</source>
          ,
          <fpage>4083</fpage>
          -
          <lpage>4090</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Goel</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Huber</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <year>2003</year>
          .
          <article-title>Subgoal discovery for hierarchical reinforcement learning using learned policies</article-title>
          .
          <source>In FLAIRS Conference</source>
          ,
          <volume>346</volume>
          -
          <fpage>350</fpage>
          . AAAI Press.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Hodge</surname>
            ,
            <given-names>V. J.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Austin</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <year>2004</year>
          .
          <article-title>A survey of outlier detection methodologies</article-title>
          .
          <source>Artificial Intelligence Review</source>
          <volume>22</volume>
          (
          <issue>2</issue>
          ):
          <fpage>85</fpage>
          -
          <lpage>126</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <surname>Kulkarni</surname>
          </string-name>
          , T. D.;
          <string-name>
            <surname>Narasimhan</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Saeedi</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Tenenbaum</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <year>2016</year>
          .
          <article-title>Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation</article-title>
          .
          <source>In Advances in Neural Information Processing Systems</source>
          ,
          <volume>3675</volume>
          -
          <fpage>3683</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          2016.
          <article-title>State of the Art Control of Atari Games Using Shallow Reinforcement Learning</article-title>
          .
          <source>In Proceedings of the International Conference on Autonomous Agents and Multiagent Systems</source>
          ,
          <volume>17</volume>
          -
          <fpage>25</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Machado</surname>
            ,
            <given-names>M. C.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Bowling</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <year>2016</year>
          .
          <article-title>Learning Purposeful Behaviour in the Absence of Rewards. Presented at the ICML-</article-title>
          16 Workshop on Abstraction in Reinforcement Learning.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          2017.
          <article-title>A laplacian framework for option discovery in reinforcement learning</article-title>
          .
          <source>In Proceedings of the 34th International Conference on Machine Learning</source>
          ,
          <string-name>
            <surname>ICML</surname>
          </string-name>
          <year>2017</year>
          ,
          <article-title>Sydney</article-title>
          ,
          <string-name>
            <surname>NSW</surname>
          </string-name>
          , Australia,
          <fpage>6</fpage>
          -
          <issue>11</issue>
          <year>August 2017</year>
          ,
          <fpage>2295</fpage>
          -
          <lpage>2304</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Mnih</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Kavukcuoglu</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Silver</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ; et al.
          <year>2015</year>
          .
          <article-title>Humanlevel control through deep reinforcement learning</article-title>
          .
          <source>Nature</source>
          <volume>518</volume>
          (
          <issue>7540</issue>
          ):
          <fpage>529</fpage>
          -
          <lpage>533</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <surname>Pickett</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Barto</surname>
            ,
            <given-names>A. G.</given-names>
          </string-name>
          <year>2002</year>
          .
          <article-title>Policyblocks: An algorithm for creating useful macro-actions in reinforcement learning</article-title>
          .
          <source>In Proceedings of the Nineteenth International Conference on Machine Learning</source>
          ,
          <fpage>506</fpage>
          -
          <lpage>513</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <surname>Rafati</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Noelle</surname>
            ,
            <given-names>D. C.</given-names>
          </string-name>
          <year>2015</year>
          .
          <article-title>Lateral inhibition overcomes limits of temporal difference learning</article-title>
          .
          <source>In 37th Annual Cognitive Science Society Meeting</source>
          , Pasadena, CA, USA.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          <string-name>
            <surname>Rafati</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Noelle</surname>
            ,
            <given-names>D. C.</given-names>
          </string-name>
          <year>2017</year>
          .
          <article-title>Sparse coding of learned state representations in reinforcement learning</article-title>
          .
          <source>In Conference on Cognitive Computational Neuroscience</source>
          , New York City, NY, USA.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          <string-name>
            <surname>Singh</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Lewis</surname>
            ,
            <given-names>R. L.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Barto</surname>
            ,
            <given-names>A. G.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Sorg</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <year>2010</year>
          .
          <article-title>Intrinsically motivated reinforcement learning: An evolutionary perspective</article-title>
          .
          <source>IEEE Transaction on Autonomous Mental Development</source>
          <volume>2</volume>
          (
          <issue>2</issue>
          ):
          <fpage>70</fpage>
          -
          <lpage>82</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          <string-name>
            <surname>Sutton</surname>
            ,
            <given-names>R. S.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Barto</surname>
            ,
            <given-names>A. G.</given-names>
          </string-name>
          <year>1998</year>
          .
          <article-title>Reinforcement Learning: An Introduction</article-title>
          . Cambridge, MA: MIT Press,
          <article-title>1st edition</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          <string-name>
            <surname>Sutton</surname>
            ,
            <given-names>R. S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Precup</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ; and
          <string-name>
            <surname>Singh</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <year>1999</year>
          .
          <article-title>Between MDPs and semi-MDPs: A framework for temporal abstraction in reinforcement learning</article-title>
          .
          <source>Artificial Intelligence</source>
          <volume>112</volume>
          (
          <issue>1</issue>
          ):
          <fpage>181</fpage>
          -
          <lpage>211</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          <string-name>
            <surname>Tesauro</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          <year>1995</year>
          .
          <article-title>Temporal difference learning and TDGammon</article-title>
          .
          <source>Communications of the ACM</source>
          <volume>38</volume>
          (
          <issue>3</issue>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          <string-name>
            <surname>Thrun</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Schwartz</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <year>1995</year>
          .
          <article-title>Finding structure in reinforcement learning</article-title>
          .
          <source>In Advances in Neural Information Processing Systems</source>
          <volume>7</volume>
          . MIT Press.
          <volume>385</volume>
          -
          <fpage>392</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          <string-name>
            <surname>Vezhnevets</surname>
            ,
            <given-names>A. S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Osindero</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ; Schaul,
          <string-name>
            <given-names>T.</given-names>
            ;
            <surname>Heess</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            ;
            <surname>Jaderberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ;
            <surname>Silver</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            ; and
            <surname>Kavukcuoglu</surname>
          </string-name>
          ,
          <string-name>
            <surname>K.</surname>
          </string-name>
          <year>2017</year>
          .
          <article-title>Feudal networks for hierarchical reinforcement learning</article-title>
          .
          <source>CoRR abs/1703</source>
          .01161.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>