Memory-efficient Reinforcement Learning with Value-based Knowledge Consolidation

Qingfeng Lan, Yangchen Pan, Jun Luo, A. Rupam Mahmood

Abstract

Artificial neural networks are promising for general function approximation but challenging to train on non-independent or non-identically distributed data due to catastrophic forgetting. The experience replay buffer, a standard component in deep reinforcement learning, is often used to reduce forgetting and improve sample efficiency by storing experiences in a large buffer and using them for training later. However, a large replay buffer results in a heavy memory burden, especially for onboard and edge devices with limited memory capacities. We propose memory-efficient reinforcement learning algorithms based on the deep Q-network algorithm to alleviate this problem. Our algorithms reduce forgetting and maintain high sample efficiency by consolidating knowledge from the target Q-network to the current Q-network. Compared to baseline methods, our algorithms achieve comparable or better performance in both feature-based and image-based tasks while easing the burden of large experience replay buffers.

Introduction

Deep Reinforcement Learning (RL) typically relies on massive experience replay buffers to ensure stability and prevent catastrophic forgetting. In standard implementations like DQN, these buffers store millions of past transitions, requiring significant RAM. This "memory tax" poses a major barrier for deploying RL agents on resource-constrained hardware, such as drones, small robotics, or edge devices where memory is a finite and precious resource.

This paper introduces MeDQN (Memory-efficient DQN), a framework that significantly reduces memory requirements—by up to 90% or more—without sacrificing performance. By leveraging a "Knowledge Consolidation" loss, MeDQN allows agents to learn effectively with buffers that are 10x to 30,000x smaller than standard baselines.

Methodology: Value-based Knowledge Consolidation

The core innovation is treating the target network not just as a stability tool, but as an active "knowledge keeper." In standard DQN, the target network is a passive reference. MeDQN adds a second loss function to the training objective to actively preserve its insights:

  1. DQN Loss: Facilitates learning new knowledge from a minimal buffer of recent experiences.
  2. Consolidation Loss: Penalizes deviations between the current network's outputs and the target network's outputs on a set of sampled states. This ensures the network's functional mapping remains consistent even as it learns new data.
Comparison of learning dynamics: (a) Standard SGD exhibits catastrophic forgetting of the first half of the sine wave when training on the second half. (b) Knowledge consolidation preserves the previously learned mapping.

The authors propose two variants:

  • MeDQN(U) (Uniform Sampling): For low-dimensional tasks, the algorithm samples "pseudo-states" randomly from the environment's bounds, requiring zero additional memory for state storage.
  • MeDQN(R) (Real Sampling): For high-dimensional image tasks, a small fraction of real states are stored in a dedicated "state buffer" to guide consolidation.

A dynamic tuning parameter ($\lambda$) balances these losses, increasing over time to "lock in" knowledge as the agent matures.

Experimental Evaluation

The researchers evaluated MeDQN across diverse benchmarks:

  • Low-Dimensional Control: Mountain Car, Acrobot, Catcher, and Pixelcopter.
  • MinAtar: Simplified, high-speed Atari environments.
  • Atari 2600: Full-scale games including Battlezone, Double Dunk, and Q*bert.

Results and Discussion

MeDQN demonstrated extreme memory efficiency. In low-dimensional tasks, MeDQN(U) outperformed standard DQN using a buffer of only 32 transitions, compared to the baseline's 10,000. In high-dimensional Atari games, MeDQN(R) matched or exceeded DQN performance while reducing memory usage by 90% (e.g., reducing a 7GB buffer to 0.7GB).

Stability of greedy actions over training steps. MeDQN(U) demonstrates superior consistency in action selection compared to standard DQN and DQN with small buffers (DQN(S)).

Beyond memory savings, MeDQN variants were consistently faster to train in "wall-clock time." By mitigating catastrophic forgetting, the agent avoids the need to repeatedly re-learn optimal actions, leading to a nearly 5x speedup in games like Space Invaders.

Conclusion

MeDQN offers a practical path toward deploying sophisticated RL agents on edge hardware. By shifting the burden of memory from massive data storage to functional regularization via knowledge consolidation, the method achieves state-of-the-art performance with a fraction of the memory footprint. Future work includes using generative models to synthesize pseudo-states for image-based tasks, potentially eliminating the need for state buffers entirely.

Summary updated

BibTeX
@article{lan2023memory,
  author = {Qingfeng Lan and Yangchen Pan and Jun Luo and A. Rupam Mahmood},
  title = {{Memory-efficient Reinforcement Learning with Value-based Knowledge Consolidation}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=ex4zxQzJfUR},
}
Figure