Unit 9 of 11 · about 4 hours · derive, measure
Bellman operators, contraction, fixed points and residual-aware stopping
Stopping on sweeps wastes work or leaves error. Residual over tells how far values and the greedy policy can still be from optimal.
You'll be able to
- Define and and state the fixed points and .
- Prove contraction for and state the unique fixed point implication.
- Derive the residual bound and choose tolerance from target error, not fixed sweeps.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Contraction and convergenceStanford CS234 Winter 2026 - Foundations and Planning
Contraction Operator (slide 38), Will Value Iteration Converge (slide 39) and Proof: Bellman Backup is a Contraction (slides 40 to 41)
- Bellman residuals and policy boundsStanford CS234 Winter 2026 - Foundations and Planning
Section 3, Bellman Residuals and performance bounds, parts (a) to (f) with the bound, pp. 4 to 5, plus part (i) with the tighter bound under , p. 5
- Stopping with maximum differenceReinforcement Learning: An Introduction (2nd ed.) - Chapters 3 and 4
Chapter 4, Section 4.1 stopping with maximum absolute difference below and Section 4.4 loop until , printed pp. 74 and 104. The authors post the full text free at incompleteideas.net.
Focus on
- maximizes over actions. averages under . Both contract in maximum norm by .
- Residual bounds value error by and greedy-policy loss by , tighter to when .
- Policy can stabilize before values converge. Values can keep moving after the policy is optimal. Track both.
Common mistakes · 3
- Stopping when the policy stops changing and reporting values as converged. Values may still be far. The residual controls values.
- Using a mean residual to claim a maximum bound. Maximum error needs the maximum norm.
- Expecting contraction with . The proof needs or absorption with probability 1.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What are the fixed points of and ?Answer
and . Policy evaluation iterates to its fixed point.
2.Why is the fixed point unique?Answer
A contraction can have at most one fixed point. If two existed, applying the operator would shrink their distance, which is impossible unless it is zero.
3.What error do and allow?Answer
Value error up to 0.1 from . Greedy-policy loss up to 0.2 from .
4.Does value initialization change the limit?Answer
No for the limit under contraction. Yes for sweep count. Lecture 2 lists this as out-of-class practice.
Practice
- Stanford CS234 Assignment 1, Section 3(d) to 3(f): residual to policy loss
Section 3, parts (d) to (f), p. 5; Bellman error magnitude to and bounds
Prove on paper. Then set your RiverSwim tolerance from a target value error using . The section mini-project covers stopping-error agreement.
You're done when
You prove contraction without notes and convert any residual into value and policy bounds correctly.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 5 more in the section
- Stanford CS234 Winter 2026 - Foundations and PlanningStanford University · primary
Study Lecture 1 (
lecture1pre.pdfandlecture1post.pdf) and Lecture 2 on tabular MDP planning (lecture2pre.pdfandlecture2post.pdfunder https://web.stanford.edu/class/cs234/slides/). Work Assignment 1 independently: the written MDP, horizon and Bellman-operator questions and thevi_and_pi.pyplanning code on RiverSwim (NumPy only). Do not copy or publish course solutions. - Reinforcement Learning: An Introduction (2nd ed.) - Chapters 3 and 4Richard Sutton and Andrew Barto · required
The authors post the full second edition free at incompleteideas.net; cite the printed page numbers. Study Chapter 3 (Sections 3.1 to 3.7, finite MDPs, returns, Bellman equations and optimality) and Chapter 4 (Sections 4.1 to 4.7, policy evaluation, improvement, policy and value iteration, asynchronous DP and GPI). Reproduce Example 4.1 and Figure 4.1 exactly, then Example 4.3 (the gambler), and write exact tests for stochastic transitions, terminals, ties and stopping error.
Also in this section
- Gymnasium - Time Limits and Episode SemanticsFarama Foundation · required
Read the termination, truncation and "importance in learning code" sections, then the vector autoreset note at https://farama.org/Vector-Autoreset-Mode (next-step autoreset is the default in Gymnasium 1.x). Build a wrapper test that distinguishes termination from truncation and proves which cases bootstrap before using any third-party environment.
- Hands-on Modern RL - MDPs, Values and Bellman EquationsWalking Labs · support
Use the value and Bellman page and the value experiment page (
code/chapter03_mdp/bellman_equation_verify.pyandgridworld_q_learning.pyrun on CPU in seconds) as a code companion. Check every equation against Sutton and Barto before adopting it. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; itscode/chapterNNfolders do not follow the site chapter numbers. - Deep-ML - Planning ProblemsDeep-ML · support
Use named problems as closed-book checks after your own implementation passes: 157 (Bellman equation for value iteration), 164 (the gambler's problem by value iteration) and 467 (policy iteration). Read each problem's tests before trusting its statement.
- Reinforcement Learning Control Laboratory - Planning CoreRoadmap-Final · required
Complete Milestone A planning requirements: an explicit finite MDP, exact policy evaluation, value iteration, policy iteration, simulator agreement and seeded reward, transition, terminal and tie defects.
- Reinforcement Learning: An Introduction (2nd ed.) - Chapter 2 banditsRichard Sutton and Andrew Barto · reference
Read Section 2.9, Associative Search (Contextual Bandits), printed p. 41, with Exercise 2.10 as the context versus no-context check. Use only this section from Chapter 2.