TIMRL: A Novel Meta-Reinforcement Learning Framework for Non-Stationary and Multi-Task Environments

Chenyang Qi, Huiping Li, Panfeng HuangarXiv 2025 · DOI

Abstract

Meta-Reinforcement Learning (meta-RL) aims to enable agents to adapt rapidly to new tasks using minimal experience. However, traditional meta-RL methods often rely on single-modality task representations, which fail in non-stationary or complex multi-task environments. This paper introduces TIMRL (Task Inference with GMM and Transformer for efficient Meta-RL), a framework that replaces standard single-Gaussian task embeddings with a Gaussian Mixture Model (GMM) and a Transformer-based recognition network. By decoupling task inference from policy learning, TIMRL achieves significantly higher sample efficiency and task-identification accuracy than previous state-of-the-art methods.

Introduction

Reinforcement Learning (RL) agents typically require millions of interactions to master a single task. Meta-RL addresses this by teaching agents "how to learn," allowing for rapid adaptation. Despite this promise, current algorithms like PEARL assume stationary environments and use a single Gaussian distribution to represent tasks in a latent space. This creates a bottleneck in scenarios where a robot must switch between distinct behaviors (e.g., running forward vs. jumping). TIMRL overcomes this by providing a flexible, multi-modal latent space capable of capturing diverse task dynamics.

Methodology

TIMRL's architecture is built on three main pillars designed to enhance task inference and policy execution:

  1. Gaussian Mixture Model (GMM) for Task Latents: Instead of a single Gaussian, TIMRL utilizes a mixture of $K$ Gaussians. This allows the model to maintain a "library" of task representations, where each component corresponds to a specific behavior or environment state.
  2. Transformer-based Recognition Network: Identifying task shifts from a stream of experience (state, action, reward) requires processing temporal sequences. TIMRL employs a Transformer architecture, leveraging self-attention to efficiently extract relevant cues for task identification.
  3. Decoupled Supervised Training: To avoid the instability of learning task representations and policies simultaneously, TIMRL uses supervised learning with task labels to train the recognition network independently. This ensures the agent has a reliable task estimate before policy optimization.
Figure 3: The TIMRL architecture, featuring the Transformer-based recognition network and GMM task inference model integrated with a Soft Actor-Critic (SAC) policy.

Experimental Setup

The framework was evaluated using the MuJoCo physics engine across several challenging benchmarks:

  • Non-Stationary Environments: Modified versions of Half-Cheetah and Ant where target directions, velocities, or physical properties (e.g., flipping) change over time.
  • Multi-Task Environments: Complex scenarios requiring the agent to perform multiple classifications within a single episode, such as the "Cheetah-Vel/Goal/Dir" task.

Results and Discussion

TIMRL demonstrated substantial improvements over baseline methods like PEARL and CEMRL across all tested dimensions:

  • Superior Rewards: In non-stationary benchmarks, TIMRL consistently achieved higher average rewards and faster convergence. In the most complex multi-task scenarios, it was often the only algorithm to show steady learning progress.
  • High Recognition Accuracy: The Transformer-based network reached approximately 95% accuracy in identifying tasks within just five training epochs, whereas competing methods struggled to detect rapid task shifts.
  • Ablation Insights: Removing the recognition network led to a failure in convergence, confirming that accurate, multi-modal task identification is critical for performance in complex environments.
Figure 5: Average reward comparison in the Cheetah-Nonstat-Dir environment, showing TIMRL (blue) significantly outperforming baseline methods.

Conclusion and Future Work

TIMRL represents a significant step forward in meta-RL by successfully integrating multi-modal latent representations with powerful sequence modeling. While the current framework relies on supervised task labels during training, future research will explore unsupervised or self-supervised clustering to remove this dependency. Additionally, optimizing the computational overhead of the GMM-Transformer architecture remains a key area for further development.

Summary updated

BibTeX
@misc{qi2025timrl,
  author = {Chenyang Qi and Huiping Li and Panfeng Huang},
  title = {{TIMRL: A Novel Meta-Reinforcement Learning Framework for Non-Stationary and Multi-Task Environments}},
  year = {2025},
  eprint = {2501.07146},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.07146},
}
Figure