NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Structure Detection for Contextual Reinforcement Learning

Tianyue Zhou, Jung-Hoon Cho, Cathy Wu

Abstract: Contextual Reinforcement Learning (CRL) tackles the problem of solving a set of related Contextual Markov Decision Processes (CMDPs) that vary across different context variables. Traditional approaches---independent training and multi-task learning---struggle with either excessive computational costs or negative transfer. A recently proposed multi-policy approach, Model-Based Transfer Learning (MBTL), has demonstrated effectiveness by strategically selecting a few tasks to train and zero-shot transfer. However, CMDPs encompass a wide range of problems, exhibiting structural properties that vary from problem to problem. As such, different task selection strategies are suitable for different CMDPs. In this work, we introduce Structure Detection MBTL (SD-MBTL), a generic framework that dynamically identifies the underlying generalization structure of CMDP and selects an appropriate MBTL algorithm. For instance, we observe Mountain structure in which generalization performance degrades from the training performance of the target task as the context difference increases. We thus propose M/GP-MBTL, which detects the structure and adaptively switches between a Gaussian Process-based approach and a clustering-based approach. Extensive experiments on synthetic data and CRL benchmarks—covering continuous control, traffic control, and agricultural management—show that M/GP-MBTL surpasses the strongest prior method by 12.49% on the aggregated metric. These results highlight the promise of online structure detection for guiding source task selection in complex CRL environments.

Introduction

In Contextual Reinforcement Learning (CRL), an agent must solve a family of related tasks that vary based on "context"—for example, a robot walking on different slopes or a traffic controller managing varying inflow rates. Standard approaches to this problem often fall short. Independent Training is computationally prohibitive, as training a separate policy for every possible context is too expensive. Conversely, Multi-task Learning often suffers from "negative transfer," where learning one task degrades performance on another.

Model-Based Transfer Learning (MBTL) offers a middle ground by training on a few "source" tasks and transferring them to others. However, existing MBTL methods typically use a "one-size-fits-all" strategy, usually based on Gaussian Processes (GP-MBTL), which fails to account for the unique structural properties of different environments. This work argues that environments possess distinct "generalization structures"—patterns in how performance drops as context changes—and introduces a meta-layer to detect these structures and select the optimal training tasks.

Methods: Structure Detection MBTL (SD-MBTL)

The proposed Structure Detection MBTL (SD-MBTL) framework acts as a meta-controller that observes early performance data to select the best task-selection algorithm for a given environment.

The SD-MBTL framework: Structure detection guides the selection of the task selection algorithm (e.g., GP-MBTL or M-MBTL) based on performance observations.

1. Structural Decomposition

The framework decomposes generalization performance into three components using functional ANOVA (Sobol-Hoeffding decomposition):

  • Policy Quality: The general effectiveness of the source policy.
  • Task Difficulty: The inherent difficulty of the target task.
  • Task Dissimilarity: The performance degradation caused by the "distance" between source and target contexts.

2. The "MOUNTAIN" Structure

A key contribution of this work is the identification of the MOUNTAIN structure. In this pattern, performance is highest at the training context and drops off linearly as the context changes, resembling a mountain peak. This structure is common in environments where generalization is highly sensitive to context shifts.

3. The M/GP-MBTL Algorithm

The specific implementation, M/GP-MBTL, uses two criteria—Small Variance and Slope—to determine if an environment fits the MOUNTAIN structure:

  • If MOUNTAIN is detected: The system employs M-MBTL, a new algorithm that treats task selection as a sequential clustering problem (similar to K-Means), which is highly efficient for linear-drop structures.
  • If NONE (General Structure) is detected: The system reverts to GP-MBTL, utilizing Gaussian Processes to model more complex, non-linear relationships.

Datasets and Evaluation

The approach was evaluated on synthetic data and four diverse CRL benchmarks with three-dimensional context spaces:

  • CartPole: Classic control varying pole length, pole mass, and cart mass.
  • BipedalWalker: A 4-joint robot with varying friction, gravity, and scale.
  • IntersectionZoo: A multi-agent traffic eco-driving simulator varying inflow, autonomous vehicle penetration, and signal timing.
  • CyclesGym: An agricultural management sim varying temperature, sunlight, and precipitation.

Key Results

Experimental results demonstrate that structure-awareness acts as a significant force multiplier in task selection. M/GP-MBTL outperformed the previous state-of-the-art (GP-MBTL) by 12.49% on an aggregated normalized metric.

Performance comparison of SD-MBTL variants against independent, multi-task, and random baselines across four CRL benchmarks.

In environments like BipedalWalker, the structure-aware M-MBTL reached near-optimal performance significantly faster than general-purpose methods. The detection mechanism proved robust, correctly identifying MOUNTAIN structures in BipedalWalker and CyclesGym while appropriately reverting to GP-MBTL for the more chaotic dynamics of IntersectionZoo.

Conclusion and Future Work

SD-MBTL demonstrates that identifying the "shape" of a context space allows for more efficient task selection than general probabilistic models alone. While currently focused on the MOUNTAIN structure, future work could expand the library of detectable structures to include "valleys" or "plateaus." Additionally, scaling this detection to higher-dimensional context spaces remains an important challenge for real-world robotics applications.

Summary updated

BibTeX
@inproceedings{zhou2026structure,
  author = {Tianyue Zhou and Jung-Hoon Cho and Cathy Wu},
  title = {{Structure Detection for Contextual Reinforcement Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i34.40137},
}
Figure