CERTAIN: Context Uncertainty-aware One-Shot Adaptation for Context-based Offline Meta Reinforcement Learning

Hongtu Zhou, Ruiling Yang, Yakun Zhu, Haoqi Zhao, Hai Zhang, Di Zhang, Junqiao Zhao, Chen Ye, Changjun JiangICML 2025

TL;DR

CERTAIN introduces an uncertainty-aware framework for Context-based Offline Meta-Reinforcement Learning (COMRL) that enables agents to adapt to new tasks using just a single "one-shot" trajectory. By identifying and down-weighting ambiguous or out-of-distribution (OOD) data, the method improves adaptation performance by up to 36% over existing state-of-the-art baselines.

What Problem Does This Paper Address?

In the world of Reinforcement Learning (RL), "Meta-RL" aims to create agents that can quickly learn new tasks by drawing on past experience. Context-based Offline Meta-RL does this by looking at a small snippet of interaction—the "context"—to figure out which task it is currently facing.

However, most existing methods assume you have a perfect context or multiple rounds of interaction to "guess" the task. In real-world robotics, this is a luxury. You often get only one shot (one trajectory) to adapt, and that trajectory might be:

  1. Ambiguous: It looks like it could belong to multiple different tasks (e.g., a robot starting at the same point for two different goals).
  2. Out-of-Distribution (OOD): It contains transitions the agent never saw during its offline training phase.
Contexts consist of certain task-specific transitions and uncertain transitions that are either ambiguous or OOD.

If the agent relies on these "uncertain" transitions, it infers a wrong task representation, leading to policy failure. Most COMRL research has largely overlooked this intrinsic context ambiguity and distribution shift.

Methods

The authors propose CERTAIN (Context Uncertainty-aware One-Shot Adaptation), a plug-in framework that can be integrated into various COMRL algorithms (like classifier-based, reconstruction-based, and contrastive learning-based approaches). It consists of three main pillars:

  1. Uncertainty-aware Representation Learning: The model uses heteroscedastic uncertainty—meaning it learns to predict not just the task representation, but also how "sure" it is about that prediction based on the specific input context.
  2. Uncertainty-aware Context Collecting Policy: Instead of just wandering around, the agent is trained to actively seek out "low-uncertainty" transitions during its first one-shot trajectory. It essentially learns to go where the information is most reliable for task identification.
  3. Uncertain Context Restraining: During the inference phase, the agent doesn't treat all parts of its trajectory equally. It uses a weighted sum to prioritize "certain" transitions and ignore "uncertain" ones when calculating the final task representation.
Overview of the CERTAIN framework, including uncertainty estimation and the context collecting policy.

Datasets

The researchers evaluated CERTAIN on several standard RL benchmarks:

  • Point-Robot: A toy environment used for visualizing how the agent moves toward goals and handles ambiguity.
  • MuJoCo Environments: Four complex robotic simulations including Ant-Goal, Half-Cheetah-Vel, Walker-Rand-Params, and Hopper-Rand-Params. These test the agent's ability to handle varying goals and changing physical dynamics (like gravity or friction).

Key Insights and Ideas

  • Loss as a Proxy for Uncertainty: A key insight in the paper is the proof that task representation learning loss is positively correlated with context uncertainty. By minimizing a modified heteroscedastic loss, the model naturally learns to identify which transitions are "messy" or "confusing."
  • Active Information Seeking: Most agents just use whatever data they happen to get. CERTAIN's "collecting policy" is proactive; it understands that the area near the starting point is often ambiguous (high uncertainty) and moves toward task-specific regions to gain clarity faster.
  • Robustness through Weighting: By using a Softmax-based weighting system for transitions, the agent can effectively "filter out" OOD or ambiguous noise without needing a separate, complex OOD detection module.

Key Results

CERTAIN was tested against three major baselines (CLASSIFIER, FOCAL, and UNICORN) and consistently outperformed them:

  • Adaptation Boost: Improved one-shot adaptation performance by up to 36% in the Point-Robot environment.
  • Zero-Shot Success: Even before adaptation, the uncertainty-aware collecting policy improved zero-shot performance by up to 34%.
  • OOD Resilience: The model successfully identified OOD contexts (transitions from unseen areas) as having significantly higher uncertainty, preventing them from corrupting the task inference.

Limitations and Future Work

While powerful, CERTAIN has a few hurdles to clear:

  • Spurious Correlations: The method doesn't yet address "spurious correlations"—where an agent might latch onto a coincidental feature of the data that doesn't actually define the task.
  • Distinguishing OOD vs. Ambiguity: Currently, the model lumps OOD and ambiguity into one "uncertainty" bucket. Future work could involve disentangling these two to allow for even more specific adaptation strategies.
  • Dataset Quality: The authors noted that the method performs best on "medium-quality" offline data; extremely poor or extremely expert data can sometimes impair the uncertainty estimation.

Summary updated

BibTeX
@inproceedings{zhou2025certain,
  author = {Hongtu Zhou and Ruiling Yang and Yakun Zhu and Haoqi Zhao and Hai Zhang and Di Zhang and Junqiao Zhao and Chen Ye and Changjun Jiang},
  title = {{CERTAIN: Context Uncertainty-aware One-Shot Adaptation for Context-based Offline Meta Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=cx9AnB8rzi},
}
Figure