Simple Algorithm
Reinforcement Learning · Fixed Point · 30 min

Distributional Bellman Operators

Wasserstein contraction for evaluation, its failure for control, and Cramér projections.

The distributional evaluation operator contracts, but only in the right metric: Wasserstein and Cramér yes, total variation and KL no. The control operator contracts in no metric at all, can lack a fixed point, and its iterates need not settle, although their means behave perfectly. Bellman closedness says which statistics dynamic programming can learn exactly, and the answer is essentially only moments. And why learning a distribution helps an agent that acts on its mean is still debated. This lesson proves the first three facts and lays out the evidence on the fourth.

What you’ll learn

  • Prove that the distributional evaluation operator is a γc\gamma^c-contraction for any translation-invariant, cc-homogeneous, pp-convex probability metric, apply it to the Wasserstein and Cramér distances, and show why total variation, KL and the Kolmogorov distance fail.
  • Construct an example in which the distributional control operator is not a contraction, and state what is known about convergence in control.
  • Define Bellman closedness, prove that moments are Bellman closed, and state the theorem that among expectations of functions essentially only moments are.
  • Weigh the theoretical and empirical evidence on why distributional RL helps, including expectation-equivalence in tabular and linear settings.

Which metric? Contraction from three properties

Let η(s,a)\eta(s,a) be a return distribution for each state–action pair. The evaluation operator Tπ\mathcal T^\pi replaces η(s,a)\eta(s,a) by the law of R+γZ′R+\gamma Z' with Z′∼η(S′,A′)Z'\sim\eta(S',A'): a mixture, over the possible (r,s′,a′)(r,s',a'), of copies of η(s′,a′)\eta(s',a') pushed through z↦r+γzz\mapsto r+\gamma z. For a probability metric dd, write dˉ(η,η′)=sup⁡s,ad(η(s,a),η′(s,a))\bar d(\eta,\eta')=\sup_{s,a}d(\eta(s,a),\eta'(s,a)). Whether Tπ\mathcal T^\pi contracts in dˉ\bar d depends on how dd treats shifts, scalings and mixtures, and nothing else.

DerivationProof
  1. Tπη(s,a)=∑kwk bk# η(sk′,ak′),Tπη′(s,a)=∑kwk bk# η′(sk′,ak′)\mathcal T^\pi\eta(s,a)=\sum_kw_k\,b_{k\#}\,\eta(s'_k,a'_k),\qquad\mathcal T^\pi\eta'(s,a)=\sum_kw_k\,b_{k\#}\,\eta'(s'_k,a'_k)

    Fix (s,a)(s,a). Write both images as mixtures with the same weights wk=Pr⁡(R=rk,S′=sk′∣s,a) π(ak′∣sk′)w_k=\Pr(R=r_k,S'=s'_k\mid s,a)\,\pi(a'_k\mid s'_k) (reward distributions with finitely many values for simplicity; integrals replace sums in general), where bk(z)=rk+γzb_k(z)=r_k+\gamma z and bk#b_{k\#} pushes a distribution through bkb_k:

  2. d(Tπη(s,a),Tπη′(s,a))p≤∑kwk γcp d(η(sk′,ak′),η′(sk′,ak′))p≤γcp dˉ(η,η′)pd\big(\mathcal T^\pi\eta(s,a),\mathcal T^\pi\eta'(s,a)\big)^p\le\sum_kw_k\,\gamma^{cp}\,d\big(\eta(s'_k,a'_k),\eta'(s'_k,a'_k)\big)^p\le\gamma^{cp}\,\bar d(\eta,\eta')^p

    By pp-convexity, then translation invariance and homogeneity for each component:

  3. Take the pp-th root and the supremum over (s,a)(s,a). ■\blacksquare

Wasserstein. WpW_p is translation-invariant, homogeneous of order 1, and pp-convex (glue optimal couplings component by component), so Tπ\mathcal T^\pi is a γ\gamma-contraction in Wˉp\bar W_p for every p≥1p\ge1, and in Wˉ∞\bar W_\infty by the same argument with a maximum over components: Bellemare, Dabney and Munos's (2017) Lemma 3. Iterating converges to ηπ\eta^\pi, with all moments converging too. Cramér. Substituting y=x/γy=x/\gamma in ∫(F(x/γ)−G(x/γ))2dx\int(F(x/\gamma)-G(x/\gamma))^2dx gives γ∫(F−G)2\gamma\int(F-G)^2, so ℓ2\ell_2 is homogeneous of order 12\tfrac12; the CDF of a mixture is the mixture of CDFs, and the squared norm is convex, so ℓ2\ell_2 is 2-convex. Hence a γ\sqrt\gamma-contraction in ℓˉ2\bar\ell_2, the rate behind categorical TD's convergence.

Where it fails. Total variation, KL divergence and the Kolmogorov distance sup⁡x∣F(x)−G(x)∣\sup_x\abs{F(x)-G(x)} are unchanged by rescaling: homogeneous of order c=0c=0, so the theorem gives nothing, and indeed nothing holds. Take a single absorbing state with reward 0, where Tπ\mathcal T^\pi maps δx\delta_x to δγx\delta_{\gamma x}. Starting from δ1\delta_1 and δ2\delta_2, after nn backups the two estimates are δγn\delta_{\gamma^n} and δ2γn\delta_{2\gamma^n}: at total-variation and Kolmogorov distance 1 and infinite KL forever, though both converge to the true δ0\delta_0 in Wasserstein distance, W1=γnW_1=\gamma^n.

Predict before you look

With γ=0.81\gamma=0.81, by what factor does one application of Tπ\mathcal T^\pi shrink the maximal Cramér distance, at worst?

Show the answer

0.9

The Cramér distance is homogeneous of order 12\tfrac12, so the modulus is γ1/2=0.81=0.9\gamma^{1/2}=\sqrt{0.81}=0.9, slower than the factor 0.81 in any Wasserstein distance. Squared distances shrink by γ\gamma itself, which is why bounds in this geometry are stated for ℓˉ2 2\bar\ell_2^{\,2}.

Control: no contraction, possibly no fixed point

For control, Bellemare, Dabney and Munos (2017) call distributional Bellman optimality operator any TZ=TπZZ\mathcal TZ=\mathcal T^{\pi_Z}Z in which πZ\pi_Z is greedy with respect to the means of ZZ, ties broken by some rule. The means behave exactly as in ordinary value iteration; the distributions do not.

DerivationNot even continuous: the two-state example
  1. Wˉ1(Z,Z⋆)=W1(−ϵ±1, ϵ±1)=2ϵ\bar W_1(Z,Z^\star)=W_1\big(-\epsilon\pm1,\ \epsilon\pm1\big)=2\epsilon

    State x1x_1 moves to x2x_2 with reward 0. In x2x_2, action a1a_1 ends the episode with reward 0, and a2a_2 ends it with reward ϵ±1\epsilon\pm1 (each with probability 12\tfrac12), 0<ϵ<120<\epsilon<\tfrac12. The optimal distributions are Z⋆(x2,a2)=ϵ±1Z^\star(x_2,a_2)=\epsilon\pm1 and Z⋆(x1)=γ(ϵ±1)Z^\star(x_1)=\gamma(\epsilon\pm1). Perturb one entry: let Z=Z⋆Z=Z^\star except Z(x2,a2)=−ϵ±1Z(x_2,a_2)=-\epsilon\pm1.

  2. Wˉ1(TZ,TZ⋆) ≥ W1(δ0, γ(ϵ±1))=γ⋅12((1+ϵ)+(1−ϵ))=γ\bar W_1(\mathcal TZ,\mathcal TZ^\star)\ \ge\ W_1\big(\delta_0,\ \gamma(\epsilon\pm1)\big)=\gamma\cdot\tfrac12\big((1+\epsilon)+(1-\epsilon)\big)=\gamma

    Under ZZ, the means at x2x_2 are 00 for a1a_1 and −ϵ-\epsilon for a2a_2, so the greedy choice flips to a1a_1 and the backup at x1x_1 propagates a point mass at 0, while TZ⋆(x1)=Z⋆(x1)\mathcal TZ^\star(x_1)=Z^\star(x_1):

  3. A perturbation of size 2ϵ2\epsilon produces a change of size γ\gamma after one backup, so for ϵ<γ/2\epsilon<\gamma/2 the operator expands distances: it is not a contraction. Nor is it continuous. In the same MDP, compare two estimates that differ only at (x2,a2)(x_2,a_2), one with −δ±1-\delta\pm1 and one with δ±1\delta\pm1: they are 2δ2\delta apart for any small δ>0\delta>0, yet their backups at x1x_1, a point mass at 0 and γ(δ±1)\gamma(\delta\pm1), stay γ\gamma apart. The means are fine: in the first comparison they moved by γϵ≤γ⋅2ϵ\gamma\epsilon\le\gamma\cdot2\epsilon, as Lemma 4 promises. What jumps is which whole distribution the greedy choice propagates. ■\blacksquare

Check your understanding

In the example, the perturbed ZZ differs from Z⋆Z^\star by 2ϵ2\epsilon at a single state–action pair. What makes the effect after one backup so much larger?

  1. The reward at x2x_2 is random
  2. The discount amplifies small differences
  3. The Wasserstein distance overstates differences between point masses
  4. The greedy action at x2x_2 flips from a2a_2 to a1a_1 once the mean of Z(x2,a2)Z(x_2,a_2) drops below 0, so a whole different distribution is propagated to x1x_1
Show the answer

D. The greedy action at x2x_2 flips from a2a_2 to a1a_1 once the mean of Z(x2,a2)Z(x_2,a_2) drops below 0, so a whole different distribution is propagated to x1x_1

The backup at x1x_1 copies the distribution of whichever action is greedy at x2x_2, and the greedy choice is a discontinuous function of the means. An arbitrarily small change near a tie swaps ϵ±1\epsilon\pm1 for a point mass at 0, which are W1W_1-distance about 1 apart.

The same mechanism produces Prop. 2's missing fixed point. Set ϵ=0\epsilon=0 in the example, so both actions at x2x_2 have mean 0, and break the tie toward a2a_2 when Z(x1)Z(x_1) is the point mass at 0 and toward a1a_1 otherwise: the iterates at x1x_1 alternate between the two actions' distributions forever. With function approximation, ties are rare but near-ties are common. Bellemare et al. link this instability to the policy chattering that Gordon (1995) described, and suggest that C51's gradient updates mitigate it by averaging the distributions they propagate. Distributional control works in practice because the means drive the policy, but it has no convergence guarantee of the kind evaluation enjoys.

What can dynamic programming learn exactly?

An agent stores finitely many numbers per state–action pair. When can it run dynamic programming on those numbers alone and get them exactly right? Rowland et al. (2019) make the question precise.

DerivationMoments are Bellman closed
  1. mk(s,a)=E[∑j=0k(kj)γj R k−j mj(S′,A′)]m_k(s,a)=\E\Big[\sum_{j=0}^{k}\binom kj\gamma^j\,R^{\,k-j}\,m_j(S',A')\Big]

    Let mj(s,a)=E[Zπ(s,a)j]m_j(s,a)=\E\big[Z^\pi(s,a)^j\big]. Expand (R+γZ′)k(R+\gamma Z')^k by the binomial theorem, where given (S′,A′)(S',A') the next return Z′Z' is independent of RR with moments mj(S′,A′)m_j(S',A'):

  2. m2(s,a)=E[R2]+2γ E[R m1(S′,A′)]+γ2 E[m2(S′,A′)]m_2(s,a)=\E\big[R^2\big]+2\gamma\,\E\big[R\,m_1(S',A')\big]+\gamma^2\,\E\big[m_2(S',A')\big]

    The kk-th moment at (s,a)(s,a) needs only moments of order at most kk at the next pairs: the first KK moments are Bellman closed for every KK (Sobel, 1982; Lattimore & Hutter, 2012; Rowland et al., 2019, Lemma 4.2). For k=2k=2, combined with the equation for m1m_1, this is the variance equation of Distributional RL:

Think first Show that the median is not Bellman closed. Hint: a state leads to one of two next states with probability ½ each, with reward 0 and γ=1\gamma=1; keep the two next states' medians fixed and change the rest of their distributions.

Case A: Z(s1′)Z(s'_1) is 0 or 5 with probabilities 0.6 and 0.4 (median 0); Z(s2′)Z(s'_2) is 1 or 5, same probabilities (median 1). The mixture puts 0.3 on 0, 0.3 on 1 and 0.4 on 5, so its median is 1. Case B: replace the 5s by −5-5s. The next-state medians are still 0 and 1, but the mixture now puts 0.4 on −5-5, 0.3 on 0 and 0.3 on 1, so its median is 0. Same reward, same next-state medians, different medians at ss: no formula in the medians alone can exist.

So even tabular, exact distributional DP on categorical or quantile statistics generally does not recover the true statistics, only the fixed point of a projected operator: the course's lottery shows both biases (a categorical CVaR⁡0.1\operatorname{CVaR}_{0.1} of 0.72 instead of 0.9, a 21-quantile mean of 1.852 instead of 1.9). The reassurance is approximate closedness: for categorical statistics with evenly spaced atoms spanning all possible returns, and for quantiles at the midpoint levels, Rowland et al. bound the error and show that it vanishes as KK grows (Thms. 4.6 and 4.7). Expectile methods sidestep the problem by imputation: back up samples from a distribution consistent with the statistics, not the statistics themselves.

Why does distributional RL help?

A distributional agent that acts on the mean optimizes the same objective as DQN. Where can its advantage come from? Lyle, Bellemare and Castro (2019) showed where it cannot come from. With tabular representations updated by mixing toward the projected target (categorical TD), and with representations linear in the CDF updated by semi-gradients of the CDF, a distributional agent and an expected-value agent given the same samples and matching initializations (plus mild conditions on the support) produce exactly the same mean estimates at every step: they are expectation-equivalent. Gradient steps taken on the probabilities rather than on the CDF break the equivalence even in the tabular case, and so can nonlinear parameterizations such as C51's softmax; the differences need not help.

EvidenceWhat it shows
Expectation-equivalence (Lyle, Bellemare & Castro, 2019)Tabular and linear-CDF distributional learning cannot improve the means; any benefit needs something else
Their experiments with Fourier-basis linear features on CartPole and AcrobotThe expected-value agent learned faster, and distributional agents suffered more when features were few
Their experiments with a small ReLU networkC51 learned faster than DQN (with the same final score), while S51, a linear-CDF agent, lagged and failed on Acrobot: gains appeared only with nonlinear approximation, and there only for C51
Small-scale Rainbow replications (Obando-Ceron & Castro, 2021)Added alone to DQN, distributional learning sometimes hurt
Classification losses (Farebrother et al., 2024)A cross-entropy loss on a smoothed histogram of the scalar target, modelling no return distribution, beat C51 on 60 Atari games
Small-loss bounds (Wang, Zhou, Wu, Kallus & Sun, 2023)Distributional confidence sets give regret and PAC bounds that shrink with the optimal achievable cost, in contextual bandits, low-rank MDPs and offline RL
The main lines of evidence as of the mid-2020s.

Three explanations compete, and they are not exclusive. Representation: predicting a whole distribution is a rich auxiliary task that shapes the features of a deep network, one view the C51 paper itself proposed, which the equivalence results support, since among updates of the CDF only nonlinear approximation breaks equivalence. Optimization: categorical cross-entropy is a better-behaved loss than squared error under noisy, moving targets, which the classification-loss results and the plasticity findings support. Statistics: learning the distribution can give provably faster rates when the best achievable cost is small, a theoretical advantage established so far for specific algorithms built on maximum-likelihood confidence sets rather than for C51-style agents.

Key takeaways

  • Tπ\mathcal T^\pi contracts with modulus γc\gamma^c in any translation-invariant, cc-homogeneous, pp-convex probability metric: γ\gamma in every Wˉp\bar W_p, γ\sqrt\gamma in the Cramér distance; total variation, KL and Kolmogorov are scale-invariant, and Tπ\mathcal T^\pi does not contract in them.
  • The distributional control operator is not a contraction, not even continuous, and may lack a fixed point; its means still converge to Q⋆Q^\star, and its iterates approach the set of nonstationary optimal value distributions.
  • Moments are Bellman closed, and among expectations of functions essentially only moments are; categorical and quantile statistics are not, so even exact tabular DP learns biased statistics, with an error that vanishes as the number of atoms or quantiles grows.
  • Tabular and linear-CDF distributional learning is expectation-equivalent to expected learning; the gains appear with nonlinear networks, and representation, optimization and statistical explanations compete.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why is the distributional evaluation operator not a contraction in total variation?

  1. Total variation is not a metric on distributions
  2. Scaling two distributions by γ\gamma does not change their total variation distance, so two distinct point masses stay at distance 1 forever, even though both converge to the same limit
  3. Total variation is only defined for continuous distributions
  4. It is a contraction, but with modulus γ2\gamma^2
Show the answer

B. Scaling two distributions by γ\gamma does not change their total variation distance, so two distinct point masses stay at distance 1 forever, even though both converge to the same limit

Contraction needs the metric to shrink when both distributions are compressed by γ\gamma; total variation is invariant under any bijection of the line, rescaling included. In the absorbing-state example, δγn\delta_{\gamma^n} and δ2γn\delta_{2\gamma^n} remain at distance 1 while converging to δ0\delta_0 in Wasserstein distance.

Question 2

Which statement about the distributional Bellman optimality operator is correct?

  1. It is a γ\gamma-contraction in the maximal Wasserstein metric, like the evaluation operator
  2. Its iterates' distributions always converge to the return distribution of an optimal policy
  3. Its iterates' means converge geometrically to Q⋆Q^\star, but the distributions need not converge, and the operator may have no fixed point
  4. It does not even get the means right
Show the answer

C. Its iterates' means converge geometrically to Q⋆Q^\star, but the distributions need not converge, and the operator may have no fixed point

Taking expectations commutes with the backup, so the means follow ordinary value iteration. The distribution that gets propagated depends on a greedy choice that is discontinuous in the distributions, which breaks contraction, existence of fixed points and convergence; only convergence to the set of nonstationary optimal value distributions survives.

Question 3

Which of these sets of statistics is Bellman closed?

  1. The mean and the second moment
  2. The probabilities on a fixed grid of atoms, as learned by C51
  3. The quantiles at fixed levels, as learned by QR-DQN
  4. The median
Show the answer

A. The mean and the second moment

By the binomial expansion, the kk-th moment at (s,a)(s,a) depends only on the reward and on moments of order at most kk at the next pairs. By Rowland et al.'s theorem, among expectations of functions only moment families have this property, and categorical and quantile statistics do not.

Question 4

A tabular categorical-TD agent (mixture updates toward the projected target) and a tabular expected-value TD agent receive the same samples, with the same step sizes, and start from matching estimates. What did Lyle, Bellemare and Castro (2019) show about their mean estimates?

  1. The distributional agent's means converge faster
  2. The distributional agent's means are biased
  3. They differ only by sampling noise
  4. They are exactly equal at every step, so any advantage of distributional RL must come from somewhere else, such as nonlinear function approximation
Show the answer

D. They are exactly equal at every step, so any advantage of distributional RL must come from somewhere else, such as nonlinear function approximation

Taking expectations of a tabular distributional update (or of a linear-CDF semi-gradient update) gives exactly the expected-value update, step by step. Their experiments then found the benefits only with nonlinear networks, which is why representation and optimization explanations dominate the debate.

Further reading

  • M. G. Bellemare, W. Dabney & R. Munos, "A distributional perspective on reinforcement learning", ICML (2017).
  • M. Rowland, M. G. Bellemare, W. Dabney, R. Munos & Y. W. Teh, "An analysis of categorical distributional reinforcement learning", AISTATS (2018).
  • M. Rowland, R. Dadashi, S. Kumar, R. Munos, M. G. Bellemare & W. Dabney, "Statistics and samples in distributional reinforcement learning", ICML (2019).
  • C. Lyle, M. G. Bellemare & P. S. Castro, "A comparative analysis of expected and distributional reinforcement learning", AAAI (2019).
  • M. G. Bellemare, W. Dabney & M. Rowland, Distributional Reinforcement Learning (MIT Press, 2023).