Abstract
We study zero-shot generalization in reinforcement learning - optimizing a policy on a set of training tasks such that it will perform well on a similar but unseen test task. To mitigate overfitting, previous work explored different notions of invariance to the task. However, on problems such as the ProcGen Maze, an adequate solution that is invariant to the task visualization does not exist, and therefore invariance-based approaches fail. Our insight is that learning a policy that $\textit{explores}$ the domain effectively is harder to memorize than a policy that maximizes reward for a specific task, and therefore we expect such learned behavior to generalize well; we indeed demonstrate this empirically on several domains that are difficult for invariance-based approaches. Our $\textit{Explore to Generalize}$ algorithm (ExpGen) builds on this insight: We train an additional ensemble of agents that optimize reward. At test time, either the ensemble agrees on an action, and we generalize well, or we take exploratory actions, which are guaranteed to generalize and drive us to a novel part of the state space, where the ensemble may potentially agree again. We show that our approach is the state-of-the-art on several tasks in the ProcGen challenge that have so far eluded effective generalization. For example, we demonstrate a success rate of $82\%$ on the Maze task and $74\%$ on Heist with $200$ training levels.
Introduction
Zero-Shot Generalization for Reinforcement Learning (ZSG-RL) aims to train an agent on a limited set of environments—such as 200 levels of a game—and have it perform optimally on a brand-new, unseen level. Traditionally, researchers have relied on invariance—teaching agents to ignore irrelevant visual features like background colors. However, this approach fails in "structural" tasks like the ProcGen Maze, where the layout itself is the critical information. In such cases, agents often "memorize" specific paths rather than learning navigation, leading to failure on new layouts due to epistemic uncertainty.
Researchers from Technion have developed ExpGen (Explore to Generalize), an algorithm that leverages a surprising discovery: policies trained to explore a domain generalize to unseen tasks far better than those trained to maximize rewards. By switching to a robust exploration policy whenever a reward-seeking ensemble is uncertain, ExpGen achieves state-of-the-art performance on notoriously difficult benchmarks.
Methods: The ExpGen Algorithm
ExpGen consists of two main components:
- A Maximum Entropy (maxEnt) Exploration Policy: Instead of seeking a goal, this policy is trained using an intrinsic reward to visit as many unique states as possible. A $k$-nearest neighbor ($k$-NN) estimator rewards the agent for reaching states that are "far" from others in its current trajectory.
- An Ensemble of Reward-Seekers: The agent also trains an ensemble of standard RL agents (using PPO) to maximize the actual game reward.
At test time, the algorithm follows a simple logic:
- Check for Consensus: If a majority of the reward-seeking ensemble agrees on an action, the agent takes that action.
- Explore on Disagreement: If the ensemble disagrees (indicating high epistemic uncertainty), the agent switches to the maxEnt exploration policy for a duration determined by a Geometric distribution to ensure meta-stability and prevent jittering.
Datasets and Evaluation
The primary evaluation is conducted on the ProcGen benchmark, a suite of 16 procedurally generated environments designed to test generalization. The study focuses on "hard" cases for previous algorithms, such as Maze, Heist, Jumper, and Miner, where structural layout changes significantly between levels.
Key Insights
A central finding is that exploration is harder to overfit than reward-seeking. A reward signal is "strong" and encourages memorization of the shortest path. In contrast, exploration is a "diffuse" signal; because the agent tries to see everything, it is much harder to overfit to a specific training level's layout.
The authors also present a "Hidden Maze" thought experiment, showing that even if walls and goals are hidden (making observations "invariant"), powerful agents still overfit by memorizing movement history. This proves that invariance alone cannot solve structural generalization. Exploration acts as a bridge: when lost, a trained maxEnt policy "knows" how to navigate corridors and avoid dead ends, driving the agent to a novel part of the state space where the reward-seeking ensemble might regain consensus.
Results
ExpGen sets a new state-of-the-art (SOTA) on the most challenging ProcGen tasks. On the Maze task, it achieved an 83% success rate on test levels (with 200 training levels), compared to the previous SOTA of 66%. In Heist, it reached a 74% success rate.
Furthermore, ExpGen shows synergy with invariance-based methods. When combined with IDAAC, it dominates across almost the entire ProcGen suite, proving that robust exploration and visual invariance are complementary strategies.
Limitations and Future Work
While effective, "exploring everything" can be unsafe in certain domains (e.g., jumping off a cliff). Future work could involve using an ensemble of advantage functions to weight exploration against known hazards. Additionally, while empirical evidence is strong, the theoretical reason why maxEnt generalizes so well remains an open question, potentially linked to mutual information between the policy and training data. Finally, the algorithm still struggles with games like Dodgeball, which may require different generalization strategies for complex multi-agent dynamics.
Summary updated