Learning a subspace of policies for online adaptation in Reinforcement Learning

Jean-Baptiste Gaya, Laure Soulier, Ludovic Denoyer

Introduction

Deep Reinforcement Learning (RL) has achieved remarkable success in controlled simulations, yet it remains notoriously brittle when deployed in the real world. Small variations in environmental dynamics—such as changes in friction, motor calibration, or sensor noise—often lead to catastrophic failure. While Meta-RL offers a solution by training agents across thousands of environments, many practical scenarios provide access to only a single training setting. This paper introduces the Line of Policies (LoP), a novel approach that learns a continuous spectrum of effective behaviors from a single environment, enabling rapid online adaptation to unforeseen shifts at test time.

The Line of Policies (LoP) Framework

The core innovation of LoP is the shift from learning a single point in the parameter space to learning an entire subspace of policies. Instead of optimizing one set of weights $\theta$, the method learns two "anchor" weight sets, $\theta_1$ and $\theta_2$. Any policy within the subspace can be represented by a linear interpolation:

$$\theta(z) = z\theta_1 + (1-z)\theta_2, \text{ where } z \in [0,1]$$

To ensure this subspace is useful, the authors optimize two primary objectives:

  1. Task Performance: Every policy along the line must be capable of solving the target task in the training environment.
  2. Parameter Diversity: To prevent the anchors from collapsing into a single point, an auxiliary loss based on cosine similarity is employed. This pushes the internal logic of the policies apart while maintaining their functional efficacy.
Visualizing the diversity of behaviors (gaits) for the Ant agent across different points z in the learned policy subspace.

At test time, adaptation is achieved through a simple "K-shot" process: the agent samples $K$ values of $z$, evaluates them for one episode each, and selects the best-performing policy for the new environment. This approach is elegant because it doesn't require extra neural networks (like discriminators) and is remarkably simple to implement on top of standard algorithms like PPO or A2C.

Experimental Evaluation and Robustness

The researchers evaluated LoP across 50 test variations, including classic control tasks, complex Brax environments (HalfCheetah, Ant), and pixel-based challenges like ProcGen.

A key strength of LoP is its robustness to sensor failure. In experiments with the "Ant" environment where 20% of sensors were randomly masked at test time, LoP maintained a reward of 2,008, significantly outperforming standard single-policy baselines which dropped to 1,026. Similarly, in the HalfCheetah environment with varying dynamics, LoP achieved an average reward of 10,589, compared to 7,697 for a standard policy and ~9,600 for previous diversity-based methods.

Generalization to Complex Environments

Beyond physical dynamics, LoP demonstrates impressive generalization in discrete navigation tasks. In MiniGrid, agents trained only on simple two-room mazes were able to successfully navigate complex four-room configurations. LoP achieved a success rate of 0.447, whereas standard policies largely failed with a success rate of only 0.169.

Navigation trajectories in MiniGrid environments, demonstrating the agent's ability to generalize to unseen maze configurations.

Conclusion

The Line of Policies (LoP) provides a simple yet powerful alternative to complex diversity-based RL methods. By focusing on parameter-space diversity rather than state-space exploration, LoP avoids the need for auxiliary discriminator networks and offers a stable, easy-to-implement framework for robust RL. While future work may explore more complex subspace geometries (such as Bézier curves), the current linear formulation already provides a significant leap in online adaptation capabilities.

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