Zero-Shot Reinforcement Learning via Function Encoders

Tyler Ingebrand, Amy Zhang, ufuk topcu

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.

Overview of the Function Encoder architecture and its integration with RL algorithms.

The process involves four key components:

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Test MSE comparison across different architectures, highlighting the superior performance and convergence of FE-based methods.

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

BibTeX
@inproceedings{ingebrand2024zero,
  author = {Tyler Ingebrand and Amy Zhang and ufuk topcu},
  title = {{Zero-Shot Reinforcement Learning via Function Encoders}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=tHBLwSYnLf},
}
Figure