Introduction
Standard Reinforcement Learning (RL) typically focuses on maximizing expected returns. However, in safety-critical domains like finance or healthcare, managing risk—such as avoiding the worst-case 5% of outcomes (Conditional Value-at-Risk, or CVaR)—is paramount. While Distributional RL has emerged as a powerful tool for risk-sensitive RL (RSRL), this paper identifies a fundamental flaw in existing approaches: they rely on Markovian dynamic programming that cannot properly optimize risk over a full trajectory. To address this, the authors introduce Trajectory Q-Learning (TQL), a framework that incorporates historical trajectory information to achieve provably unbiased and optimal risk-sensitive policies.
The Gap: Why Standard RSRL Fails
The core issue lies in the non-linearity of risk measures. Unlike the "mean," most risk measures are not linearly additive ($Risk(X + Y) \neq Risk(X) + Risk(Y)$). Standard RL assumes the Markov property—that the future depends only on the current state. However, because risk measures distort probabilities, an action that appears risk-optimal at a single step may be disastrous when viewed across an entire trajectory.
Existing methods apply risk measures to local Bellman updates, which the authors prove is mathematically biased. By ignoring accumulated risk from the past, these "Markovian" agents converge to sub-optimal or even diverging policies. The "aha moment" of this research is the realization that the optimal sub-structure required for dynamic programming vanishes when using distortion risk measures. To optimize a "static" risk measure calculated over a whole episode, the agent must remember what has already happened.
Methods: Trajectory Q-Learning (TQL)
To restore optimality, TQL shifts from a standard value function $Q(s, a)$ to a historical value function $Z(h, a)$, which models return distributions based on the entire history ($h$) of the trajectory.
- History-Relied (HR) Operator: The authors define new operators for policy evaluation and improvement. Unlike standard risk-sensitive Bellman operators, the HR operator is a contraction mapping, ensuring convergence to a unique, optimal fixed point for any distortion risk measure (including CVaR, Wang, and Power measures).
- Neural Architecture: To manage history complexity, TQL employs a Gated Recurrent Unit (GRU) to compress the trajectory into a compact representation. This is fed into a quantile regression network (similar to Implicit Quantile Networks, or IQN) to estimate the return distribution.
- Dual-Critic Setup: To stabilize training, TQL uses a standard Markovian critic to help estimate future targets while the historical critic focuses on the trajectory-wide risk objective.
Experimental Evaluation
TQL was tested on environments designed to highlight the failures of Markovian decision-making:
- Risky Mini-Grid: A discrete grid where agents must choose between a "safe" path (low, steady reward) and a "risky" path (high reward with a 25% chance of zero). This environment acts as a trap for agents that cannot see trajectory-wide risk.
- Modified Mountain-Car: A continuous task where larger, faster actions carry a higher probability of a heavy "risky penalty," forcing the agent to balance speed against the risk of failure.
Key Results
TQL consistently outperformed baselines like IQN and CVaR-DRL. In the Mini-Grid environment, Markovian agents often fell into traps because they could not account for accumulated risk. In contrast, TQL consistently found the global optimum.
In continuous control tasks, TQL maintained stable, high-performing policies even as environment "riskiness" increased, whereas Markovian agents failed to learn safe navigation. Experimental visualizations confirmed that TQL's learned distributions match ground truth, while previous methods produced biased, overly conservative estimates that led to poor decision-making.
Conclusion and Future Work
TQL is the first algorithm shown to converge to the optimal risk-sensitive policy for any distortion risk measure. By acknowledging that "history is mandatory" for risk optimization, it resolves a long-standing theoretical gap in RSRL. Future work includes extending proofs to fully stochastic transitions and improving the scalability of history-based representations for long-horizon tasks, as the current implementation relies on a rolling window to mitigate computational complexity.
Summary updated