Replaying Hierarchical Imitation Without Stale Options

Two kinds of imitation learner have each fixed half of a problem. A hierarchical imitation learner (a two-level policy that picks a sub-skill and then runs it, learned from expert demonstrations with no sub-skill labels) handles long, multi-stage tasks well. A flat off-policy learner (a single-level policy that reuses past experience stored in a replay buffer) needs roughly ten times fewer interactions with the environment. Nobody has combined the two. The reason is not an oversight. The hierarchical methods judge the agent by which sub-skill it was running at each step. Once experience sits in a replay buffer, those stored sub-skill labels describe an old version of the policy, and the learning signal is computed on data that no longer describes the agent. We propose a simple fix and a test of it. Every time data is replayed, we re-infer the hidden sub-skill labels for agent data and expert data alike, using the current policy. Both sides are therefore always labeled by the same model, and the imitation reward is averaged over that fresh label estimate.

The payoff, if it works, is concrete. Long-horizon imitation benchmarks such as AntPusher, CloseMicrowave2 and FrankaKitchen are currently solved only by on-policy hierarchical learners, which throw away every interaction after one update. An off-policy version that keeps their final performance would make hierarchical imitation cheap enough to use where interactions are costly.

Core Claim

Adversarial imitation trains a classifier, called the discriminator, to tell expert behavior from agent behavior. The agent is then rewarded for fooling it, which pushes the agent to visit the same states and take the same actions as the expert. Generative Adversarial Imitation Learning introduced this with the reward $-\log(1-D(s,a))$.

Adversarial Option-Aware Hierarchical Imitation Learning (Option-GAIL) proved that for a two-level policy, matching state-action pairs is not enough. Different hierarchies can produce identical state-action statistics. What identifies the hierarchy is the joint distribution over the tuple $(s, a, o, o_{t-1})$, where $o$ is the current option (sub-skill) and $o_{t-1}$ the previous one. Option-GAIL therefore infers expert options by Viterbi decoding and trains on-policy. The same holds for its relatives:

  • Directed-Info GAIL pretrains skills with a variational autoencoder and then runs GAIL.
  • H-AIRL learns hierarchical rewards end-to-end.
  • MH-AIRL extends this to many tasks with five coupled networks.

All of these use on-policy policy-gradient optimizers, which motivates this work.

Our claim is that the barrier to going off-policy is label staleness, not replay itself, and that staleness is removed by symmetric hindsight relabeling. For a replayed segment $\tau$ of agent or expert data, we run the forward-backward algorithm under the current high- and low-level policies. This gives the posterior $q(o_t, o_{t-1}\mid\tau)$, the current model's belief about which options produced the segment. The discriminator is trained on expert and agent tuples, both weighted by their own $q$. The agent's reward is

$$r(s_t,a_t) = \sum_{o,o'} q(o_t{=}o,\,o_{t-1}{=}o' \mid \tau)\,\big[-\log\big(1 - D(s_t,a_t,o,o')\big)\big].$$

Here $D$ is the discriminator's probability that a tuple came from the expert. Because the same current posterior labels both sides, the discriminator cannot separate them by labeling artifacts. The only thing it can separate them by is genuine differences in the agent's behavior.

The dynamic-programming machinery is taken from Data-efficient Hindsight Off-policy Option Learning (HO2). HO2 marginalizes over options in hindsight so that every stored transition updates every option, but it needs a hand-written environment reward. Our contribution is to supply that reward from the discriminator and to apply the same posterior to the expert side. The posterior looks at the future of the segment, but it is used only for labeling and never as a policy input. This respects the causality concern that motivated Directed-Info GAIL.

Research Program

The system combines a two-level stochastic option policy with the off-policy machinery of Discriminator-Actor-Critic (DAC). From DAC we take a soft actor-critic learner, a replay buffer, absorbing states at episode ends, and a gradient penalty on the discriminator. The policy is optimized HO2-style, using weighted maximum likelihood under a trust region, and we add the adversarial reward above.

To bound compute, forward-backward runs over fixed-length windows sampled from the buffer rather than over whole trajectories. The window length is itself studied. A window that is too short makes the posterior uninformative, and one that is too long makes it expensive.

We also address a second gap exposed in DAC. DAC showed that ignoring termination creates survival or suicide biases: a fixed, untrained discriminator reached a third of expert Hopper performance through the survival bonus alone. No hierarchical imitation paper handles the analogous bias at option boundaries. There, an option can be implicitly rewarded for never ending, or for ending at every step. We will test whether treating the option-switch step as a separately scored event removes this.

The analysis tracks three quantities during training, each tied to a failure mode:

  • Label disagreement. How often the option stored at collection time disagrees with the current posterior. This measures staleness directly.
  • Held-out discriminator accuracy. Measured on fresh rollouts, to catch the replay overfitting that DAC had to suppress with a gradient penalty.
  • Option usage entropy and mean option duration. These catch collapse into a flat policy or constant switching.

Baselines

Do-nothing reference. A fixed, untrained discriminator driving the same off-policy learner. DAC showed this can look deceptively good through termination bias alone, so every gain must be reported above it.

Hierarchical behavior cloning. This uses zero environment interactions. On CloseMicrowave2, Option-GAIL reports H-BC at a reward of about 89.5, against about 100.7 for Option-GAIL and about 39.1 for flat GAIL. It is trained on the same demonstrations with the same option count.

Strongest hierarchical competitors. Option-GAIL and H-AIRL, run with their published on-policy optimizers, the same demonstration sets and the same option upper bound. H-AIRL reports a reward of about 114 on AntPusher, where other hierarchical baselines stayed below 82. On Kitchen-MultiSeq, MH-AIRL reports 352.59 against 212.13 for SMILE; we use this only as a reference point, since our method is not multi-task. The file gives no environment-step counts for Option-GAIL or H-AIRL: no reported result found on Lacuna for their sample complexity. We will therefore measure it ourselves by rerunning them.

Strongest flat competitor. DAC, which reports HalfCheetah convergence in about 1 million steps versus nearly 10 million for GAIL. We also run D2-Imitation, which replaces the adversarial game with off-policy TD learning on partitioned replay buffers and reports expert-level Walker2d and Swimmer in 100k to 200k steps. It is run from its official code.

Ablations. Three ablations isolate the key ingredient:

  • Stored-label replay: naive off-policy Option-GAIL that keeps the option recorded at collection time.
  • One-sided relabeling: agent data re-inferred, expert labels frozen from the start.
  • Viterbi relabeling: a single most-likely option sequence instead of the full posterior.

Fairness and the bar to clear. All methods get the same demonstrations, the same interaction budget, the same number of hyperparameter trials per method, and five or more seeds. Beating the baselines means two things. First, reaching the final reward we measure for Option-GAIL and H-AIRL on their own benchmarks with at least five times fewer environment steps. Second, beating tuned DAC at equal budget on the multi-stage tasks.

Why not just…?

Why not just run flat DAC for longer? This is the most serious threat, and the file does not settle it. The evidence that flat learners fail on CloseMicrowave2 (about 39.1 versus about 100.7) and AntPusher comes from flat on-policy GAIL, not from off-policy DAC. A well-tuned DAC might close much of that gap. We will run DAC with the same step budget and tuning trials on AntPusher, CloseMicrowave2 and FrankaKitchen. If it matches our method, the honest conclusion is that off-policy reuse, not hierarchy, was doing the work.

Why not just re-run Viterbi on replayed data, or relabel only the agent side? Either would be a much simpler patch to Option-GAIL, and either may be enough. That is why both are ablations rather than strawmen. Our prediction is that one-sided relabeling fails because the discriminator learns to separate expert from agent by their labeling procedures. Viterbi may nearly match full marginalization. If it does, we will report that the gain comes from symmetry and freshness, not from marginalization, and adopt the cheaper version.

Why not just use D2-Imitation, or hierarchical behavior cloning, and skip the adversarial game? D2-Imitation's duality argument is derived for deterministic flat policies, and option selection is stochastic and categorical. We still run it, because on single-stage tasks it may well win. Hierarchical cloning's roughly 89.5 on CloseMicrowave2 is a real ceiling for interaction-free methods. On long-horizon tasks, D4RL documents that cloning fails when trajectories must be stitched together, and PEAR reports that a supervised hierarchical baseline scored 0% on physical pick-and-place where its inverse-RL variant scored 80%.

Proposed Experiments

Main comparison. Learning curves in environment steps on AntPusher, CloseMicrowave2 and FrankaKitchen, using the same demonstration counts as the original papers. We report steps to reach 90% of the Option-GAIL or H-AIRL final reward as measured in our reruns, and final reward at a fixed one-million-step budget. Hopper and Walker2d serve as sanity checks, where we expect parity with DAC.

Mechanism check. Label disagreement should grow over training under stored-label replay and track its performance collapse, while staying bounded under symmetric relabeling. If stored-label replay performs as well as our method, the staleness hypothesis is wrong.

Termination-bias check. Repeat the untrained-discriminator test at option boundaries, with and without the option-switch correction. We expect degenerate option durations without it.

Headline conditions. The result is decisive in favor of the proposal only if two things hold on the multi-stage tasks. It must beat the Viterbi and one-sided ablations, and tuned DAC must fall short at equal budget.