Learning a subspace of policies for online adaptation in Reinforcement Learning

Jean-Baptiste Gaya, Laure Soulier, Ludovic Denoyer

This paper, titled "Learning a Subspace of Policies for Online Adaptation in Reinforcement Learning," presents a clever solution to one of the most persistent headaches in Reinforcement Learning (RL): generalization.

In the real world, the environment you train in is rarely exactly the same as the one you deploy in. A robot trained in a sunny lab might struggle on a rainy sidewalk; a drone trained with a full battery might behave differently as its voltage drops. This paper proposes a way to bridge that gap without needing a massive "Meta-RL" training suite.

TL;DR

Instead of training a single "optimal" policy that might be brittle to change, the authors propose learning a subspace of policies (a "Line of Policies" or LoP). At test time, when faced with a new environment, the agent quickly samples a few points from this subspace to find the one that performs best under the new conditions.

What Problem Does This Paper Address?

Standard Deep RL algorithms are notorious for overfitting to their training environment. If the physics constants (like gravity or friction) change even slightly at test time, performance often craters.

While Meta-RL exists to solve this, it typically requires access to a wide variety of training environments to learn how to adapt. In many practical cases, we only have one training environment. Previous attempts to solve this "single-environment adaptation" problem usually involve "diversity-based" methods that force the agent to try different behaviors (like walking backward or jumping). However, these often sacrifice performance on the main task or require complex, hard-to-tune components like discriminators.

Methods

The core idea is to learn a convex hull of policies in the parameter space.

  1. The Subspace: Instead of one set of weights $\theta$, the model maintains $N$ "anchor" sets of weights ($\theta_1, \dots, \theta_N$). Any policy in the subspace is a weighted average of these anchors: $\theta = \sum z_k \theta_k$.
  2. Line of Policies (LoP): The authors focus primarily on the $N=2$ case, where the subspace is simply a line segment connecting two sets of weights.
  3. Training: During training, the agent samples a value $z \in [0, 1]$, interpolates the weights, and performs a standard RL update (using PPO or A2C).
  4. Avoiding Collapse: To prevent the two anchor policies from becoming identical (which would collapse the line back into a single point), they add a regularization term: a cosine similarity loss. This encourages the anchors to be different in the parameter space while still being effective at the task.
Different behaviors exhibited by policies sampled along the learned Line of Policies (LoP) for the Ant environment.
  1. Adaptation: At test time, the agent performs "K-shot adaptation." It tries $K$ different policies along the line, evaluates them for one or more episodes, and then sticks with the best-performing one for that specific environment.

Datasets

The authors evaluated their approach across a diverse range of benchmarks:

  • Classic Control: CartPole, Acrobot, and Pendulum (with variations in mass and length).
  • Complex Control (Brax): HalfCheetah and Ant. They introduced "morphological" changes (e.g., "BigFeet," "TinyFriction") and even simulated hardware failure by masking out percentages of the agent's sensors ("DefectiveSensor").
  • Gridworlds: MiniGrid (testing on larger mazes than seen during training).
  • Vision-based RL: ProcGen (FruitBot), evaluating on unseen levels.

Key Insights and Ideas

  • Parameter Diversity vs. Behavioral Diversity: Unlike previous methods (like DIAYN) that force the agent to visit different states, LoP encourages the agent to have different internal logic (parameters). This allows multiple policies to be "optimal" in the training environment but react differently when the physics change.
  • Simplicity is a Feature: LoP doesn't require a discriminator or a complex intrinsic reward structure. It’s essentially a standard RL algorithm with a simple weight-interpolation layer and a penalty for weight similarity.
  • The "Line" Sweet Spot: Interestingly, the authors found that a simple line ($N=2$) often performed better or just as well as more complex shapes ($N=3$). This suggests that a single dimension of variation in parameter space is often enough to capture the necessary robustness.

Key Results

  • Superior Generalization: On the HalfCheetah benchmark, LoP achieved an average reward of 10,589, significantly outperforming a single policy (~7,697) and the diversity-based baseline DIAYN+R (~9,680).
Performance comparison of LoP against baselines on environments with morphological changes.
  • Robustness to Failure: In the "Ant" environment with 35% of sensors disabled, LoP was able to adapt and maintain high performance, whereas standard policies failed.
  • Ease of Tuning: The authors showed that LoP is much less sensitive to hyper-parameters (like the weight of the diversity term $\beta$) compared to baselines, making it more "plug-and-play" for researchers.

Limitations and Future Work

  • K-Shot Requirement: The method is not "zero-shot." It requires a few episodes of trial and error at test time to find the right policy on the line.
  • Subspace Shape: While the line worked well, the authors noted that for very complex tasks, a more sophisticated subspace geometry might be needed.
  • Future Directions: The authors suggest exploring different auxiliary losses to better control the "shape" of the learned subspace and applying this logic to continual learning settings, where the environment changes progressively over time.

Summary updated

BibTeX
@inproceedings{gaya2022learning,
  author = {Jean-Baptiste Gaya and Laure Soulier and Ludovic Denoyer},
  title = {{Learning a subspace of policies for online adaptation in Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=4Muj-t_4o4},
}
Figure