Bellman Equations & Contraction
Why value iteration converges.
Every reinforcement learning algorithm iterates some Bellman operator, exactly or from samples. The classical facts, a -contraction in the sup norm with a unique fixed point and optimal stationary policies, are proved in MDPs: Value & Policy Iteration. This lesson asks the questions that decide what happens beyond tabular planning: which backups contract and which do not, in which norms, what a value or model error costs, and what changes when you back up whole return distributions instead of their means.
What you’ll learn
- Prove a contraction criterion for Bellman-type backups, apply it to the log-sum-exp and mellowmax operators, and show that the Boltzmann-weighted average fails it.
- Prove that is a -contraction in the norm weighted by its stationary distribution, and derive the bound on the error of the TD fixed point.
- Prove the performance-difference and simulation lemmas, and use them to price policy changes and model errors.
- Explain why the distributional Bellman operator contracts in the maximal Wasserstein metric, and why its control version does not.
One proof, many backups
For each the reward cancels and the transition probabilities average the aggregator's differences, each at most :
Max and fixed averages are non-expansions. So is : its gradient is , a probability vector, so the mean value theorem on the segment from to gives, for some point on it,
The mellowmax of Asadi and Littman (2017) differs from by the constant , so it qualifies too. The Boltzmann average does not. With and two actions:
Its weights shift toward whichever entries grow, amplifying the change. Asadi and Littman built an MDP on which value iteration with the Boltzmann average has several fixed points, so there it is not a contraction in any norm, and SARSA with Boltzmann exploration can fail to converge.
The soft operator matters because entropy-regularized RL maximizes , whose optimal action values are the fixed point of the soft operator and whose optimal policy is (Ziebart, 2010; Haarnoja et al., 2017). Soft actor–critic builds on it (Actor–Critic & Soft Actor–Critic). Since , comparing the two fixed points prices the softness:
Which aggregator can make the backup fail to be a sup-norm contraction?
- for a fixed distribution
Show the answer
C.
The Boltzmann average is not a non-expansion: its weights move toward whichever entries grow, so a change of size can move it by more than (0.596 for a change of 0.5 in the example). Max, log-sum-exp and fixed averages all satisfy .
Which norm? On-policy weighting and the TD fixed point
With function approximation, values live in a subspace spanned by the columns of a feature matrix , and each iteration projects back onto it. The least-squares projection with weights is a non-expansion in but not in the sup norm, so the classical argument says nothing about . The rescue is a contraction in the right norm.
Jensen's inequality inside each row, then stationarity of :
So contracts in , and composing with the non-expansion keeps the contraction. For the error bound, let . Because is an orthogonal projection for , Pythagoras splits the error:
The second term is a difference of projected backups, because :
Substitute and rearrange. The square root comes from Pythagoras; a sup-norm argument would lose a full :
At , by what factor can the TD fixed point's -weighted error exceed that of the best approximation in the feature space, according to the bound?
Show the answer
7.1
, against for a sup-norm style bound. The guarantee is worst-case and holds in the stationary norm only: states the policy rarely visits can still be badly wrong.
Everything hinges on being stationary for the policy evaluated. Under off-policy sampling need not be a non-expansion in , and linear TD can diverge. The smallest example (Sutton & Barto, §11.2) has two states with features 1 and 2, so their estimates are and , and a transition from the first to the second with reward 0 that is the only one updated. The semi-gradient TD update is , which grows without bound for , although is exact. Function approximation, bootstrapping and off-policy data together form the deadly triad (Convergence of Q-Learning). No comparable guarantee holds for the optimality operator, whose greedy policy, and with it the relevant distribution, changes with ; this is one reason Q-learning with function approximation lacks the guarantees of on-policy linear TD.
What errors cost: performance difference and simulation
Run from and add a telescoping sum of 's values, which collapses to because :
Condition each term on . The expected reward plus discounted next value is , so each bracket averages to an advantage:
Sum with weights and regroup by state–action pair, exactly as in the occupancy derivation of RL Foundations:
Three uses follow. Policy improvement in one line: if is greedy for , then in every state, so for every . The trust-region problem: the expectation is under , unknown until is deployed. Replacing it by gives a surrogate that is accurate only while stays close to ; conservative policy iteration (Kakade & Langford, 2002) and TRPO bound the discrepancy (Trust Regions: TRPO & PPO). Policy gradients: differentiate at ; the term from differentiating multiplies and drops out, leaving the policy gradient theorem (The Policy Gradient Theorem).
Subtract the Bellman equations and , adding and subtracting :
has sup-norm at most , each row of has norm at most , and . (The rows sum to zero, so centering first would halve the second term.)
For planning in the model, write for values in and use that is optimal there:
The is the compounding of model error: a small error per step shifts the state distribution a little more at every step, and the value sums over the whole effective horizon. It is the formal reason why long imagined rollouts drift (World Models & Video Generation). Plugging in an empirical model with samples per pair, , gives a crude sample complexity of order for -accurate values. Sharper variance arguments show that the same plug-in approach attains the minimax order , up to logarithms and for small enough (Agarwal, Kakade & Yang, 2020).
Backing up whole distributions
is the infimum of over couplings, joint laws with the given marginals. A shared shift and a scaling act simply, because the same coupling serves both sides:
Couple the two right-hand sides through the same reward and the same next pair , with an optimal coupling of and for each value of the pair. For , averaging over gives
Take the supremum over and a -th root; follows as a limit. Only couplings were used, which is why Wasserstein metrics fit: between point masses at two nearby returns, total variation is 1 and KL divergence infinite however close the returns are, so neither can say that two return distributions are almost the same.
Practical agents parametrize the distributions. C51 (Bellemare et al., 2017) puts mass on 51 fixed atoms, projects the backed-up distribution onto them and minimizes a KL divergence, a combination the contraction theory does not cover. Quantile regression (QR-DQN; Dabney et al., 2018) learns quantiles with the quantile (pinball) loss instead, which matches the theory: the backup followed by projection onto quantiles is a -contraction in . Distributional agents improved Atari performance markedly, yet in tabular settings, and in linear ones with suitable projections, their mean estimates evolve exactly as expected-value methods' do (Lyle, Castro & Bellemare, 2019). The gains are therefore attributed to better representation learning, a hypothesis without a complete theory.
Key takeaways
- Any backup with a non-expansive aggregator is a sup-norm -contraction: max, fixed averages, log-sum-exp and mellowmax qualify, while the Boltzmann-weighted average does not and can have several fixed points.
- Soft values approximate optimal ones: .
- also contracts in the norm of its stationary distribution, so on-policy linear TD converges to a fixed point within of the best approximation; off-policy weighting breaks the argument.
- The performance-difference lemma, , underlies policy improvement, trust regions and policy gradients; the simulation lemma prices model error at order .
- The distributional evaluation operator contracts in the maximal Wasserstein metric, so return distributions, not just means, can be learned by backups; the control operator is not a contraction.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
A soft Bellman operator uses inverse temperature , with actions and . What does the bound give for ?
- About
- About
- About
- : soft and hard values coincide
Show the answer
B. About
. Each backup adds at most of extra value, and the discounted sum over the effective horizon of 10 steps multiplies that by .
The bound holds when the weighting is what?
- Any distribution with full support
- The uniform distribution over states
- The distribution of a different behavior policy that explores more
- A stationary distribution of the evaluated policy's transition matrix
Show the answer
D. A stationary distribution of the evaluated policy's transition matrix
Stationarity is exactly what makes through Jensen's inequality, hence a contraction in . With other weightings, as in off-policy learning, the composition can expand and linear TD can diverge.
In the performance-difference lemma , which policies supply and ?
- (old policy) and (new policy)
- and
- Both from the old policy
- Both from the new policy
Show the answer
A. (old policy) and (new policy)
The telescoping sum uses 's values along trajectories of . That is why the lemma is easy to use for greedy improvement (old advantages are known) and hard for large policy changes (the new occupancy is not), the problem trust-region methods address.
Why is the distributional Bellman operator analyzed in a Wasserstein metric rather than in KL divergence or total variation?
- Wasserstein distances are cheaper to compute
- KL and total variation ignore how far apart returns are, so two point masses at nearly equal returns are maximally distant, while the backup's shift-and-scale structure is captured by couplings
- The operator is a contraction in every metric on distributions
- Only Wasserstein metrics are defined for continuous returns
Show the answer
B. KL and total variation ignore how far apart returns are, so two point masses at nearly equal returns are maximally distant, while the backup's shift-and-scale structure is captured by couplings
measures how far mass must move, so scaling all returns by shrinks it by , which is the contraction. Between and , total variation is 1 and KL is infinite, so neither metric can register that -scaling brings distributions closer.
Further reading
- J. N. Tsitsiklis & B. Van Roy, "An analysis of temporal-difference learning with function approximation," IEEE Transactions on Automatic Control 42(5), 674–690 (1997).
- S. Kakade & J. Langford, "Approximately optimal approximate reinforcement learning," ICML (2002).
- K. Asadi & M. L. Littman, "An alternative softmax operator for reinforcement learning," ICML (2017).
- M. G. Bellemare, W. Dabney & R. Munos, "A distributional perspective on reinforcement learning," ICML (2017).
- M. G. Bellemare, W. Dabney & M. Rowland, Distributional Reinforcement Learning (MIT Press, 2023).