Unit 13 of 13 · about 3 hours · derive

Average-reward formulation for continuing tasks

In a continuing task with function approximation, discounting stops being a well-defined objective: averaged over the on-policy distribution it ranks policies exactly as average reward does, and discounted methods lose the policy improvement guarantee. Average reward names the steady rate a never-ending controller earns.

You'll be able to

  • Define average reward and differential returns for continuing tasks.
  • Derive differential TD errors and state why values hold only up to an additive offset.
  • Compute the average reward of the three-state ring and explain its differential differences.

Covers

Average-reward continuing-task theory
1

Read

In this order, only the parts listed

0 of 1 done

  1. Average reward and differential valuesReinforcement Learning: An Introduction (2nd ed.) - Starred Sections 5.8 and 5.9 and Chapter 10 Sections 10.3 to 10.5

    Chapter 10, Sections 10.3 to 10.5, equations (10.6), (10.7) and (10.9) to (10.11) with Exercises 10.6 and 10.7 (printed pp. 249 to 255)

    Read the average-reward definition, differential returns and Exercise 10.7 closely; skim the access-control example and the discounting discussion as context.

2

Focus on

  • Average reward is the mean reward per step under from (10.6) and (10.7). Policies order by , and all maximal policies count as optimal.
  • Differential returns subtract per step: . Differential Bellman equations drop and center rewards.
  • Adding one constant to every differential value leaves the equations and TD errors unchanged, so algorithms converge up to an offset.
Common mistakes · 3
  • Treating as part of the continuing control problem. Averaged over the on-policy distribution, discounted value equals , so cannot change the ranking, and discounted algorithms with function approximation do not optimize that average (Section 10.4).
  • Pinning absolute differential values. Only differences are identified; demand the offset-free comparison.
  • Using the raw differential sum on periodic tasks. The plain infinite sum need not converge; Exercise 10.6 motivates the repaired definition (10.13).
3

Try it yourself

Closed-book, before checking anything

Closed-book, take the deterministic ring with reward on arrival in and elsewhere. Show the average reward is , then show the differential differences satisfy and up to a shared offset.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.What does Section 10.4 show about discounting in continuing tasks?Answer

    Averaged over the on-policy distribution, discounted value is , so every ranks policies like average reward. With function approximation the policy improvement theorem is lost, so discounted algorithms carry no guarantee of optimizing that average.

  2. 2.What is for the ring with one reward of 1 per three steps?Answer

    per step.

  3. 3.Differential values come out spaced by up to an offset. Which part matters?Answer

    Pairwise gaps of . Shifting every value by one constant changes nothing in the equations.

  4. 4.The differential Sarsa box updates the average reward with . Why not with the raw reward gap alone?Answer

    With the differential values right, is 0 at every step on the Exercise 10.7 ring, while keeps cycling through 2/3, -1/3 and -1/3. The error gives the steadier average-reward estimate (Exercise 10.8).

5

Practice

You're done when

You define and the differential TD errors without notes and reproduce the ring's rate with its value gaps.

Only when you can do this without notes.

Leads to

Notes

Resources · 1 for this unit, 6 more in the section

Also in this section

  • Reinforcement Learning: An Introduction (2nd ed.) - Chapters 2, 5, 6 and 7Richard Sutton and Andrew Barto · primary

    The authors post the full second edition free at incompleteideas.net; cite the printed page numbers. Study Sections 2.4 and 2.5 (incremental and constant step-size estimates), Chapter 5 without the starred sections (Monte Carlo prediction and control, ordinary and weighted importance sampling), Chapter 6 Sections 6.1 to 6.7 (TD(0), Sarsa, Q-learning, Expected Sarsa, maximization bias) and Chapter 7 Sections 7.1 to 7.3 (n-step methods). Reproduce Example 5.4 (off-policy blackjack), Example 6.2 (random walk) and Example 6.6 (cliff walking), and implement each update from fixed hand-calculated trajectories before training an agent.

  • Stanford CS234 Winter 2026 - Policy Evaluation and Q-LearningStanford University · required

    Study Lecture 3 (tabular policy evaluation) and Lecture 4 (Q-learning) slides and the relevant independent Assignment 1 and 2 written questions. Use the course treatment to state model-access, convergence, coverage and function-approximation assumptions for each update.

  • Hands-on Modern RL - Dynamic Programming, Monte Carlo and TDWalking Labs · support

    Use the DP, MC and TD page and the bandit script as a code companion. Rebuild the algorithms in the shared track schema, and keep the bandit comparison as a seed-sensitivity case: which method wins changes with the seed. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its code/chapterNN folders do not follow the site chapter numbers.

  • Gymnasium Core APIFarama Foundation · reference

    Use the reset, step, seeding and wrapper documentation as the behavior authority for the installed environment version: reset(seed=...) seeds once, step returns terminated and truncated, and vector environments autoreset on the next step by default. Test observation, reward, terminated, truncated and info fields at the boundary.

  • Deep-ML - Tabular Prediction and Control ProblemsDeep-ML · support

    Use named problems as closed-book checks after your own implementation passes: 272 (first-visit Monte Carlo), 257 (TD error), 273 (n-step TD), 175 (SARSA), 476 (Expected SARSA), 133 (Q-learning) and 518 (cliff walking, SARSA versus Q-learning). Read each problem's tests before trusting its statement.

  • Reinforcement Learning Control Laboratory - Tabular ControlRoadmap-Final · required

    Complete the MC, SARSA and Q-learning requirements with exact trajectory updates, stochastic and exploration-sensitive environments, visitation logs, matched interaction budgets and seeded alignment and bootstrap defects.