Foundations to Frontier
Tests

Hierarchical reinforcement learning

Hierarchical reinforcement learning lets an agent choose among temporally extended actions, such as 'go to the doorway', instead of only single steps. The options framework makes this precise: an option is a policy with a start set and a stopping rule, and planning and learning with options use the semi-Markov decision process (SMDP) versions of value iteration and Q-learning. This page builds hallway options in the classic four-rooms grid, computes their multi-step models exactly, and measures how much they speed up planning and learning, and what they cost when used alone.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Thinking in bigger steps

Nobody plans a trip to another city one footstep at a time. You think ‘walk to the station, take the train, walk to the hotel’, and only work out the footsteps when you get to each part. Hierarchical reinforcement learning gives an agent the same ability: it can choose a whole skill, like ‘go to the door of this room’, which then runs by itself until it is finished. Decisions become fewer and rewards are found much sooner.

Reinforcement learning lab
S
·
·
G
·
The four-rooms grid: each move succeeds with probability 2/3, otherwise one of the other three happens; reward 1 on reaching G, γ = 0.9. Hallways are marked ·. The four primitive actions plus eight hallway options are backed up by SMDP value iteration from V = 0; colour shows V after 4 sweep(s) (hover for values). Start value now 0.0812; it first became positive after 2 sweep(s), and converges to 0.0931 after 74 sweeps. Each option backup jumps a whole room, so value spreads room by room instead of cell by cell; with primitives kept, the final values are the same as without options.
Why engineers care

Hierarchies appear in robots that combine skills like grasping and placing, in game agents that choose goals for lower-level controllers, and in language-model agents that plan subtasks and call tools.

📝 Quick check (Level 0)
0/3 answered
  1. 1. An option is…
  2. 2. Using options mostly helps by…
  3. 3. A natural option in a building is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Option (Sutton, Precup and Singh 1999): a triple (I, π, β): an initiation set I of states where it can start, a policy π it follows, and a termination probability β(s) of stopping in each state.
  • Semi-Markov decision process (SMDP): decisions take a random number of steps k; the discount for what follows an option is γ^k.
  • Multi-time option model: R_o(s), the expected discounted reward while the option runs, and P_o(s, s′) = E[γ^k 1(the option stops in s′)].
  • SMDP Q-learning: after an option runs k steps collecting discounted reward R, update Q(s, o) ← Q(s, o) + α(R + γ^k max_o′ Q(s′, o′) − Q(s, o)).
  • Subgoals and bottlenecks: states that many paths pass through, such as doorways, make good option targets and can be found from the map alone.
  • Feudal and goal-conditioned hierarchies: a high-level policy sets goals for a low-level policy that is rewarded for reaching them (Feudal RL, FeUdal Networks, HIRO, HAC).
  • Option-critic (Bacon, Harb and Precup 2017): learns option policies and termination functions end to end by gradient methods.
📝 Quick check (Level 1)
0/3 answered
  1. 1. An option's three parts are…
  2. 2. After an option runs k steps the next value is discounted by…
  3. 3. Good subgoals are often…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Hallway options in four rooms

Exercise 1.

  • The four-rooms grid of Sutton, Precup and Singh: 104 open cells in four rooms joined by four one-cell hallways.
  • Each move succeeds with probability 2/3, otherwise one of the other three moves happens (1/9 each); walls leave the agent in place. Reward 1 on reaching the goal, which ends the episode; γ = 0.9; start in the top-left corner.
  • Eight hallway options, two per room: each follows a shortest path to one of its room’s hallways, can start anywhere in the room or in its other hallway, and stops as soon as it is anywhere else.
  • Option models are computed exactly by solving linear equations over each option’s initiation set; SMDP value iteration then backs up primitive actions and options together.

Practice.

  • Start with good options if you have them: hand-designed skills (grasp, navigate to a waypoint) are the most reliable way to get a hierarchy’s benefits.
  • Keep primitive actions available (or let the high level interrupt options) so the hierarchy cannot make the optimal policy unreachable.
  • Goal-conditioned low levels trained with hindsight relabelling (HER) are the standard way to learn reusable skills; HIRO and HAC stack them.
  • Learned options (option-critic) need regularisation, such as a cost for terminating, or they collapse to one-step options.
  • Language-model agents use the same idea: a planner chooses subtasks, and tools or sub-agents execute them.
def option_model(P, goal, init, pi, gamma):
    I = np.flatnonzero(init); Pp = P[I, pi[I]]
    A = np.eye(len(I)) - gamma * Pp[:, I]          # keep running inside I
    out = Pp.copy(); out[:, I] = 0                 # stopping transitions
    Ro = np.zeros(len(P)); Po = np.zeros((len(P), len(P)))
    Ro[I] = np.linalg.solve(A, Pp[:, goal])        # expected discounted reward
    Po[I] = gamma * np.linalg.solve(A, out)        # discounted stopping distribution
    return Ro, Po
🐍 Exercise 1: option models and SMDP value iteration
Build the four-rooms grid and its eight hallway options, compute each option's model exactly, and run value iteration with primitive actions, with options added, and with options alone.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Keeping primitive actions alongside options ensures…
  2. 2. HER helps goal-conditioned low levels by…
  3. 3. Learned options without a termination cost tend to…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Options define an SMDP. For any set of options, choosing among them is a decision problem whose transitions take random durations. Its Bellman equation is V(s) = max_o [R_o(s) + Σ_s′ P_o(s, s′) V(s′)], with the discount folded into P_o. Because Σ_s′ P_o(s, s′) ≤ γ for every option, this is a γ-contraction, so value iteration with option models converges, and Q-learning on option-level transitions converges under the usual step-size conditions.

Planning is faster, not better. If the primitive actions are among the choices, the SMDP’s optimal value equals the MDP’s: options add choices whose values are achievable by some policy, so they cannot exceed V*, and the primitives can still achieve V*. What changes is how fast value spreads: a primitive backup moves value one cell per sweep, an option backup moves it across a whole room.

Options alone can be suboptimal. If only options are available, the agent can only follow behaviour the options produce; when the goal is not an option’s target, the best SMDP policy may be strictly worse than the MDP optimum.

Reward is unchanged by the hierarchy. An option’s model is just the expectation of the ordinary rewards and discounts along its run, so no new reward is introduced. Intra-option learning goes further and updates every option consistent with each primitive step, using experience far more efficiently.

📝 Quick check (Level 3)
0/3 answered
  1. 1. With primitives available, options change the optimal value…
  2. 2. The SMDP Bellman operator is a contraction because…
  3. 3. With options only, the best plan can be…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much do hallway options speed up planning and learning in four rooms, and what happens when the goal is not one of their targets?

History.

  • P. Dayan and G. Hinton (1993) introduced feudal reinforcement learning; R. Parr and S. Russell (1998) introduced hierarchies of abstract machines (HAMs).
  • R. Sutton, D. Precup and S. Singh (1999) introduced the options framework and the four-rooms domain; T. Dietterich (2000) introduced the MAXQ value decomposition.
  • A. McGovern and A. Barto (2001) and Ö. Şimşek and A. Barto (2008) discovered subgoals as bottleneck states.
  • P.-L. Bacon, J. Harb and D. Precup (2017) introduced option-critic; A. Vezhnevets and colleagues (2017) introduced FeUdal Networks; O. Nachum and colleagues (2018) introduced HIRO; A. Levy and colleagues (2019) introduced hierarchical actor-critic (HAC).

Exercise 2.

  • SMDP Q-learning with α = 0.125, ε-greedy with ε = 0.1 over the choices available in each state, Q starting at 0. Six runs of 120 episodes for each choice set, with the goal either in the east hallway (an option target) or inside the bottom-right room (not a target).
  • Also exact: the optimal start value with each choice set, and the number of value-iteration sweeps before the start value becomes positive.

Seed 0:

goal choices steps per episode, episodes 1–10 episodes 101–120 total steps optimal start value sweeps until value reaches the start
hallway primitives 512.9 37.9 11,543 0.0931 14
hallway options + primitives 51.3 31.8 3,923 0.0931 2
hallway options only 35.5 30.6 3,770 0.0820 2
room primitives 533.6 45.4 13,743 0.0625 16
room options + primitives 66.8 45.2 5,772 0.0625 3
room options only 55.0 49.8 6,173 0.0488 3
  • Options made early learning about ten times faster: with the hallway goal the first 10 episodes took 51.3 steps on average instead of 512.9 (39.6 against 505.6 on seed 1; 39.6 against 472.2 on seed 2). Total steps over 120 episodes fell by a factor of 2.3 to 2.9 across goals and seeds.
  • Planning sped up the same way: value reached the start state after 2 sweeps instead of 14 (hallway goal) and 3 instead of 16 (room goal), with the same converged start value when primitives are kept.
  • Options alone cost optimality: the best options-only policy is worth 0.0820 against 0.0931 for the hallway goal and 0.0488 against 0.0625 for the room goal, because the options’ fixed routes are not the fastest routes to every cell. In learning, options alone were quickest at first but their late episodes were not reliably shorter (49.8 against 45.4 steps on seed 0, 43.4 against 45.8 on seed 1); the exact values settle the comparison.
  • Exercise 1: start value first positive after 14 sweeps with primitives and 2 with options; both converge to 0.09311, and options alone to 0.08203.
🐍 Exercise 2 (research): how much do hallway options speed up planning and learning in four rooms, and what happens when the goal is not one of their targets?
Run SMDP Q-learning with primitive actions, options plus primitives, and options alone, for a goal at a hallway and a goal inside a room, and compare learning speed and the exact optimal values of each choice set.

Hierarchy in practice

  • Robotics: libraries of motion primitives or skills (pick, place, push) are sequenced by a high-level planner or policy; this is the norm in deployed systems.
  • Goal-conditioned RL: HIRO, HAC and director-style agents learn a high-level policy that outputs subgoals for a low-level controller.
  • Skill discovery: unsupervised methods such as DIAYN learn diverse skills without reward, later reused as options (topic L5-7).
  • Language-model agents: planning with subtasks and tool calls is a hierarchy over learned or hand-written skills.

References

  1. R. Sutton, D. Precup and S. Singh (1999). “Between MDPs and semi-MDPs: a framework for temporal abstraction in reinforcement learning.” Artificial Intelligence.
  2. T. Dietterich (2000). “Hierarchical reinforcement learning with the MAXQ value function decomposition.” JAIR.
  3. P.-L. Bacon, J. Harb and D. Precup (2017). “The option-critic architecture.” AAAI.
  4. O. Nachum, S. Gu, H. Lee and S. Levine (2018). “Data-efficient hierarchical reinforcement learning.” NeurIPS.
  5. Ö. Şimşek and A. Barto (2008). “Skill characterization based on betweenness.” NeurIPS.