The Primacy Bias in Deep Reinforcement Learning

Evgenii Nikishin, Max Schwarzer, Pierluca D'Oro, Pierre-Luc Bacon, Aaron Courville

TL;DR

Deep reinforcement learning agents frequently suffer from "primacy bias," where they overfit to early experiences and ignore crucial data encountered later in training. This paper demonstrates that periodically resetting the weights of a network's final layers while keeping its replay buffer intact completely breaks this vicious cycle. This simple, zero-computational-cost mechanism consistently boosts performance across both discrete and continuous control benchmarks.

What Problem Does This Paper Address?

In deep reinforcement learning (RL), agents learn by interacting with an environment and storing these experiences in an experience replay buffer. Because they train on a progressively growing dataset starting from scratch, they are highly vulnerable to overfitting to their very first interactions—a phenomenon the authors call primacy bias.

Primacy bias creates a damaging feedback loop: an overfitted agent performs poorly, which means it collects low-quality data, which in turn reinforces the poor, overfitted policy. Standard design choices intended to increase sample efficiency—such as high replay ratios (updating the network multiple times per environment step) or longer $n$-step targets—actually exacerbate this problem, trapping the agent in a permanently suboptimal state.

Methods

To combat primacy bias, the authors propose a remarkably simple solution: periodic resetting.

Instead of letting the network weights evolve indefinitely, they periodically re-initialize the parameters of the last few layers of the agent's neural network (and their corresponding optimizer statistics) back to a random distribution. Crucially, the replay buffer is preserved.

The exact implementation varies slightly depending on the architecture and domain:

  • SPR (Atari): Reset only the final linear layer of the 5-layer Q-network every $2 \times 10^4$ steps.
  • SAC (DeepMind Control Suite): Reset the entire network (all 3 layers) every $2 \times 10^5$ steps.
  • DrQ (DeepMind Control Suite): Reset the last 3 out of 7 layers of both the policy and value networks every $2 \times 10^5$ steps.

Datasets

The authors evaluated their resetting mechanism on two major reinforcement learning benchmarks:

  1. Atari 100k: A sample-efficient discrete control benchmark consisting of 26 games from the Arcade Learning Environment (ALE), where agents are strictly limited to 100k interaction steps.
  2. DeepMind Control Suite (DMC): A continuous control benchmark evaluated using both dense state features and raw pixels across various challenging tasks (e.g., quadruped-run, hopper-hop, humanoid-run).

Key Insights and Ideas

  • Learning Failure, Not Data Failure: By taking the replay buffer of a "failing," overfitted agent and using it to train a fresh agent from scratch, the fresh agent learns rapidly. This proves that the collected data contains the necessary signals; the overfitted agent simply lost the capacity to distill it.

    Figure 2. Undiscounted returns on quadruped-run for SAC trained with 9 updates per step. SAC failing is a standard agent; SAC with failing agent buffer is an agent ini- tialized with the replay buffer of the first agent, which allows it to learn quickly. Mean and std are estimated over 10 runs.
  • Heavy Priming is Fatal: Overtraining an agent on just its first 100 transitions can permanently cripple its ability to learn, even after a million subsequent environment steps.

    Figure 1. Undiscounted returns on quadruped-run for SAC with and without heavy priming on the first 100 transitions. An agent extremely affected by the primacy bias is unable to learn even after collecting hundreds of thousands of new transitions. Mean and std are estimated over 10 runs.
  • A Virtuous Circle: Resetting clears the negative priming from past iterations. Free from its old biases, the agent can leverage the accumulated data in the replay buffer to quickly recover and surpass its previous performance level.

    Diverse effects of resets across different DMC tasks
  • Superior to Standard Regularization: Traditional regularization methods like $L2$ weight decay or dropout fail to mitigate primacy bias or heavy priming, making periodic resets a uniquely suited mechanism for RL.

Key Results

Periodic resets consistently improved performance across all tested baselines without requiring additional computational overhead:

  • Atari 100k (SPR): Adding resets improved the Interquartile Mean (IQM) score from 0.380 to 0.478, a massive jump comparable to entirely new algorithmic iterations.
  • DMC (SAC & DrQ): On DMC tasks, SAC + resets improved the IQM from 501 to 656, while DrQ + resets improved the IQM from 569 to 762.
  • Enabling High Replay Ratios: Resets allowed agents to thrive at extreme replay ratios (e.g., 32 updates per step), where standard agents completely collapse due to overfitting.

Limitations and Future Work

  • Hyperparameter Tuning: The reset periodicity and the number of layers to reset are new hyperparameters that require manual tuning based on the domain's representation learning difficulty.
  • Temporary Performance Drops: Immediately following a reset, there is a brief dip in performance while the network relearns the final layer weights. While acceptable for final training performance, this is problematic for regret minimization settings (like real-world robotics) where consistent performance is required.
  • Future Directions: The authors suggest exploring adaptive resetting schedules based on feedback from the RL system or using meta-learning to automatically determine when and what to reset.

Summary updated

Abstract

This work identifies a common flaw of deep reinforcement learning (RL) algorithms: a tendency to rely on early interactions and ignore useful evidence encountered later. Because of training on progressively growing datasets, deep RL agents incur a risk of overfitting to earlier experiences, negatively affecting the rest of the learning process. Inspired by cognitive science, we refer to this effect as the primacy bias. Through a series of experiments, we dissect the algorithmic aspects of deep RL that exacerbate this bias. We then propose a simple yet generally-applicable mechanism that tackles the primacy bias by periodically resetting a part of the agent. We apply this mechanism to algorithms in both discrete (Atari 100k) and continuous action (DeepMind Control Suite) domains, consistently improving their performance.
BibTeX
@inproceedings{nikishin2022primacy,
  author = {Evgenii Nikishin and Max Schwarzer and Pierluca D'Oro and Pierre-Luc Bacon and Aaron Courville},
  title = {{The Primacy Bias in Deep Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=y1kcIuN4BcU},
}
Figure