In reinforcement learning (RL), agents often struggle to learn in environments dominated by high external noise. This paper introduces Quantile Credit Assignment (QCA) and its extension Hindsight QCA (HQCA), two novel algorithms that use distributional reinforcement learning to formally define and subtract "luck" from an agent's rewards. By creating a luck-dependent baseline for policy gradients, QCA significantly reduces variance and enables agents to learn effectively in highly stochastic settings.
The Credit Assignment Problem
The "credit assignment problem" is the challenge of determining which specific actions led to an observed outcome. This is notoriously difficult in high-variance environments. Imagine a soccer player who scores a goal: was it a brilliant shot (skill), or did the goalkeeper just happen to slip at that exact moment (luck)?
Standard policy gradient methods use an average value function as a baseline, comparing the actual return to the average expected return. However, if the environment is very noisy, a "good" action might frequently result in a "bad" outcome due to bad luck. Because standard baselines only look at the average, they cannot distinguish between a poor choice and a stroke of misfortune. This leads to high variance in learning and often causes the agent to fail completely in complex tasks.
Methods: Formalizing Luck
To solve this, the authors propose two algorithms that leverage distributional value estimation.
1. Quantile Credit Assignment (QCA)
Instead of predicting just the mean return, QCA uses a neural network to predict the full distribution of returns via quantiles. It identifies the "luck level" (denoted as $\tau \in [0, 1]$) of an observed return. A high $\tau$ represents a lucky outcome (the top of the distribution), while a low $\tau$ represents an unlucky one.
The QCA Baseline: The algorithm calculates a baseline that is the expected return across all possible actions at that specific luck level. By subtracting this luck-conditioned baseline from the observed return, the agent receives a "luck-neutral" signal that purely reflects the advantage of the chosen action.
2. Hindsight QCA (HQCA)
Sometimes, the return alone isn't enough to determine how lucky an agent was. HQCA incorporates "hindsight" information—data collected after the action was taken—to better estimate the luck level. It uses a backward-running Recurrent Neural Network (RNN) to summarize the future trajectory, providing a more accurate picture of the environmental factors that influenced the final reward.
Datasets and Key Results
The authors evaluated their methods on three challenging, high-variance benchmarks:
- High-Variance Key-To-Door (HVKTD): A grid-world task where an agent must pick up a key early on to open a door much later. Between these events, the agent picks up "apples" that provide rewards sampled from a high-variance distribution, creating massive noise that masks the signal from the key.
- Random Key-To-Door (RKTD): Similar to HVKTD, but the "distraction" rewards are independent of the agent's behavior, acting as pure Gaussian noise.
- Combinatorial RL with Post-Decision Noise Feedback: A task where the noise level is explicitly revealed to the agent in a separate "answer room" after the action is taken, making it a perfect test for hindsight-based credit assignment.
Performance: In the Random Key-To-Door task, standard Policy Gradient (PG) and even prior hindsight methods like Counterfactual Credit Assignment (CCA) failed to learn entirely. In contrast, QCA and HQCA solved the environment rapidly. In High-Variance Key-To-Door, QCA achieved a "door opening probability" of nearly 1.0, while standard methods plateaued significantly lower or failed.
Stability: HQCA matched the performance of the previous best method (CCA) on the Combinatorial task but showed much lower variance between different training runs (seeds), indicating a more robust learning process.
Key Insights
- Luck as a Quantile: The most elegant idea in this paper is formalizing "luck" as the quantile level $\tau$. It provides a mathematically grounded way to talk about environmental randomness.
- Provable Variance Reduction: The authors show theoretically that the QCA baseline is unbiased and provides an advantage estimate with lower variance than the standard value-function baseline.
- Disentangling Skill: By conditioning the baseline on $\tau$, the agent effectively asks: "Given that the environment was this lucky/unlucky, how much better was my action than the average action would have been in this exact same situation?"
- Robustness: Unlike previous state-of-the-art methods (like CCA), QCA does not require complex "action-removal" losses to remain unbiased, making it much more stable and easier to tune.
Limitations and Future Work
While highly effective, the approach has a few limitations. The theoretical guarantees assume an "exact" quantile function, whereas in practice, neural networks provide an approximation. The impact of this approximation error in extremely complex environments remains to be fully explored. Additionally, training a full quantile distribution and a hindsight RNN is more computationally intensive than training a simple value-function baseline. Finally, while the benchmarks are extremely difficult credit assignment problems, they are still grid-worlds; future work will need to demonstrate how these methods scale to high-dimensional continuous control or complex 3D simulations.
Summary updated