Unsupervised Zero-Shot Reinforcement Learning via Functional Reward Encodings

Kevin Frans, Seohong Park, Pieter Abbeel, Sergey Levine

Abstract

Reinforcement Learning (RL) has long sought to develop generalist agents capable of solving diverse tasks in a zero-shot manner. However, existing methods often rely on restrictive linear reward assumptions or require human-labeled task descriptions during pre-training. This paper introduces Functional Reward Encodings (FRE), a framework that pre-trains generalist agents on unlabeled offline data by learning to encode arbitrary reward functions into a latent space. Using a Transformer-based autoencoder, FRE enables agents to solve complex, non-linear tasks—such as robotic manipulation and maze navigation—using only a handful of reward-annotated samples at test time.

Introduction

The development of generalist agents is a central challenge in Reinforcement Learning. While Large Language Models (LLMs) have demonstrated remarkable zero-shot capabilities in the text domain, RL agents typically require extensive fine-tuning or specific task definitions to perform new objectives. Current zero-shot RL approaches, such as Successor Features (SF), often assume that rewards are linear combinations of pre-defined features. This assumption limits their applicability to complex, non-linear reward landscapes.

Functional Reward Encodings (FRE) addresses this by treating reward functions as objects that can be approximated through sampling. By training on a diverse set of "invented" unsupervised reward functions, FRE allows an agent to generalize to human-specified tasks without further training or fine-tuning.

Methodology

The FRE framework consists of three primary components: a reward encoder, a set of unsupervised reward priors, and a generalist policy.

1. The FRE Encoder

The core of the method is a Transformer-based Variational Auto-Encoder (VAE). The encoder takes a small set of $(state, reward)$ pairs—acting as "probes" of a specific task—and compresses them into a latent task embedding $z$. The use of a Transformer architecture ensures that the encoder is permutation-invariant, meaning the order of the sample pairs does not affect the resulting embedding.

2. Unsupervised Reward Priors

To train the agent on unlabeled data, the authors generate a variety of synthetic reward functions. These "priors" act as a training signal to help the agent learn a diverse range of behaviors:

  • Goal-reaching: Rewards for reaching specific states within the environment.
  • Random Linear Functions: Simple gradients across the state space.
  • Random MLPs: Complex, non-linear reward landscapes generated by random neural networks, which serve as a diverse basis set for general task representation.

3. Policy Training and Adaptation

The agent trains a generalist policy $\pi(a|s, z)$ using Implicit Q-Learning (IQL). The policy is conditioned on the latent embedding $z$ to maximize the reward function represented by that embedding. At test time, the agent is presented with approximately 32 samples of a new task. The FRE encoder generates the corresponding $z$, and the agent executes the policy zero-shot.

Experimental Evaluation

FRE was evaluated across three major offline RL benchmarks, focusing on its ability to generalize to unseen tasks.

  • AntMaze: A quadruped robot navigating a large maze. Tasks included goal-reaching and complex path-following (e.g., following a specific corridor or moving in a loop).
  • ExORL: Exploratory, non-expert trajectories in the Walker and Cheetah domains.
  • Kitchen: A robotic manipulation environment requiring the agent to interact with multiple objects like microwaves, kettles, and switches.

Key Results

FRE demonstrated significant performance gains over existing unsupervised and zero-shot baselines:

  • Aggregate Performance: On a normalized scale of 0-100, FRE achieved an average score of 57, compared to 24 for the Forward-Backward (FB) method and 18 for Successor Features (SF).
  • Task Complexity: In AntMaze, FRE was the first method to consistently solve non-linear path-following tasks zero-shot, a domain where linear-based methods failed entirely.
  • Manipulation: In the Kitchen environment, FRE scored 66, nearly doubling the performance of the next best unsupervised method (OPAL, 26) and matching the performance of goal-conditioned IQL (59), despite FRE being a more general learner.

Discussion and Insights

Several key insights emerged from the FRE framework:

  • Non-Linearity is Essential: By utilizing a neural network decoder rather than assuming a linear structure, FRE can represent and solve tasks with highly complex reward landscapes.
  • Diversity through Randomness: Training on "nonsense" tasks (random MLPs) proved highly effective. These random functions provide a diverse basis set that covers the space of possible human-defined objectives.
  • Sample Efficiency: While previous methods often required thousands of samples to identify a task at test time, FRE achieves high performance with just 32 samples, making it viable for real-world applications where reward labels are scarce.

Limitations and Future Work

Despite its success, FRE has limitations. The selection of reward priors (MLPs vs. linear functions) remains a hand-designed choice; identifying a truly domain-agnostic reward prior is an ongoing research question. Additionally, the current framework is strictly offline. Future work could explore extending FRE to online settings, where an agent might actively query for rewards to more accurately identify a task. Finally, the agent's performance remains constrained by the diversity of the initial unlabeled dataset; it cannot execute behaviors not represented in the underlying data distribution.

Summary updated

BibTeX
@inproceedings{frans2024unsupervised,
  author = {Kevin Frans and Seohong Park and Pieter Abbeel and Sergey Levine},
  title = {{Unsupervised Zero-Shot Reinforcement Learning via Functional Reward Encodings}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=a6wCNfIj8E},
}
Figure