Explore to Generalize in Zero-Shot RL

Ev Zisselman, Itai Lavie, Daniel Soudry, Aviv Tamar

TL;DR

Reinforcement Learning (RL) agents often fail in new environments because they "memorize" specific paths to a reward rather than learning generalizable skills. This paper introduces ExpGen (Explore to Generalize), an algorithm that leverages the discovery that exploration-focused policies generalize far better than reward-maximizing ones. By switching to a robust exploration policy whenever a reward-seeking ensemble is uncertain, ExpGen achieves state-of-the-art results on the most difficult, memorization-prone tasks in the ProcGen benchmark.

What Problem Does This Paper Address?

In Zero-Shot Generalization for RL (ZSG-RL), we train an agent on a limited set of levels and expect it to perform optimally on a brand-new, unseen level. Most existing solutions rely on invariance: teaching the agent to ignore visual "distractions" like background colors or floor textures.

Examples of ProcGen environments, including BigFish, Plunder, Jumper, Maze, and Heist.

However, in games like Maze or Heist, the challenge isn't just visual noise—it's the structural layout itself. An agent trained on 200 mazes often simply memorizes the specific turns for those 200 levels. When it encounters a new maze, it has no "invariant" feature to rely on; the walls are in different places, and the old paths lead nowhere. This represents a failure of epistemic uncertainty—the agent doesn't know what to do because it hasn't seen this specific state configuration before.

Methods: The ExpGen Algorithm

The authors propose ExpGen, which tackles this memorization problem using two main components:

  1. A Maximum Entropy (maxEnt) Exploration Policy: Instead of looking for a goal, this policy is trained to visit as many unique states as possible. The authors use a non-parametric $k$-nearest neighbor ($k$-NN) estimator to calculate an "intrinsic reward" based on how far a state is from previously visited states in the same episode.
  2. An Ensemble of Reward-Seekers: They train a group of standard RL agents (like PPO) to maximize the actual game reward.

At Test Time: The agent evaluates the ensemble's suggested actions to determine its next move:

  • Consensus: If the majority of the ensemble agrees on an action, the agent assumes it "knows" this part of the state space and executes that action.
  • Disagreement: If the ensemble disagrees, it signals epistemic uncertainty. The agent then hands control over to the maxEnt exploration policy for a random number of steps (determined by a Geometric distribution to ensure meta-stability and prevent jittering). This exploratory wandering drives the agent into a novel part of the state space where the reward-seeking ensemble might eventually find its bearings and agree again.

Datasets

The primary evaluation is performed on the ProcGen benchmark, a suite of 16 procedurally generated environments designed specifically to test generalization. The authors focus heavily on the "hard" games for generalization: Maze, Heist, Jumper, and Miner. They specifically test the "low-data" regime (training on only 200 levels) to see how well the agents handle extreme novelty.

Key Insights

  • The Generalization Gap of Exploration: The most striking finding is that policies trained to explore have a much smaller "generalization gap" than those trained for rewards. In Maze, the generalization gap for a reward-based policy was 38.8%, while the maxEnt policy's gap was only 1.7%.
  • Reward as a "Distraction": Intuitively, a specific reward is a very strong signal that is easy to overfit. Exploration is naturally more varied and "reward-invariant," making it much harder for the neural network to memorize specific training instances.

Key Results

ExpGen sets a new State-of-the-Art (SOTA) on the most difficult ProcGen tasks that have historically eluded effective generalization:

The Maze environment, where ExpGen achieved a new state-of-the-art 83% success rate.
  • Maze: Achieved an 83% success rate (shattering the previous SOTA of 66%).
  • Heist: Achieved a 74% success rate.
  • Synergy with Invariance: When ExpGen is combined with IDAAC (a leading invariance-based method), it outperforms all previous methods across the entire ProcGen suite, gaining the best of both worlds.
  • Robustness: The authors show that even if you train for twice as long (100M steps), standard methods like IDAAC eventually plateau or even degrade in performance due to overfitting, whereas ExpGen remains robust.

Limitations and Future Work

  • Safety: In real-world robotics, "exploring" when you are uncertain can be dangerous (e.g., driving off a cliff). The authors suggest that in safety-critical domains, the ensemble should agree on what is unsafe rather than just what is optimal.
  • Dodgeball: This environment remains a "boss level" for RL generalization. Even ExpGen struggled to make significant progress on this specific game, suggesting it may require a different class of hierarchical or relational reasoning.
  • Theoretical Grounding: While the empirical results are exceptionally strong, the authors note that a formal theoretical proof of why maxEnt generalizes better (perhaps through the lens of mutual information) remains an open research 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