Augmenting Replay in World Models for Continual Reinforcement Learning

Luke Yang, Levin Kuhlmann, Gideon KowadloarXiv 2024

TL;DR

This paper introduces WMAR, a novel model-based reinforcement learning (RL) approach that augments the replay buffer of the DreamerV3 algorithm. WMAR significantly improves continual learning performance, especially in preventing catastrophic forgetting, by employing a memory-efficient distribution-matching replay buffer, outperforming its model-free counterparts.

What Problem Does This Paper Address?

Continual Reinforcement Learning (RL) aims to train agents that can learn new tasks sequentially without forgetting previously acquired knowledge. A major hurdle is "catastrophic forgetting," where learning a new task erases knowledge of old ones. Traditional solutions often rely on large replay buffers to store past experiences, which can become computationally expensive and unscalable. This paper tackles the challenge of creating a more memory-efficient and scalable continual RL agent, particularly within the framework of model-based RL, which has the potential to leverage learned environment dynamics for better learning.

Methods

The core contribution is the WMAR (World Models with Augmented Replay) algorithm. WMAR builds upon the state-of-the-art model-based RL agent, DreamerV3. The key innovation lies in its augmented replay buffer, which consists of two components:

  • Short-term FIFO buffer (D₁): Similar to DreamerV3's buffer, it stores recent experiences to help the world model learn the current task.
  • Long-term global distribution matching (LTDM) buffer (D₂): This novel buffer stores a uniform random subset of "spliced rollouts" (short segments of experience) and aims to match the global training distribution. This is crucial for retaining knowledge of past tasks.

WMAR uses these two buffers in parallel, sampling uniformly from either for training. The paper also introduces spliced rollouts as a technique to manage memory by breaking long episodes into smaller, manageable chunks, which is particularly beneficial for the LTDM buffer. For exploration in tasks without shared structure, WMAR uses fixed-entropy regularization and predetermined reward scales.

Datasets

The experiments were conducted on two benchmark suites:

  • OpenAI Procgen: Used for tasks with shared structure, where tasks have similar environment dynamics and visual properties but with variations (e.g., visual perturbations).
  • Atari: Used for tasks without shared structure, where tasks have distinct environments and reward functions.

Key Insights and Ideas

  • Model-based RL is a strong candidate for Continual Learning: By learning a world model of the environment, agents can leverage learned dynamics for off-policy learning and data augmentation, which is highly beneficial in continual learning settings.
  • Memory-efficient replay is crucial for scalability: The paper demonstrates that a carefully designed, smaller replay buffer can be as effective, if not more so, than larger buffers, addressing a key limitation of existing methods.
  • Distribution matching is key to preventing forgetting: The LTDM buffer's ability to match the global training distribution, even with limited samples, proved vital in retaining knowledge across tasks, especially when tasks are dissimilar.
  • Spliced rollouts offer a practical solution for memory management: This technique allows for better control over data granularity and buffer size without significantly impacting performance.

Key Results

  • Substantial improvement in forgetting: WMAR exhibited significantly better forgetting characteristics than the baseline DreamerV3, especially on tasks without shared structure. In Atari tasks, WMAR showed "almost no forgetting."
  • Comparable performance on shared structure tasks: WMAR showed slight benefits over DreamerV3 on tasks with shared structure (Procgen CoinRun).
  • Effective skill transfer: WMAR demonstrated both forward and backward transfer of skills across tasks, indicating good plasticity and stability.
  • Memory efficiency: WMAR achieved its performance gains with a replay buffer that was approximately 2x smaller than DreamerV3's, while maintaining comparable performance.

Limitations and Future Work

  • Limited scope of experiments: The authors acknowledge that experiments could be expanded by increasing task sequence lengths, environment steps, and testing on more environments or against additional reference models.
  • Task ordering: Testing all task permutations is computationally prohibitive, so a fixed task order was used. Future work could explore randomizing task order to better approximate a wider range of CL scenarios.
  • Combining with other methods: The authors suggest combining WMAR with techniques like behavior cloning (e.g., from CLEAR) to address potential shifts in latent distributions and improve actor performance.
  • Finite buffer capacity: A fundamental limitation of any buffer-based method is its finite capacity. As more tasks are explored, older experiences will inevitably be lost, leading to some degree of forgetting.

Summary updated

Abstract

Continual RL requires an agent to learn new tasks without forgetting previous ones, while improving on both past and future tasks. The most common approaches use model-free algorithms and replay buffers can help to mitigate catastrophic forgetting, but often struggle with scalability due to large memory requirements. Biologically inspired replay suggests replay to a world model, aligning with model-based RL; as opposed to the common setting of replay in model-free algorithms. Model-based RL offers benefits for continual RL by leveraging knowledge of the environment, independent of policy. We introduce WMAR (World Models with Augmented Replay), a model-based RL algorithm with a memory-efficient distribution-matching replay buffer. WMAR extends the well known DreamerV3 algorithm, which employs a simple FIFO buffer and was not tested in continual RL. We evaluated WMAR and DreamerV3, with the same-size replay buffers. They were tested on two scenarios: tasks with shared structure using OpenAI Procgen and tasks without shared structure using the Atari benchmark. WMAR demonstrated favourable properties for continual RL considering metrics for forgetting as well as skill transfer on past and future tasks. Compared to DreamerV3, WMAR showed slight benefits in tasks with shared structure and substantially better forgetting characteristics on tasks without shared structure. Our results suggest that model-based RL with a memory-efficient replay buffer can be an effective approach to continual RL, justifying further research.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Atari · tasks without shared structureWMAR (World Models with Augmented Replay)Avg. forgetting0.071-0.59 vs baselinestructure=no-shared
Source quote
L222: WMAR │ 0.071 (0.026,0.082) │ -0.392 (-0.432,-0.357)
Procgen · CoinRun tasks with shared structureWMAR (World Models with Augmented Replay)Avg. forgetting-0.077-0.06 vs baselinetask=CoinRun · structure=shared
Source quote
L254: WMAR │ -0.077 (-0.103,-0.062) │ 0.316 (0.286,0.357)
Procgen · CoinRun tasks with shared structureWMAR (World Models with Augmented Replay)Avg. fwd. transfer0.316+0.02 vs baselinetask=CoinRun · structure=shared
Source quote
L254: WMAR │ -0.077 (-0.103,-0.062) │ 0.316 (0.286,0.357)
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
Atari · tasks without shared structureDV3' (DreamerV3 comparator) baselineAvg. forgetting0.665structure=no-shared
Source quote
L223: DV3' │ 0.665 (0.636,0.810) │ 1.049 (0.245,1.246)
Procgen · CoinRun tasks with shared structureDV3' (DreamerV3 comparator) baselineAvg. forgetting-0.019task=CoinRun · structure=shared
Source quote
L255: DV3' │ -0.019 (-0.050,0.010) │ 0.300 (0.239,0.335)
Procgen · CoinRun tasks with shared structureDV3' (DreamerV3 comparator) baselineAvg. fwd. transfer0.300task=CoinRun · structure=shared
Source quote
L255: DV3' │ -0.019 (-0.050,0.010) │ 0.300 (0.239,0.335)
BibTeX
@misc{yang2024augmenting,
  author = {Luke Yang and Levin Kuhlmann and Gideon Kowadlo},
  title = {{Augmenting Replay in World Models for Continual Reinforcement Learning}},
  year = {2024},
  eprint = {2401.16650},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.16650},
}
Figure