Options & Hierarchical RL
Semi-MDPs, the option-critic and feudal agents.
An option is an action that can last: walk to the door, grasp the cup. Adding options to an MDP changes its time scale without changing its theory, because the result is a semi-MDP with Bellman equations of its own. Options can then be planned with, interrupted, learned about off-policy, trained end to end and even discovered. This lesson develops that theory and then asks the empirical question that has followed hierarchical RL from the start: when does any of it actually help?
What you’ll learn
- Derive the Bellman equations over options from the return, show that they contract at rate , and prove that interrupting options never hurts.
- Write intra-option Q-learning and state the conditions under which it learns the values of all options from a single stream of experience.
- State the option-critic's intra-option policy gradient and termination gradient theorems, derive the termination gradient, and explain why learned options degenerate.
- Explain HIRO's off-policy correction for goal-setting managers, option discovery from the graph Laplacian, and what the evidence says about when hierarchy helps.
Options make a semi-MDP
Recall the definition from Hierarchy, Meta-Learning & Generalist Agents: an option starts in a state of , follows , and stops on arrival in with probability . It is Markov if and depend only on the current state, and semi-Markov if they may depend on the history since the option started, which allows, for example, time-outs and options that call other options. A policy over options chooses among the options available in whenever the current one ends.
Start option in at time and let be its random duration. Split the return where the option ends: what was collected while ran, plus the return from where it ended, steps later:
Take expectations given and the choice of . For Markov options the future after termination depends only on , so the value splits into the option's model, its discounted reward and discounted end-state measure :
Choosing the best option at every decision gives the optimality equation. It is an ordinary Bellman equation with the discount folded into , and its operator contracts with modulus . If every option lasts at least steps the modulus is at most . Once the primitive actions are included, as they must be for the equality below, the modulus is again; options then speed planning in another way, when it starts from pessimistic values (the four-rooms demonstration started from 0): a long option carries value many cells in one backup (Mann & Mannor, 2014).
Every policy over options is a (generally non-Markov) policy of the underlying MDP, so options cannot beat the MDP's optimum. If contains every primitive action, a deterministic optimal MDP policy is itself a policy over , and equality holds:
In a four-rooms gridworld, contains only hallway options, each taking the agent from anywhere in a room to one of its doorways, and no primitive actions. The goal is a cell in the middle of a room. What is true?
- , since options are only shortcuts
- , since options plan further ahead
- , and here strictly less: no policy over these options ever reaches the goal
- The semi-MDP is not well defined without primitive actions
Show the answer
C. , and here strictly less: no policy over these options ever reaches the goal
Every option ends in a doorway, so no sequence of them reaches a cell inside a room. Options restrict the set of policies unless they include the primitives (or options that can express an optimal policy). Sutton, Precup & Singh's remedy is to plan with options and primitive actions, which keeps and still speeds planning.
Interruption and intra-option learning
Call-and-return execution commits to an option until it ends. That is wasteful when, halfway along, the option has become a bad idea, and it is wasteful in learning, where each experience updates only the option that happened to be running. Both can be fixed without leaving the theory.
Treat every time step as a decision point with two choices while runs: continue, worth , or terminate and re-choose, worth , both evaluated under . Wherever deviates from , it picks the better of the two:
So is greedy, at its deviation points, with respect to 's own values, and the policy improvement theorem applies in this finer semi-MDP: following for one decision and afterward is no worse than , and by induction neither is following throughout.
Intra-option learning extracts more from each step. While one option runs, every other Markov option whose policy would have taken the same action in the same state could have produced exactly this transition, so the transition is a valid sample for it as well, an off-policy argument at the level of options. The update bootstraps from the value of arriving in the next state with the option still running.
An option is running; the agent takes the action prescribes, receives and lands in , where , and . With , what is the intra-option target ?
Show the answer
5.5
, and the target is . The same transition also updates every other option whose policy would have chosen this action in this state, each with its own and .
Learning options end to end: the option-critic
So far the options were given. The option-critic (Bacon, Harb & Precup, 2017) learns them by gradient ascent: each option has a parameterized policy and termination function , and a policy over options picks among them (in the paper, -greedily with respect to ). Three value functions organize the computation:
Differentiate the value upon arrival. The product rule gives a direct term, through , and indirect terms, through the values:
depends on only through one step later, and is an average of under the (fixed) policy over options. So the indirect terms are the same derivative one step later, averaged over which option runs next: if it continued, a fresh choice if it stopped:
Unrolling the recursion collects the direct term at every future state–option pair, with its discounted probability, which is the theorem. Gradient ascent therefore raises the probability of terminating where the running option is worse than average, , and lowers it where the option is better. In practice the sum is sampled along the trajectory and is estimated from the learned .
Maximizing the return of one task gives options no reason to be distinct or to last, and learned options degenerate: they terminate at almost every step (back to primitive actions) or never terminate (one option does everything). Bacon et al. added a small margin to the advantage in the termination gradient, , which discourages switching; Harb, Bacon, Klissarov & Precup (2018) framed it as a deliberation cost, a price paid at each switch, motivated by bounded rationality. The deeper issue is that one task's return does not define what makes an option good. Options pay off through reuse, across tasks or over a long lifetime, which a single-task objective cannot see.
At state the running option has , while . Ignoring the margin, what does the termination gradient do to ?
- It raises it
- It lowers it
- It leaves it unchanged
- It pushes it toward 0.5
Show the answer
A. It raises it
: continuing is worse than handing control back. The term points in the direction that increases , so the option learns to stop here.
Managers and workers
Feudal RL (Dayan & Hinton, 1993) organizes learners as managers and sub-managers. A manager issues commands at a coarser time scale and rewards its sub-managers for carrying them out, whether or not that served the manager's own goal (reward hiding), and sub-managers need not know the manager's task (information hiding). FeUdal Networks (Vezhnevets et al., 2017) revived the idea with deep networks: a manager running at a lower temporal resolution emits a goal direction in a learned latent state space, and the worker is rewarded intrinsically for moving the latent state in that direction.
HIRO (Nachum, Gu, Lee & Levine, 2018) uses raw state displacements as goals, with off-policy learning at both levels. Every steps the high-level policy proposes a goal , a desired change of state; between proposals the goal is carried along, , so that it keeps pointing at the same target, and the low-level policy is rewarded with . The difficulty is non-stationarity: a stored high-level transition was produced by an older low-level policy, and today the same goal would lead elsewhere. HIRO relabels the stored goal with the one that best explains the stored low-level actions under the current low-level policy .
Hindsight at every level of the hierarchy gives Hierarchical Actor-Critic (Levy, Konidaris, Platt & Saenko, 2019). Some language-model agents of the mid-2020s are hierarchical too: ArCHer (Zhou et al., 2024) trains a high-level critic over whole utterances and a token-level policy beneath it (Training Multi-Turn Agents). In every case each level sees the others as part of a changing environment, the same non-stationarity that multi-agent learners face.
Where options come from, and when they help
Good options often end at bottlenecks, states such as doorways that join otherwise separate regions, which can be found from visitation statistics or graph cuts. Eigenoptions (Machado, Bellemare & Bowling, 2017) use spectral structure. Let be an eigenvector of the normalized Laplacian of the state-transition graph, a proto-value function (Mahadevan & Maggioni, 2007). It defines an intrinsic reward, the eigenpurpose , and its option is the policy that maximizes it, terminating where no action increases further. Eigenvectors with small eigenvalues vary slowly over the graph (the second one splits it into its two most weakly connected halves), so their options travel between distant regions.
For a random walk on an undirected graph, the successor representation has the same eigenvectors as the normalized Laplacian up to a fixed rescaling, which lets eigenoptions be computed from learned successor representations in large state spaces (Machado et al., 2018; Successor Representations & Features).
Covering options (Jinnai, Park, Abel & Konidaris, 2019) target exploration directly. The expected time for a random walk to visit every state, its cover time, has an upper bound that falls as the algebraic connectivity , the second-smallest Laplacian eigenvalue, grows. An option acts like a new edge. The paper works with the normalized Laplacian; the combinatorial Laplacian shows the idea most simply. For an unweighted edge , a simple and its unit eigenvector (the Fiedler vector), first-order perturbation theory gives
The first-order gain is largest for the two states at the extremes of . Covering options connects those two states with a pair of options, one in each direction, recomputes the Fiedler vector, and repeats, so each new option bridges the currently worst-connected parts of the state space:
When does hierarchy help? Nachum, Tang, Lu, Gu, Lee & Levine (2019) asked why hierarchical methods beat flat ones on their locomotion, navigation and manipulation tasks. Their experiments attributed most of the gain to exploration, temporally extended and semantically meaningful, rather than to easier policy learning: training the high level on temporally extended or semantically meaningful actions added little beyond the multi-step rewards that a flat agent can also use, and flat agents given exploration strategies inspired by hierarchy were competitive with the hierarchical methods. They state the conclusion as empirical and limited to the tasks they studied.
Theory points the same way. Regret analyses of learning with options (Fruit, Pirotta, Lazaric & Brunskill, 2017) make the dependence on the option set explicit, so that suitable options shrink the bounds and unsuitable ones enlarge them, and approximate value iteration with options, started from pessimistic values, can reach good policies in fewer iterations (Mann & Mannor, 2014). Options are a prior about the structure of good behavior: valuable when right, costly when wrong.
Key takeaways
- A set of options turns an MDP into a semi-MDP: values satisfy Bellman equations over discounted option models, which contract at rate ; , with equality when the primitive actions are included.
- Interrupting an option wherever continuing is worth less than re-choosing never hurts, and intra-option Q-learning learns the values of every consistent option from one stream of experience, bootstrapping from .
- The option-critic trains intra-option policies with and terminations with ; without a margin or deliberation cost, learned options degenerate.
- Feudal agents let managers set goals for workers; HIRO's relabeling of stale high-level actions makes off-policy hierarchies work; eigenoptions and covering options come from the graph Laplacian.
- The evidence suggests hierarchy helps mostly through exploration, and that options are a prior: valuable when they fit the problem, harmful when they do not.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why does value iteration over a good set of long options need fewer iterations than over primitive actions?
- Options have fewer parameters
- Its Bellman operator contracts with modulus , which is smaller than when options last many steps, and each backup moves value across many cells
- Options make the MDP deterministic
- Value iteration over options skips the max over actions
Show the answer
B. Its Bellman operator contracts with modulus , which is smaller than when options last many steps, and each backup moves value across many cells
The discount is folded into the option models, , so an option lasting at least steps contracts by or better. In the corridor example a single backup through the 5-step option moved the door's value five cells.
Intra-option Q-learning updates options that were not being executed. What makes a transition a valid sample for option ?
- was initiated in
- terminates in
- 's deterministic policy would have chosen in
- Any transition is valid for any option
Show the answer
C. 's deterministic policy would have chosen in
If , then running in would have produced exactly this transition, so it is an unbiased sample of 's one-step backup, whichever option was actually running: off-policy learning at the level of options.
Why do options learned by the option-critic without regularization tend to degenerate, terminating at every step or never?
- The termination gradient has the wrong sign
- The intra-option policy gradient is biased
- The policy over options is -greedy
- A single task's return gives options no reason to be distinct or to last, so switching every step or never switching can be just as good
Show the answer
D. A single task's return gives options no reason to be distinct or to last, so switching every step or never switching can be just as good
Both gradient theorems are exact for the return, and the return of one task is indifferent to how behavior is chunked. A margin or deliberation cost, or objectives that reward reuse across tasks, supply the missing pressure.
Why does HIRO relabel the goals stored in its high-level replay buffer?
- Because the low-level policy has changed, the stored goal no longer explains the low-level actions in that transition; a goal that makes them likely under the current low-level policy keeps the high-level data consistent
- To turn failures into successes for the goals actually reached, as in HER
- To save replay memory
- To make the high-level policy on-policy
Show the answer
A. Because the low-level policy has changed, the stored goal no longer explains the low-level actions in that transition; a goal that makes them likely under the current low-level policy keeps the high-level data consistent
A high-level transition is "action led to ", but the low-level behavior that produced it came from an older policy. Choosing the goal that maximizes the likelihood of the stored low-level actions under the current policy makes the transition look as if today's hierarchy had produced it.
Further reading
- R. S. Sutton, D. Precup & S. Singh, "Between MDPs and semi-MDPs: A framework for temporal abstraction in reinforcement learning," Artificial Intelligence 112, 181–211 (1999).
- P.-L. Bacon, J. Harb & D. Precup, "The option-critic architecture," AAAI (2017).
- O. Nachum, S. Gu, H. Lee & S. Levine, "Data-efficient hierarchical reinforcement learning," NeurIPS (2018).
- M. C. Machado, M. G. Bellemare & M. Bowling, "A Laplacian framework for option discovery in reinforcement learning," ICML (2017).
- O. Nachum, H. Tang, X. Lu, S. Gu, H. Lee & S. Levine, "Why does hierarchy (sometimes) work so well in reinforcement learning?," arXiv:1909.10618 (2019).