This research, presented at AISTATS 2022, provides a fresh theoretical and practical look at how we represent and learn reward distributions in Reinforcement Learning. By connecting Quantile Regression to the Cramér distance, the authors simplify the mathematical foundations and accelerate the algorithms used in state-of-the-art agents.
The Problem: Quantile Crossing and Gradient Bias
In Distributional Reinforcement Learning (DRL), agents model the entire probability distribution of future returns rather than just the average expected reward. Two main paradigms exist: Categorical RL (like C51), which uses fixed "buckets," and Quantile Regression (like QR-DQN), which learns values at specific probability levels (e.g., the 10th percentile).
QR-DQN is popular because it doesn't require pre-defining the range of rewards. However, it faces two significant hurdles:
- Quantile Crossing: Neural networks might predict that a lower percentile (e.g., 20th) is higher than a higher percentile (e.g., 80th), which is physically impossible.
- Gradient Bias: While the 1-Wasserstein distance is the theoretical "gold standard" for comparing distributions, its gradients are biased when estimated from samples. This has historically forced researchers to use the Quantile Regression loss as a proxy.
The Cramér Perspective
The authors bridge this gap by proving that projecting an arbitrary distribution onto a "staircase" distribution (the kind used in QR-DQN) using the Cramér distance—the $\ell_2$ distance between Cumulative Distribution Functions—yields the exact same result as using the 1-Wasserstein distance.
Furthermore, they demonstrate that if a "non-crossing" constraint is enforced (ensuring percentiles stay in order), the gradients of the Quantile Regression loss and the squared Cramér loss are collinear. This means they point in the same direction, and optimization will follow the same path.
A More Efficient Algorithm
Beyond theoretical alignment, this perspective leads to a more efficient algorithm. While standard QR loss has a computational complexity of $O(N^2)$ (where $N$ is the number of quantiles), the authors propose a sort-based approach to compute the Cramér loss that runs in $O(N \log N)$. This allows for using a larger number of quantiles without the quadratic slowdown typical of QR-based methods.
Key Results on Atari-57
The proposed CR-DQN agent was evaluated against established baselines like DQN, C51, QR-DQN, and IQN on the standard suite of 57 Atari 2600 games. CR-DQN achieved a median human-normalized score of 201%, outperforming the original C51 (183%) and the standard QR-DQN (182%).
Key Insights and Ideas
- The Role of Monotonicity: The paper reveals that the "crossing quantile" problem is the fundamental difference between QR loss and Cramér loss. When quantiles are forced to stay in order, the two losses become functionally identical for gradient descent.
- Permutation Invariance: Because the new algorithm involves sorting predicted quantiles, the loss is "permutation invariant." The network doesn't have to learn which output neuron corresponds to which quantile level from the start, potentially easing the optimization landscape.
- Bias vs. Smoothness: "Huberizing" the QR loss (a common stability trick) introduces a bias that shrinks the predicted distribution. The Cramér loss avoids this bias but is less "smooth," leading to small oscillations that present an opportunity for future refinement.
Conclusion
By reframing Quantile Regression through the lens of the Cramér distance, the authors provide a more robust theoretical foundation and a more efficient computational path for Distributional RL. The resulting CR-DQN agent demonstrates that these theoretical insights translate directly into superior performance in complex, high-dimensional environments.
Summary updated