ICML 2024

Probabilistic Subgoal Representations for Hierarchical Reinforcement Learning

Vivienne Huiling Wang1Tinghuai Wang2Wenyan Yang3Joni-Kristian Kämäräinen3Joni Pajarinen1
1Aalto University2Huawei Helsinki Research Center3Tampere University
TL;DR  HLPS replaces the single, deterministic state-to-subgoal mapping of goal-conditioned hierarchical RL with a Gaussian-process posterior over mappings, learned jointly with the hierarchical policies and inferred online by a Kalman filter at constant cost per step.

Abstract

In goal-conditioned hierarchical reinforcement learning (HRL), a high-level policy specifies a subgoal for the low-level policy to reach. Effective HRL hinges on a suitable subgoal representation function, abstracting state space into latent subgoal space and inducing varied low-level behaviors. Existing methods adopt a subgoal representation that provides a deterministic mapping from state space to latent subgoal space. Instead, this paper utilizes Gaussian Processes (GPs) for the first probabilistic subgoal representation. Our method employs a GP prior on the latent subgoal space to learn a posterior distribution over the subgoal representation functions while exploiting the long-range correlation in the state space through learnable kernels. This enables an adaptive memory that integrates long-range subgoal information from prior planning steps allowing to cope with stochastic uncertainties. Furthermore, we propose a novel learning objective to facilitate the simultaneous learning of probabilistic subgoal representations and policies within a unified framework. In experiments, our approach outperforms state-of-the-art baselines in standard benchmarks but also in environments with stochastic elements and under diverse reward conditions. Additionally, our model shows promising capabilities in transferring low-level policies across different tasks.

1

Probabilistic subgoal representations

A continuum of possible representation functions instead of one deterministic mapping, reflecting stochastic uncertainty and adapting to new observations without redefining the model structure.

2

A unified learning objective

One objective that integrates the learning of probabilistic subgoal representations and hierarchical policies.

3

Lightweight online inference

A state-space form of the GP fuses the subgoal information of an arbitrary number of earlier planning steps with constant computation and memory.

Explainer video

The method in six minutes

A narrated walk-through that builds the representation, the objective and the online filter step by step, using data from a small training run of the released code.

Method

From a single mapping to a posterior over mappings

Four pieces: the two-level framework, the probabilistic representation, the learning objective, and an online filter that makes inference cheap.

1  The framework: subgoals live in a learned latent space

HLPS uses a two-level goal-conditioned HRL framework. Every steps the high-level policy proposes a subgoal in a low-dimensional latent subgoal space. In between, the low-level policy chooses primitive actions and receives an intrinsic reward, the negative Euclidean distance to the subgoal in that space:

The high-level policy maximizes the extrinsic reward collected over the steps. Both levels are trained with SAC; the method itself does not depend on this choice.

The representation maps a state into the subgoal space. It therefore fixes the high-level action space and defines the low-level reward, which is why a stable, well-behaved representation matters for both levels. See a trained agent run in the demo →

State space Representation φ Latent subgoal space Encoding layer s → f Latent GP z z g High-level policy proposes g every k steps Low-level policy acts to reach g action a state s subgoal g intrinsic reward −‖z′ − g‖
Hierarchical execution. One high-level step corresponds to k low-level steps. The representation maps states into the latent subgoal space, where the high-level policy acts and the low-level reward is defined.

2  A probabilistic subgoal representation

The representation function has two layers. An encoding layer, a small neural network, maps each state to an intermediate latent vector . A latent GP layer turns these vectors into the final subgoal representation .

We model as a noise-corrupted version of the true subgoal representation , which has a GP prior over states:

The kernel is a Matérn kernel on the distance between states. It makes the latent functions smooth (mean-square continuous, once differentiable, stationary) and gives similar states similar subgoal representations. Its magnitude , length-scale and the noise variance are learnable:

State spaceEncoding layerLatent GPSubgoal space si si+1 si+k ⋮ f(·)f(·)f(·) fifi+1fi+k zizi+1zi+k GP prior κ(sᵢ, sⱼ) γ², ℓ, σ² ⋮⋮ zizi+1zi+k
The representation function φ. A shared encoding layer produces the intermediate vectors f; the latent GP layer, whose kernel couples all states in view, produces the subgoal representations z.

For a set of states the posterior has a closed form. The subgoal representation is the posterior mean, and the posterior variance comes with it. The GP prior models the stochastic uncertainty of the subgoal space, which arises partly from environmental stochasticity and partly from unexplored regions of the state space:

Instead of one fixed mapping, HLPS keeps a continuum of possible representation functions. As more of the state space is explored the posterior is refined, so the representation adapts to new observations without changing the model structure, and the learnable kernel lets it use long-range correlations in the state space. Try it in the demo →

3  A learning objective for the representation and the policies

Pairs of states one low-level step apart should stay close in the subgoal space, while states one high-level step apart ( low-level steps) should be far from each other. The objective is

  • Softplus instead of a hinge. It removes the margin hyperparameter and gives continuous gradients, which allows finer adjustments of the subgoal space.
  • A ratio as weight. / measures relative distance among the intermediate vectors. Small ratios keep low-level transitions close; large ratios push high-level transitions apart. The loss focuses on relative rather than absolute differences.

Try it in the demo →

zizi+1zi+k pull together push apart one low-level step: Δ¹ small k low-level steps: Δᵏ large
The learning signal. Consecutive states are pulled together; states one high-level step apart are pushed apart. The weight is the ratio of the same two distances on the intermediate vectors.

The objective trains the encoding layer and the GP hyperparameters ( , , ) in the same loop as the policies, so the representation and the policies are learned together.

4  Online inference with a Kalman filter

Batch inference inverts the covariance matrix over all states of a trajectory, so its cost grows cubically with the number of states. During a rollout, states arrive in order, so the model can be relaxed to a Markov chain. A Matérn GP then has an exact state-space form, with constant memory and computation per state. With the learned hyperparameters, the prior is a linear dynamical model started from

whose evolution operator depends on the distance ΔSi between consecutive states:

Each new state triggers a prediction and a correction, resembling a Kalman filter:

Batch: all states at once Online: one state at a time N = 3N = 5N = 8 C grows with the trajectory: cost si−1 si si+1 predict μ̃, Σ̃ via Ψ(ΔS) fi−1fi correct zi: posterior mean μi, variance Σi fixed-size message: cost per step
Batch versus online. The online filter carries only a small message (mean and covariance of the latent state) from step to step, yet the estimate at step i depends on every earlier state: an adaptive memory of earlier planning steps. Try it in the demo →

The training loop

  1. Run both policies and store the experience in a replay buffer.
  2. Compute the intrinsic reward from the distance in the latent subgoal space.
  3. Update the low-level policy and the encoding layer at every time step, with the objective above.
  4. Update the high-level policy every steps.
  5. Update the GP hyperparameters every steps with a batch of state transitions from the buffer.

Settings in the paper: two-dimensional subgoal space; SAC at both levels with three fully connected layers of width 256; an encoding layer with one hidden layer of 100 units; high-level interval k = 50; GP hyperparameters updated every 100 steps with learning rate 1e-5; batch GP window of 3 states.

Interactive demo

See the core ideas move

Everything below runs in your browser. Panel 1 runs a hierarchical agent trained by the released code, with the environment and the subgoal representation space side by side. Panels 2–4 isolate one idea each. The networks, the filter and the numerical core are checked against the released Python implementation.

Citation

BibTeX

@inproceedings{vhwang2024,
  title={Probabilistic Subgoal Representations for Hierarchical Reinforcement learning},
  author={Vivienne Huiling Wang and
          Tinghuai Wang and
          Wenyan Yang and
          Joni{-}Kristian K{\"{a}}m{\"{a}}r{\"{a}}inen and
          Joni Pajarinen},
  booktitle={ICML},
  year={2024}
}