Skill-aware Mutual Information Optimisation for Zero-shot Generalisation in Reinforcement Learning

Xuehui Yu, Mhairi Dunion, Xin Li, Stefano V Albrecht

In Meta-Reinforcement Learning (Meta-RL), agents are trained across a variety of tasks with the goal of quickly adapting to new, unseen environments. To achieve this, agents typically rely on a "context encoder"—a module that processes a short snippet of recent experience (a trajectory) to produce a "context embedding." This embedding informs the agent about the specific dynamics of its current environment, such as whether a floor is slippery or an object is heavy.

While current state-of-the-art encoders use contrastive learning to generate these embeddings, they often struggle to generalize efficiently. This paper introduces Skill-aware Mutual Information (SaMI) and a corresponding estimator, SaNCE, to equip RL agents with the ability to identify and execute different skills across tasks, enabling zero-shot adaptation while requiring significantly fewer data samples.

The Challenge: Skill Blindness and the Log-$K$ Curse

Standard contrastive learning methods (like the InfoNCE objective) face two major hurdles in Meta-RL:

  1. Skill Blindness: Traditional encoders try to make embeddings from the same task look similar and embeddings from different tasks look different. However, this ignores the reality of physical environments. Different tasks might require the exact same skill (e.g., picking up a light block vs. a heavy block), while the same task might contain very different behaviors (e.g., a successful lift vs. a failed push).
Different environmental contexts dictate the optimal skill required, such as pushing a low-friction object versus lifting a low-mass one.
  1. The log-$K$ Curse: The mathematical bounds of standard contrastive objectives are limited by the number of samples ($K$). To learn complex tasks, these models require a massive number of samples, making them computationally expensive and highly sample-inefficient.

Methodology: Introducing SaMI and SaNCE

To overcome these limitations, the authors propose a two-part framework that shifts the focus from task IDs to distinct modes of behavior, or "skills."

  • Skill-aware Mutual Information (SaMI): Instead of solely analyzing the relationship between a context and a trajectory, SaMI introduces "skill" as a third variable. It optimizes for the information shared between the context, the skill being executed, and the resulting trajectory. By treating skill as a variable, the resulting SaMI objective becomes a tighter, more efficient target than standard Mutual Information. It effectively filters out "noise"—information in the trajectory that doesn't help the agent distinguish between necessary skills.
  • Skill-aware Noise Contrastive Estimation (SaNCE): To optimize the SaMI objective, the authors developed SaNCE. Unlike standard methods that pull all trajectories from the same task together, SaNCE identifies "positive" and "negative" skills within the same task. Finding negatives in the same task (e.g., failed attempts) is much more informative for an agent trying to learn the specific dynamics of its current environment.
  • Practical Sampling Strategy: To implement this without manually pre-defining skills, the framework ranks trajectories in the replay buffer by their total return. High-return trajectories act as "positive" skills (desired behavior), while low-return trajectories act as "negative" skills (undesired behavior). This allows distinct, effective behaviors to emerge naturally during training.

Experimental Setup: Challenging Benchmarks

The researchers evaluated their method on two major benchmarks, which they modified to be significantly more challenging and open-sourced for the community:

The modified Panda-gym environment introduces varying environmental features like mass and friction to test zero-shot generalization.
  • Modified Panda-gym: A robotic arm task where the agent must move a cube. The authors varied both cube mass and table friction simultaneously, requiring the agent to dynamically choose between "Pushing" and "Pick & Place" skills based on the inferred context.
  • Modified MuJoCo: Ten different environments (including Ant, Hopper, and Half-cheetah) modified with continuous environmental features (like mass and damping) and discrete "crippling" (e.g., making certain joints uncontrollable).

Key Results and Insights

The empirical results demonstrate that agents learning via SaMI achieve substantially improved zero-shot generalization:

  • Superior Generalization: In the Panda-gym "extreme" test set—featuring tasks far outside the training range—SaMI-based agents achieved a 36-37% success rate, whereas standard baselines struggled, scoring only between 11-29%.
  • Robustness to Small Samples: SaNCE maintains high performance even when the replay buffer or batch size is drastically reduced. This demonstrates its ability to overcome the log-$K$ curse, making it highly practical for real-world applications where data collection is expensive.
  • Emergent Versatility and Complex Adaptation: The agents learn a repertoire of skills rather than just memorizing a task. For example, on the "Crippled Ant" benchmark, SaMI agents learned to "roll" when fully capable but automatically switched to a "walking" gait when two legs were disabled—a complex transition that baseline models failed to execute effectively. Visualizations of the context encoder show it naturally clusters embeddings based on these emergent skills.

Limitations and Future Work

While highly promising, the current model assumes that environmental features (like mass and friction) are relatively independent. In reality, properties like a cube's material might affect both simultaneously, and the authors plan to explore correlated features in future iterations. Additionally, there remains an inherent trade-off in the estimator between maintaining a diverse set of samples and the numerical precision of the $K$-sample bound. Ultimately, while simulated results are strong, the next major frontier will be deploying these skill-aware agents on physical robotic hardware in unpredictable, real-world environments.

Summary updated

BibTeX
@inproceedings{yu2024skill,
  author = {Xuehui Yu and Mhairi Dunion and Xin Li and Stefano V Albrecht},
  title = {{Skill-aware Mutual Information Optimisation for Zero-shot Generalisation in Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=GtbwJ6mruI},
}
Figure