Skip to main content
QUICK REVIEW

[Paper Review] An Equivalence between Loss Functions and Non-Uniform Sampling in Experience Replay

Scott Fujimoto, David Meger|arXiv (Cornell University)|Jul 12, 2020
Mental Health Research TopicsPsychology14 citations
TL;DR

This paper establishes a theoretical equivalence between non-uniform sampling in prioritized experience replay (PER) and a modified loss function, showing that any PER scheme can be replaced with uniform sampling using a transformed loss that produces the same expected gradient. Surprisingly, in some environments, standard PER can be replaced with uniform sampling and the new loss function without performance degradation, leading to the introduction of Loss-Adjusted Prioritized (LAP) and Prioritized Approximation Loss (PAL), which improve training stability and performance across MuJoCo and Atari environments.

ABSTRACT

Prioritized Experience Replay (PER) is a deep reinforcement learning technique in which agents learn from transitions sampled with non-uniform probability proportionate to their temporal-difference error. We show that any loss function evaluated with non-uniformly sampled data can be transformed into another uniformly sampled loss function with the same expected gradient. Surprisingly, we find in some environments PER can be replaced entirely by this new loss function without impact to empirical performance. Furthermore, this relationship suggests a new branch of improvements to PER by correcting its uniformly sampled loss function equivalent. We demonstrate the effectiveness of our proposed modifications to PER and the equivalent loss function in several MuJoCo and Atari environments.

Motivation & Objective

  • To establish a theoretical foundation for prioritized experience replay (PER) by linking non-uniform sampling to equivalent loss functions.
  • To address the lack of theoretical justification in PER, which is widely used but lacks formal grounding.
  • To demonstrate that the performance benefits of PER may stem from gradient equivalence rather than sampling bias alone.
  • To propose LAP and PAL as simplified, unbiased alternatives to PER that eliminate the need for importance sampling and reduce algorithmic complexity.
  • To empirically validate that the new methods outperform standard DQN and PER across MuJoCo and Atari benchmarks.

Proposed method

  • Derive a mathematical equivalence between the expected gradient of a loss function trained on non-uniformly sampled data and a different loss function trained on uniformly sampled data.
  • Transform any non-uniform sampling scheme into an equivalent uniformly sampled loss function by adjusting the loss based on the sampling priority distribution.
  • Propose Loss-Adjusted Prioritized (LAP) experience replay, which removes importance sampling and sets minimum priority to 1, reducing bias and preventing dead transitions.
  • Introduce Prioritized Approximation Loss (PAL), a weighted Huber-like loss that replicates the expected gradient of LAP without requiring non-uniform sampling.
  • Generalize the loss and priority functions to account for a learnable threshold κ, enabling better numerical stability and bias control.
  • Implement and evaluate LAP and PAL in standard DQN-based algorithms on MuJoCo and Atari environments using standard hyperparameters and evaluation protocols.

Experimental results

Research questions

  • RQ1Can non-uniform sampling in experience replay be theoretically equated to a modified loss function under uniform sampling?
  • RQ2Does the performance gain of PER stem from the sampling scheme itself or from the resulting gradient update?
  • RQ3Can PER be replaced with uniform sampling and a new loss function without sacrificing performance?
  • RQ4How can the bias introduced by importance sampling in PER be eliminated while preserving learning efficiency?
  • RQ5What improvements to PER can be derived from the equivalence between loss functions and sampling distributions?

Key findings

  • The expected gradient of a loss function trained on non-uniformly sampled data is mathematically equivalent to the expected gradient of a different, transformed loss function trained on uniformly sampled data.
  • In several MuJoCo and Atari environments, replacing PER with uniform sampling and the new Prioritized Approximation Loss (PAL) maintains or improves performance, indicating that the benefit of PER may come from gradient equivalence rather than sampling bias.
  • Loss-Adjusted Prioritized (LAP) experience replay outperforms standard PER by eliminating importance sampling and setting minimum priority to 1, reducing bias and preventing dead transitions.
  • The proposed PAL loss function, which generalizes the Huber loss with a learnable threshold κ, achieves the same expected gradient as LAP and can be integrated into any DQN-based algorithm with minimal code changes.
  • On the Humanoid task in MuJoCo, LAP and PAL achieve state-of-the-art performance, demonstrating significant gains over baseline DQN and PER.
  • Empirical results show that the variance-reducing properties of non-uniform sampling are often minimal, and in practice, the new loss-based approach can replace PER entirely without performance loss.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.