Explore to Generalize in Zero-Shot RL

Ev Zisselman, Itai Lavie, Daniel Soudry, Aviv Tamar

TL;DR

Standard reinforcement learning (RL) agents often fail to generalize to unseen environments because they overfit to the specific reward paths of their training levels. This paper introduces Explore to Generalize (ExpGen), an algorithm based on the insight that a policy trained to explore an environment generalizes far better than one trained to maximize rewards. By combining an ensemble of reward-seeking agents with a robust exploration policy, ExpGen achieves state-of-the-art zero-shot generalization on notoriously difficult procedural tasks.

What Problem Does This Paper Address?

In zero-shot generalization for reinforcement learning (ZSG-RL), an agent is trained on a limited set of environments and expected to perform optimally in a new, unseen test environment.

To prevent agents from overfitting, previous approaches have focused on creating invariant policies—methods that train the agent to ignore superficial changes like background colors or textures. However, this strategy completely breaks down in environments where the core layout changes, such as in mazes or key-and-lock puzzles. In these environments, there is no simple visual shortcut to exploit; the agent must dynamically figure out the structure of the map. Instead of learning a generalized problem-solving strategy, standard RL agents simply memorize the exact trajectories needed to solve the training levels, leading to severe overfitting.

Screenshots of various ProcGen games highlighting visual and structural diversity.

Methods

The authors introduce Explore to Generalize (ExpGen), which splits the problem into two distinct behaviors: reward exploitation and robust exploration.

  1. Maximum Entropy Exploration Policy ($\pi_H$): The authors train an exploration agent using a maximum entropy (maxEnt) objective. Instead of looking for a game reward, this agent is explicitly rewarded (using an intrinsic particle-based $k$-nearest neighbor estimator) for visiting as many unique states as possible. This policy is equipped with a recurrent memory unit (GRU) to help it keep track of where it has already been within an episode.
  2. Reward-Seeking Ensemble ($\{\pi_r^j\}_{j=1}^m$): Simultaneously, they train an ensemble of standard, memory-less agents to maximize the actual game reward.

At test time, these two components work together:

  • At each step, the reward-seeking ensemble votes on an action.
  • If a majority consensus ($k$ out of $m$ agents) is reached, the agent takes the agreed-upon action, exploiting its learned knowledge.
  • If the ensemble disagrees—signaling epistemic uncertainty (i.e., "we don't know where we are or what to do")—ExpGen hands control over to the maxEnt exploration policy.
  • The exploration policy runs for a randomized number of steps (sampled from a Geometric distribution to prevent the agent from getting stuck toggling back and forth), driving the agent to a novel part of the state space where the reward ensemble can hopefully reach a consensus again.

Datasets

The algorithm was evaluated using the OpenAI ProcGen benchmark, a standard suite of 16 procedurally generated game environments designed specifically to measure generalization in RL. The authors focused their analysis on games that are notoriously difficult for invariance-based methods due to shifting layouts, including Maze, Heist, Jumper, and Miner. Agents were trained on a restricted set of 200 levels and tested on completely unseen levels.

Key Insights and Ideas

  • Exploration is Harder to Memorize: The core "aha!" moment of the paper is that maximizing a specific reward provides a narrow, high-contrast signal that is easy for a neural network to overfit and memorize. Conversely, an exploration policy must learn to navigate varied spaces broadly, making it naturally resilient to overfitting. Empirically, the authors show that the "generalization gap" (the performance difference between training and testing environments) is incredibly small for maxEnt exploration policies.
  • Structured Exploration Beats Randomness: Previous ensemble methods (like LEEP) defaulted to taking purely random actions when the ensemble disagreed. ExpGen proves that replacing random actions with a structured, pre-trained exploration policy yields significantly faster and more effective problem-solving at test time.

Key Results

ExpGen sets a new state-of-the-art benchmark on ProcGen tasks that have historically eluded effective generalization:

  • On the Maze task with 200 training levels, ExpGen achieved a 83% success rate, vastly outperforming the previous best of 66%.
  • On Heist, it achieved a 74% success rate.
  • When combined with IDAAC (a leading invariance-based algorithm), ExpGen delivers the "best of both worlds," outperforming all prior methods across the aggregate ProcGen suite.
Figure 2: Normalized test Performance for Exp- Gen, LEEP, IDAAC, DAAC, and PPO, on five ProcGen games. ExpGen shows state-of-the-art performance on test levels of Maze, Heist and Jumper; games that are notoriously challenging for other leading approaches. The scores are nor- malized as proposed by [Cobbe et al., 2020].

Limitations and Future Work

  • Safety Concerns: ExpGen relies on unconstrained exploration when uncertain. In real-world applications (like robotics or autonomous driving), taking unhedged exploratory actions could lead to catastrophic failures. The authors suggest that future iterations could incorporate an ensemble of advantage functions to veto unsafe actions during exploration phases.
  • The Dodgeball Exception: The authors note that all current methods, including ExpGen, still perform poorly on the game Dodgeball. Determining whether Dodgeball requires a completely different algorithmic paradigm remains an open question.

Summary updated

BibTeX
@inproceedings{zisselman2023explore,
  author = {Ev Zisselman and Itai Lavie and Daniel Soudry and Aviv Tamar},
  title = {{Explore to Generalize in Zero-Shot RL}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=37cADkATD0},
}
Figure