Overview
Hierarchical reinforcement learning decides at two time scales: a high-level policy proposes subgoals, and a low-level policy turns each subgoal into actions. When both levels learn off-policy, the high level faces a moving target. The low-level policy keeps changing, so the outcome of a subgoal stored in the replay buffer no longer reflects what the current low-level policy would do. Relabeling corrects the stored experience, yet the high-level policy can still propose subgoals that the low-level policy cannot reach.
SAGA addresses this with adversarial learning. Relabeled subgoals serve as examples of subgoals the current low-level policy reaches. A discriminator conditioned on the state learns to tell them apart from the subgoals generated by the high-level policy, and the high-level policy learns to make its subgoals indistinguishable from them. On Ant Maze, Ant Gather, Ant Push and Ant Fall, this improves both learning efficiency and final performance over the compared hierarchical methods.
The problem
Off-policy hierarchical learning is non-stationary: the same subgoal from the same state leads to different outcomes as the low-level policy learns, and the high level keeps proposing subgoals the low level cannot reach.
A reachable reference
Relabeled subgoals explain what the current low-level policy actually did, so they show which subgoals it can reach from each state.
An adversarial game
The high-level policy is the generator; a discriminator conditioned on the state separates generated from relabeled subgoals, and the high level learns to fool it.
The method in five minutes
A narrated walk-through of the problem, the idea and the mechanism, with data from an agent trained by the released code.
Subgoals the current low-level policy can reach
Four steps: the two-level framework, the non-stationarity that relabeling repairs, the adversarial game between the high-level policy and a discriminator, and the reason the discriminator looks at the state.
1 The two-level framework
Every steps, the high-level policy observes the state and proposes a subgoal : a desired change of the robot's position. It is rewarded with the environment reward collected over the next steps,
In between, the low-level policy chooses the primitive actions . Its reward is the negative distance to the subgoal, which is carried along as the robot moves so that it keeps pointing at the same place:
Both levels are trained concurrently and off-policy with TD3. In the paper, SAGA is built on HRAC as the base hierarchical model.
2 Non-stationarity, and what relabeling repairs
A high-level transition stores the state , the subgoal , the summed reward and the state reached steps later. That outcome was produced by the low-level policy of the time the transition was collected. Once the low-level policy has changed, the same subgoal from the same state leads elsewhere, so old high-level transitions describe a low-level policy that no longer exists. This makes off-policy training of the high level non-stationary.
Relabeling repairs the stored transitions. The stored subgoal is replaced by the subgoal under which the current low-level policy best explains the recorded low-level actions. For a deterministic low-level policy with Gaussian action noise, the log-likelihood reduces to a squared action error:
The maximum is taken over a few candidates: the stored subgoal, the displacement achieved over the steps, and samples around it. Relabel a recorded transition in the demo →
3 Adversarial subgoal generation
Relabeling changes what the high-level policy learns from, not what it proposes. The policy can still propose subgoals that the current low-level policy cannot reach, such as a point behind a wall or one too far away for steps. Such incompatible subgoals distort the high-level value function and hurt exploration.
Relabeled subgoals are the opposite: they explain what the current low-level policy actually did, so they are reachable by construction. Under stationary data they are assumed to approximate the subgoals of an optimal high-level policy, and a growing gap between generated and relabeled subgoals signals non-stationarity.
SAGA closes this gap with adversarial learning. The high-level policy is the generator . A discriminator outputs the probability that the subgoal is a relabeled subgoal for the state rather than one generated by the high-level policy. The two play the minimax game
where is the high-level replay buffer with relabeled subgoals. The discriminator learns to separate the two kinds of subgoals; the high-level policy learns to make its subgoals indistinguishable from relabeled ones.
4 Why the discriminator looks at the state
Whether a subgoal can be reached depends on where the robot is. Next to a wall, the subgoals behind it are out of reach; in an open corridor, many more are within reach. The discriminator and the generator are therefore both conditioned on the state, so the adversarial signal depends on where a subgoal is proposed. Move the robot in the demo →
5 The objective of the high-level policy
The high-level policy maximizes its value through the deterministic policy gradient of TD3,
and is updated with the combined gradient of the value and the adversarial term:
The weight balances the two terms. Larger values speed up learning but can slow down the learning of the value function, and very small values reduce the method to its base model; the paper uses on all tasks.
Training
All parts are trained concurrently, with TD3 at both levels and Adam for every network:
- Low-level policy: updated on its intrinsic reward, the negative distance to the subgoal.
- High-level critic: updated on high-level transitions whose subgoals are relabeled with the current low-level policy.
- Discriminator: updated on relabeled subgoals (real) and generated subgoals (fake) at the same states.
- High-level policy: updated with the combined gradient of its value and the adversarial term.
Settings in the paper: TD3 at both levels; actor and critic networks with three fully connected layers of width 300 and ReLU; a discriminator with layers of 300, 300 and 1 units, LeakyReLU (slope 0.2) and a sigmoid output; Adam for all networks; αadv = 0.001.
The method, computed live
One training run of the released code on the U-shaped Ant maze, from 25k to 1M steps. The robot’s motion comes from real simulations of the Ant that were recorded in advance, since the physics does not run in the browser; the high-level policy, the discriminator and the low-level policy are evaluated live in your browser from their exported weights.
Higher success, and subgoals the low level can reach
Ant Maze with dense and sparse reward and with top-down image observations, Ant Gather, Ant Push and Ant Fall; 5M environment steps; 10 seeds.
Final performance
| Ant Maze | Ant Maze Sparse | Ant Gather | Ant Push | Ant Fall | Ant Maze (Image) | |
|---|---|---|---|---|---|---|
| SAGA | 0.93 ± 0.01 | 0.92 ± 0.01 | 2.72 ± 0.07 | 0.72 ± 0.02 | 0.47 ± 0.02 | 0.87 ± 0.02 |
| HRAC | 0.83 ± 0.03 | 0.75 ± 0.08 | 2.19 ± 0.34 | 0.06 ± 0.06 | 0.11 ± 0.07 | 0.76 ± 0.03 |
| HIRO | 0.54 ± 0.06 | 0.29 ± 0.10 | 0.02 ± 0.02 | 0.00 ± 0.00 | 0.01 ± 0.01 | 0.53 ± 0.06 |
| LESSON | 0.81 ± 0.04 | – | – | 0.62 ± 0.02 | 0.38 ± 0.01 | 0.74 ± 0.06 |
| TD3 | 0.0 ± 0.0 | 0.01 ± 0.0 | 0.0 ± 0.0 | 0.0 ± 0.0 | 0.0 ± 0.0 | – |
Success rate (Ant Gather: episode reward) after 5M steps, mean ± standard error over 10 seeds.
Ablations
| Ant Maze | Ant Maze Sparse | Ant Gather | Ant Push | Ant Fall | |
|---|---|---|---|---|---|
| SAGA | 0.93 ± 0.01 | 0.92 ± 0.01 | 2.72 ± 0.07 | 0.72 ± 0.02 | 0.47 ± 0.02 |
| w/o state for D | 0.91 ± 0.02 | 0.88 ± 0.01 | 2.62 ± 0.06 | 0.58 ± 0.03 | 0.39 ± 0.03 |
| w/o state for D/G | 0.0 ± 0.0 | 0.19 ± 0.01 | 0.0 ± 0.0 | 0.0 ± 0.0 | 0.0 ± 0.0 |
| SAGA-HIRO | 0.58 ± 0.03 | 0.72 ± 0.04 | 0.18 ± 0.15 | 0.0 ± 0.0 | 0.11 ± 0.07 |
w/o state for D: the discriminator is not conditioned on the state. w/o state for D/G: neither network is conditioned on the state; the generator maps random noise to subgoals and no longer acts as the high-level actor. SAGA-HIRO: the same adversarial learning on HIRO as the base model, instead of HRAC.
Generated subgoals lie close to the reached positions
| Ant Maze | Ant Maze Sparse | Ant Gather | Ant Push | Ant Fall | |
|---|---|---|---|---|---|
| SAGA | 2.79 ± 0.08 | 2.13 ± 0.26 | 1.65 ± 0.52 | 2.62 ± 0.46 | 2.49 ± 0.23 |
| HRAC | 3.41 ± 0.31 | 4.38 ± 0.84 | 3.59 ± 0.91 | 4.95 ± 1.11 | 4.10 ± 1.03 |
| HIRO | 10.74 ± 1.05 | 14.14 ± 0.0 | 13.71 ± 1.15 | 9.38 ± 2.85 | 11.4 ± 1.69 |
Distance between the generated subgoal and the position reached at the end of the k-step low-level rollout, mean ± standard error over 10 seeds.
BibTeX
@inproceedings{wang2023saga,
title={State-Conditioned Adversarial Subgoal Generation},
author={Vivienne Huiling Wang and
Joni Pajarinen and
Tinghuai Wang and
Joni{-}Kristian K{\"{a}}m{\"{a}}r{\"{a}}inen},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={37},
number={8},
pages={10184--10191},
year={2023},
doi={10.1609/aaai.v37i8.26213}
}