Modified & Generalized Policy Iteration
Truncated evaluation, optimistic policy iteration and the spectrum between PI and VI.
Policy iteration evaluates each policy exactly; value iteration does a single backup. Between them lies modified policy iteration, and once values come from samples or function approximators, every algorithm lives in that middle ground. This lesson maps the spectrum, proves what inexact evaluation costs ( in the worst case, if the policies settle), and builds a two-state example in which approximate policy iteration alternates forever between the best policy and the worst.
What you’ll learn
- Define modified policy iteration and λ-policy iteration, derive λ-policy iteration's closed form, and place value and policy iteration at the ends of both spectra.
- Prove the approximate policy iteration bound in componentwise form, recover the bound, and prove the sharper bound when the policies converge.
- Construct an example where approximate policy iteration oscillates between an optimal and a bad policy, and explain chattering under optimistic updates.
- Explain the remedies, from conservative policy iteration to aggregation, and what is known about optimistic policy iteration with sampling.
A spectrum of evaluation effort
Modified policy iteration (MPI; Puterman & Shin, 1978) makes the amount of evaluation a parameter : let be greedy for , then set . With this is value iteration, because one backup of the greedy policy is ; as it is policy iteration. From a start with (for example constant at ) its iterates increase monotonically and are sandwiched between value iteration's and the values of the policies they produce (Puterman & Shin, 1978; Puterman, 1994, ch. 6), so it converges at least as fast as value iteration for every .
The cost is what makes interesting. A greedy step costs with a dense model, an evaluation sweep of a fixed policy only . With many actions, a few cheap evaluation sweeps per expensive greedy step beat both extremes: value iteration pays for a greedy step every sweep, and policy iteration pays for an exact solve.
λ-policy iteration (Bertsekas & Ioffe, 1996) averages all depths of evaluation with geometric weights, the way TD(λ) averages -step returns: . It has a closed form.
is affine with linear part (write ), so consecutive iterates differ by powers of applied to the first difference , and they telescope:
Average with weights and exchange the sums; the weight on is :
With greedy, is the Bellman residual . At the update is , value iteration. At it is the Newton step of Policy Iteration as Newton's Method, which lands on . In between, is a better-conditioned stand-in for the Newton matrix: a damped Newton step.
Which update does λ-policy iteration perform with ?
- One value-iteration backup,
- , the exact value of the greedy policy: policy iteration
- A TD(1) update from one sampled episode
- No update: the weights all vanish
Show the answer
B. , the exact value of the greedy policy: policy iteration
The closed form gives . The averaged series is a limit as , and the closed form makes well defined.
What inexact evaluation costs
Write for the evaluation error, , and . Greedy beats the old policy. ; substituting and using the exact identity gives near-monotone improvement:
Greedy beats the optimal policy at . , and with :
Split the next loss into three telescoping pieces, , bound the second by step 2 and the third by step 1, and simplify with :
Take norms. The bracket contains the matrix , whose max norm is at most , the condition-number bound of Policy Evaluation as Linear Algebra. So the bracket applied to is at most , and since :
The componentwise inequality in the third step is stronger than its norm: it says the loss propagates through and through the state distributions of the policies involved. Weighted-norm bounds built from inequalities of this kind (Munos, 2003) replace the worst state by averages under the data distribution, at the price of concentrability coefficients (Fitted Q-Iteration & Its Guarantees).
Let be greedy for its own approximate value , with . Using monotonicity, the constant shift , and :
Apply again and again; each application adds a factor to the excess, and the iterates converge to (after Bertsekas, 2011):
Approximate policy iteration with evaluation error at settles on a single policy. How much value can that policy lose, at most?
- 0.1
- 0.18
- 18
- 1.8
Show the answer
D. 1.8
Settled policies satisfy . Without settling, the guarantee is only : one horizon factor is the price of never settling.
Oscillation and chattering
Why only a ? Because with approximate evaluation the policies need not converge at all. Here is a two-state example in the spirit of Bertsekas (2011). In , stay pays and stays; go pays 0 and moves to ; always returns to with reward 0; . The optimal policy stays forever, with ; the policy that goes earns nothing, .
Values are approximated with a single feature, and , so , and each policy is evaluated by the fixed point of TD under its own state distribution, as an on-policy learner would. The greedy choice in compares with : stay is greedy exactly when .
| Round | Policy in | Its state distribution | Fitted | Greedy for |
|---|---|---|---|---|
| 1 | stay (optimal) | all mass on | , so | go: |
| 2 | go (worst) | , the true values | stay: | |
| 3 | stay | all mass on | 10 | go, and so on forever |
Whenever the evaluation of a policy is a deterministic function of the policy, there are finitely many policies, so approximate policy iteration must eventually either settle or cycle; this example cycles. Which policies end up in the cycle, and how good they are, is not predictable in general.
Chattering. Optimistic policy iteration takes only a small step of evaluation before improving: here, nudge a little toward the current policy's fitted value, then act greedily again. While the policy stays and moves up toward 10; as soon as it crosses the policy goes and moves down toward 0. With shrinking steps, converges while the policy keeps flipping: convergence in parameter space with oscillation in policy space, the phenomenon known as chattering (Bertsekas & Tsitsiklis, 1996; Bertsekas, 2011).
With and , to which value does the weight of chattering optimistic policy iteration converge?
Show the answer
1.11
It converges to the boundary between the two greedy regions, , where stay and go tie. That point is the value of neither policy: the limit of the parameters says nothing useful about either policy's worth. A simulation with step sizes is within 0.001 of after a million updates.
Taming generalized policy iteration
Several remedies are known, each giving up something.
- Evaluate differently. Bertsekas (2011) shows that evaluation by aggregation, which turns the approximation into the exact solution of a smaller MDP, cannot oscillate: the policy sequence converges, and the sharper settled-policy bound applies. Projected-equation (TD) evaluation, as in the example, can oscillate.
- Improve conservatively. Conservative policy iteration (Kakade & Langford, 2002) moves only part of the way to the greedy policy, , with chosen from estimated advantages so that every step provably improves. It is the ancestor of TRPO and PPO (TRPO & Monotonic Improvement).
- Use more than one policy. Running the last few greedy policies in a loop, a non-stationary policy, improves the worst-case guarantee toward (Scherrer & Lesner, 2012).
Sampling. With Monte Carlo estimates in place of exact evaluation, even the lookup-table case is delicate. Tsitsiklis (2002) proved convergence of a special case of optimistic policy iteration that combines Monte Carlo estimates of -values with greedy improvement, and of variants with TD estimates, and pointed out natural extensions that fail or are unlikely to work. The general question, including Monte Carlo control with exploring starts, is still not fully settled (Monte Carlo Control & Its Convergence).
Tetris, the cautionary tale. With the same 22 features, approximate policy iteration with projected-equation evaluation reached average scores of a few thousand cleared lines, while a cross-entropy search directly over the feature weights reached hundreds of thousands (as reviewed by Bertsekas, 2011). Whether that failure came from oscillation, from the cost-function approximation itself, or from the difficulty of the game was, in that survey's words, an open question. Classification-based modified policy iteration later competed with the best methods while using fewer samples (Scherrer et al., 2015).
Key takeaways
- Modified policy iteration ( sweeps per greedy step) and λ-policy iteration, , interpolate between value iteration and policy iteration; the right point on the spectrum depends on the cost of greedy steps.
- With evaluation error , approximate policy iteration guarantees , tight in the worst case, and once the policies settle. The componentwise proof shows the evaluation system's condition number at work.
- Approximate policy iteration need not settle: with one feature on two states it alternates forever between the optimal and the worst policy, and optimistic updates chatter, with parameters converging to a boundary while the policy flips.
- Remedies trade something away: aggregation-based evaluation, conservative policy updates (the road to TRPO and PPO), or non-stationary policies. Convergence of optimistic policy iteration with samples is proved only in special cases.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
An MDP has many actions per state. Why can modified policy iteration with beat both value iteration and policy iteration in total work?
- It needs fewer greedy steps than policy iteration
- It amortizes each expensive greedy step, , over several cheap evaluation sweeps, each, and never pays for an exact solve
- It converges in exactly 5 iterations
- It avoids the model entirely
Show the answer
B. It amortizes each expensive greedy step, , over several cheap evaluation sweeps, each, and never pays for an exact solve
Value iteration pays for a maximization over all actions in every sweep; policy iteration pays per round for exact evaluation. MPI spends a few cheap fixed-policy sweeps between maximizations and still converges at least as fast as value iteration.
Approximate policy iteration at evaluates every policy to within , and the policies keep changing. What limiting loss does the bound guarantee?
- 1.9
- 0.095
- 38
- 3.8
Show the answer
C. 38
. If the policies settled, the guarantee would be .
In the two-state example, why does evaluating the optimal policy lead to a greedy step that picks the worst policy?
- The TD fixed point is computed with too few samples
- The discount factor is too high for policy iteration
- Greedy improvement is unreliable even with exact values
- The feature forces , and the optimal policy never visits , so the large overestimate of is never corrected
Show the answer
D. The feature forces , and the optimal policy never visits , so the large overestimate of is never corrected
Under stay, all of the state distribution sits on , so the fit matches and drags to 20, far above its true value 9. The greedy step then chases that phantom value. With exact values, greedy improvement could never make things worse.
What is chattering in optimistic policy iteration?
- The value parameters converge while the greedy policy keeps switching
- The value parameters diverge to infinity
- The policy converges while the values keep oscillating
- Two policies with equal values are chosen alternately
Show the answer
A. The value parameters converge while the greedy policy keeps switching
With small, shrinking evaluation steps, the parameters settle on the boundary between greedy regions, where the greedy policy flips back and forth. The limit is no policy's value, so one must still evaluate the policies visited and pick the best.
Further reading
- M. L. Puterman & M. C. Shin, "Modified policy iteration algorithms for discounted Markov decision problems," Management Science 24(11), 1127–1137 (1978).
- D. P. Bertsekas & J. N. Tsitsiklis, Neuro-Dynamic Programming, ch. 6 (Athena Scientific, 1996).
- D. P. Bertsekas, "Approximate policy iteration: a survey and some new methods," Journal of Control Theory and Applications 9(3), 310–335 (2011).
- J. N. Tsitsiklis, "On the convergence of optimistic policy iteration," Journal of Machine Learning Research 3, 59–72 (2002).
- B. Scherrer, M. Ghavamzadeh, V. Gabillon, B. Lesner & M. Geist, "Approximate modified policy iteration and its application to the game of Tetris," Journal of Machine Learning Research 16, 1629–1676 (2015).