Improving Generalization in Reinforcement Learning Through Forked Agents

Olivier Moulin, Vincent François-Lavet, Paul W. G. Elbers, Mark Hoogendoorn

TL;DR

While the "eco-system" approach in reinforcement learning prevents catastrophic forgetting by maintaining a pool of specialist agents, training new specialists from scratch is computationally expensive. This paper introduces "forked agent initialization," a method that leverages a continuously trained generalist agent to jumpstart new specialists, cutting training time by up to 6x while boosting generalization performance and stability.

What Problem Does This Paper Address?

Reinforcement learning (RL) agents are notorious for overfitting to their training environments. When dropped into a new, unseen environment, their performance often plummets. To combat this without suffering from "catastrophic forgetting" (where learning a new task erases memory of an old one), researchers previously proposed an eco-system approach. This method maintains a pool of specialist agents; when a new environment is encountered, the system either uses an existing agent that can solve it or trains a brand-new specialist.

However, training these new specialists from scratch requires massive amounts of environment interactions and computational resources. The authors aim to solve this efficiency bottleneck by optimizing how new agents are initialized, drawing inspiration from deep neural network initialization and transfer learning.

Methods

The authors build on the eco-system framework using Proximal Policy Optimization (PPO) and evaluate four distinct initialization strategies for newly spawned agents:

  1. Basic Initialization: The baseline approach where new agents start with random weights (no initialization).
  2. Random Initialization: The new agent copies the neural network weights of a randomly selected agent from the existing pool.
  3. Best Agent Initialization: The system tests the existing pool on the new environment and copies the weights of the agent that achieved the highest reward (even if it failed to meet the success threshold).
  4. Forked Agent Initialization (Novel): The authors introduce a "Main Agent" that lives outside the pool. This generalist agent is continuously trained on all environments where the eco-system struggled. When a new environment requires a new specialist, the system "forks" (copies) the Main Agent's weights to initialize it. After the new specialist finishes training, its weights replace the Main Agent's weights, ensuring the generalist keeps evolving.
Overview of Random, Best, and Forked agent initialization techniques
Detailed setup of the Forked Agent architecture

Datasets

The approaches were evaluated using MiniGrid FourRooms, a popular, procedurally generated gridworld environment. In this setup, the map layout, starting positions, goal locations, and obstacles are randomized based on an environment seed, forcing agents to learn generalized navigation strategies rather than memorizing a single layout.

The MiniGrid FourRooms environment layout

Key Insights and Ideas

  • Generalists make great teachers for specialists: Initializing a specialist with a generalist (the Forked Agent) that has seen multiple environments provides a massive head start. The agent already understands core features of the domain (like navigating doors or avoiding walls), requiring only fine-tuning for the specific new environment.
  • The Paradox of Pool Size: Counterintuitively, the superior generalization of forked agents leads to a slightly larger pool of agents over time. Because each forked agent generalizes better, their capabilities overlap in complex ways, making it harder for the eco-system's optimization algorithm to cleanly replace or prune older agents.
  • Random is worse than nothing: Initializing with a completely random agent from the pool actually degraded performance compared to basic random initialization, highlighting that bad or irrelevant transfer learning can actively hinder RL training.

Key Results

  • Massive Speedup: The Forked Agent approach required nearly half the training steps of the "Best Agent" and "Random" approaches to complete training across 500 environments. Compared to the original eco-system baseline (Basic Initialization), it was 6 times faster.
  • Superior Generalization: The Forked Agent achieved a significantly higher adaptability index (average reward on unseen environments) early in the training cycle (after just 50 environments) and maintained a higher reward throughout.
  • Increased Stability: The standard error across experimental runs was visibly smaller for the Forked Agent approach, indicating highly stable and predictable learning.

Limitations and Future Work

The authors note a couple of areas for improvement:

  • Predicting Generalization: Currently, the system must evaluate agents empirically by running them in the environment. Future work could involve predicting which agents are most likely to generalize to a new environment without running full inferences.
  • Reducing Inference Overhead: Finding ways to bypass checking every agent in the pool against a new environment would drastically reduce computational overhead.

Summary updated

BibTeX
@inproceedings{moulin2023improving,
  author = {Olivier Moulin and Vincent François-Lavet and Paul W. G. Elbers and Mark Hoogendoorn},
  title = {{Improving Generalization in Reinforcement Learning Through Forked Agents}},
  booktitle = {IEA/AIE},
  year = {2023},
  doi = {10.1007/978-3-031-36822-6\_22},
}
Figure