Abstract
Deep Reinforcement Learning (RL) agents often struggle with zero-shot transfer to new environments. This paper introduces function encoders, a novel representation learning method that treats RL tasks as functions (rewards or transitions) and decomposes them into a linear combination of learned, non-linear basis functions. By integrating these vector representations into standard RL architectures, the authors achieve state-of-the-art zero-shot transfer, enabling agents to solve unseen tasks at runtime without additional training.
Introduction
A significant hurdle in Deep RL is the brittleness of learned policies when faced with environmental shifts. An agent trained on flat terrain may fail entirely on ice because it lacks a mechanism to understand how the new dynamics relate to its prior experience. Traditional approaches using context variables or natural language often lack theoretical grounding for out-of-distribution tasks or require extensive domain-specific data. This work addresses the challenge of finding a universal, theoretically sound task description that facilitates zero-shot generalization.
Methodology
The proposed Function Encoder (FE) leverages principles from functional analysis, representing any task function as a weighted sum of basis functions.
The process involves four key components:
- Basis Functions ($g_i$): A set of non-linear basis functions (neural networks) are learned to span the space of potential tasks, such as varying friction levels or reward distributions.
- Coefficients ($c_i$): For a specific task $f$, the encoder computes coefficients via an inner product using Monte Carlo integration on a small batch of sample data from the current episode.
- Linearity: The mapping from a function to its representation is a linear operator. This ensures that if a new task is a linear combination of known tasks, its representation naturally reflects this relationship, promoting smooth generalization.
- RL Integration: These coefficients ($c_f$) are concatenated with the state input, allowing the policy $\pi(s, c_f)$ and value function $Q(s, a, c_f)$ to adapt instantly to the task's unique signature.
Experimental Evaluation
The FE approach was evaluated across three distinct domains:
- Hidden-Parameter System Identification: A Half-Cheetah environment with randomized physical properties (friction, gear ratios, etc.).
- Multi-Agent RL: A partially observable Game of Tag against diverse pre-trained adversaries.
- Multi-Task RL: Ms. Pacman with dynamic, non-explicit goal locations.
Results and Discussion
The Function Encoder demonstrated superior performance and efficiency compared to standard baselines and Transformer-based models.
Key findings include:
- Predictive Accuracy: In the Half-Cheetah System ID task, the FE + MLP configuration achieved a 37.5% reduction in Mean Squared Error (MSE) for dynamics prediction relative to the Transformer baseline.
- Computational Efficiency: Unlike memory-intensive Transformers, FE training only added a 5% overhead compared to a basic MLP, whereas Transformers increased training time by 194%.
- Zero-Shot Success: In Ms. Pacman, the FE approach yielded a 20% higher success rate than existing multi-task algorithms like FB or DQN+HER.
- Representational Alignment: Qualitative analysis confirmed that learned representations correlate strongly with underlying physical parameters, providing the agent with a predictable task landscape.
Conclusion
Function encoders provide a robust and efficient framework for zero-shot transfer in RL. By treating tasks as functions and utilizing linear operators for representation, the method ensures predictable generalization. While the current work assumes data availability for task identification, future research will focus on integrating FE with advanced exploration strategies to autonomously probe and identify new environments.
Summary updated