Abstract
Meta-reinforcement learning (meta-RL) aims to enable agents to adapt quickly to new tasks by leveraging experience from a distribution of related tasks. However, existing methods often struggle with sample efficiency and generalization to out-of-distribution tasks due to the conflation of task-specific adaptation with general control knowledge. We present TESP (Task Encoder and Shared Policy), a framework that decouples these components. TESP meta-learns a task encoder to translate past experiences into a latent embedding, which then conditions a single shared policy. Our results demonstrate that TESP achieves significantly higher sample efficiency and up to 4x higher returns than standard meta-RL baselines, maintaining robust performance even on novel, out-of-distribution tasks.
Introduction
Reinforcement Learning (RL) typically requires vast amounts of data and lacks the ability to generalize to even minor task variations. Meta-RL addresses this by "learning to learn," training agents across multiple tasks to facilitate rapid adaptation. A significant challenge in current gradient-based meta-RL methods, such as MAML, is the "conflation" problem: the entire policy network is adapted for each new task. This is often redundant because many tasks share underlying structural "commonness"—for instance, the physics of locomotion remain constant even if the target destination changes. TESP addresses this by explicitly separating task-specific "individuality" from general "commonness."
Methods
The TESP framework consists of two primary modules designed to separate task identification from execution:
- Task Encoder (TE): A Recurrent Neural Network (GRU) that processes sequences of states, actions, and rewards from previous episodes. It compresses this history into a low-dimensional task embedding that represents the specific requirements of the current task.
- Shared Policy: A Multi-Layer Perceptron (MLP) that receives both the current state observation and the task embedding. The parameters of this policy are shared across all tasks and remain fixed during the fast-adaptation phase.
The meta-learning process involves a "Fast-Update" phase where a meta-learned SGD optimizer updates the Task Encoder's weights based on a few episodes. Simultaneously, a "Meta-Update" optimizes the initial encoder weights, the optimizer's learning rates, and the Shared Policy parameters. To ensure high-quality embeddings, TESP utilizes an Episode Buffer that stores the $M$ highest-reward episodes for each task, preventing the encoder from learning from noisy, unsuccessful exploration data.
Experimental Setup
TESP was evaluated using the MuJoCo physics engine across four continuous control environments:
- Wheeled Locomotion: A mobile robot navigating to target locations.
- Ant Locomotion: A four-legged robot moving toward targets.
- 2-Link Reacher: A two-joint robotic arm reaching for targets.
- 4-Link Reacher: A four-joint robotic arm reaching for targets.
Tasks were categorized into training sets ($D$), novel tasks from the same distribution ($D'$), and out-of-distribution tasks ($D''$) to test generalization limits.
Key Insights
- Individuality vs. Commonness: By treating task-specific information as a conditional input to a universal control law, TESP avoids the inefficiencies of full-policy adaptation.
- Dense Guidance: Unlike methods where task information is implicit in updated weights, TESP provides the task embedding as a direct input at every timestep, offering immediate guidance.
- Embedding Regularization: Constraining task embeddings near the origin prevents overfitting to specific training values, which is crucial for generalizing to out-of-distribution tasks.
Results and Discussion
TESP significantly outperformed baselines like MAML and Meta-SGD, achieving 3 to 4 times higher returns in locomotion tasks. Notably, TESP demonstrated superior robustness; while baseline performance often collapsed on out-of-distribution tasks ($D''$), TESP maintained high returns. This suggests the shared policy successfully learned general physical principles rather than just memorizing training targets. Additionally, TESP exhibited lower variance across random seeds, indicating a more stable training process.
Conclusion and Future Work
TESP provides a scalable and efficient approach to meta-RL by decoupling task identification from control. Future work could explore more advanced encoder architectures, such as those utilizing attention mechanisms, or integrate TESP with Hierarchical RL to manage more complex task hierarchies. Refined buffer management strategies could also further enhance the quality of generated task embeddings.
Summary updated