Policy Gradient, Policy Iteration, and in between
Policy gradient (PG) and actor critic are the most trendy RL methods today. As a theorist, it often gives me headache when people bring up all sorts of variants of PG and ask me for opinions, and all I can say is …

Part of the reason is that many algorithms adopt changes to the original PG that look fairly heuristic, and I cannot find a conceptually simple and satisfactory framework for understanding and deriving them from first principles. This situation changed a little bit when Lihong recently asked me about PPO and shared some interesting empirical phenomenon, which got me thinking and organizing together some ideas that have been in the back of my mind for a long time. So this post will share some perspectives on how I view these algorithms.
Policy Gradient, Implemented (In)Correctly
Let’s start by reviewing the good-old PG, which is and can be replaced by the advantage function , or the Monte-Carlo return starting from under policy .
In reality, however, a number of approximations is often deployed that departs from the equation above, with my comments at the end in parentheses:
- The true is often unknown and we may use instead an approximate version often learned via TD, which we refer to as the critic.1 (Totally reasonable.)
- In principle, after every update to the actor , we should train a new critic for the new policy, ideally to convergence. But that’s obviously computationally too intensive, so we often just constantly update the critic, knowing that it likely has not converged to (the best approximation of) the advantage for the current policy. Theoretically, an updating scheme that reproduces the same issue (and is easier to study) is to freeze the critic and update the actor for a while, and then update the critic.
- The equation requires on-policy sampling . While most (but not all) practical variants still respect the action on-policyness, to my knowledge nobody cares about .2 Instead of people often just write to refer to a recent batch (RAGE METER BUILDING UP…)
- Things get worse in off-policy setting, where an importance-weighting correction is needed. In practice, the policy on the denominator of importance weight does not always match the data used for updating the actor, which breaks importance sampling. (At this point man, what can I say.)
- … and so on.
Policy Iteration
Despite my complaints about all these “wrong” practices, there is an angle that makes a lot of them justifiable. Consider the following: let’s push the alternating update in #2 to its extreme: in each round, we freeze and keep updating the actor until convergence. If the actor parameterization is sufficiently expressive, we would get
which is policy iteration (PI).3 Now, the textbook material on PI, viewed as a planning algorithm, just lifts so many restrictions of PG, including
- You can optimize the policy very far (all the way to greedy w.r.t. current critic) before updating critic.
- There is no need to be on-policy. In fact, the policy improvement step does not even talk about any notion of data distribution.
All these relaxations are nice. But they of course come at a price, otherwise we can simply use fitted PI and do not need PG at all. As I will explain below, my view is that PI relaxes the requirement on data distributions at the cost of strong (and sometimes unrealistic) assumptions on (1) policy structure, and (2) critic quality. We need strict PG if none of these assumptions hold. However, when some of them are reasonable, we may relax PG towards PI and enjoy the resulting flexibility.
On Policy Structure
In its original form, PI does not come with a separate actor and the policy is implicitly induced as the greedy policy of the value functions. For PI to be properly written in the form of Eq.(1), a key assumption is that
that is, the greedy policy w.r.t. the advantage function (or its approximation in the learning setting) can always be well-approximated by our policy parameterization . This is because the PD lemma tells us that
where . PI finds a new policy that is guaranteed to improve because the new policy has non-negative advantage over the old one in all states simultaneously, which is the key property that makes PI insensitive to data distributions. When we mimic PI using “critic-frozen-PG”, we can guarantee this property by choosing the tabular softmax policy, which has a factorized structure in the sense that the policy can choose the action distributions on each state independently.
In contrast, when we use a policy parameterization that entangles the action distributions across different states, we may run into the problem that the gradients of for different may not be aligned with each other, and making improvements in some states may cause performance degradation in other states. In this case, PG theorem is the final safe net that guarantees overall improvement in : it tells us that the correct trade-off between the conflicting objectives at different states is precisely given by the distribution .
On Critic Quality
Another major assumption behind PI is that is either given or its approximation is universally good across the state-action space, which is rarely the case in practical learning settings. A much more reasonable assumption is that critic is only accurate under the distribution of states and actions induced by the current policy (see the seminal CPI paper, though there is more nuance to this assumption4), or the historical data, since this is where the critic is trained.5 Under this assumption, we cannot freeze the critic and optimize the actor indefinitely, as it will run into the regime where critic is poor due to the lack of data. Instead, we need to stop after is a bit far from , collect data, and re-train the critic to make sure the actor never gets into the completely uncharted regime and stays within the trust region.
Understanding the Practical Relaxations
The takeaway message of the above discussion is that PI makes a number of implicit assumptions, which allow it to have much less restriction than PG in several corresponding aspects. Judging from how people tweak PG in practice (as mentioned at the beginning), we can “reverse-engineer” and have some reasonable guess of why those tweaks are successful: given that people care less about on-policyness but enforce trust region on actor updates pretty carefully, we can conjecture that (1) modern neural-net architectures are rich enough that conflicting objectives across states are less of an issue (especially when actor and critic share layers),6 and (2) critic is still only good under existing data, which necessitates trust region. (Update 09/30) After I show this post to Wei Xiong, he told me that there are recent works that start to take distribution issues in PG more seriously.7 I guess we will just have to wait and see how things play out.
Footnote Remarks
-
(Update 10/1) Aviv and I had a discussion of some confusion, which partly stems from terminology issues: he uses the term “critic” narrowly for state-baseline estimation (i.e., the term) while is still from MC. In this post, I am using critic in a broader sense which allows for also learned from TD. ↩
-
Nota & Thomas have a paper on the difference between discounted (in theory) and undiscounted (in practice) occupancy in PG. This issue looks like small potatoes given the kind of wild stuffs people do nowadays. ↩
-
When the policy parameterization outputs stochastic policies (such as via softmax), one often cannot exactly converge to the greedy policy but can infinitely approach it. ↩
-
Conventional wisdom assumes that (1) (or vs. ) is small if is trained on distribution , and (2) getting accurate on is necessary for PI/PG algorithms. While (1) is straightforward for on-policy Monte-Carlo regression, it is not quite the case for the more common TD training when (under additional assumptions such as Bellman-completeness) we can control the Bellman error under the training distribution . Our Bellman-consistent pessimism paper shows that if covers , one can only show that is close to under the initial state distribution, which breaks (1). However, this is weirdly sufficient for enabling guarantees for soft policy iteration; in fact, we only need and to produce similar expectations under the initial distribution (i.e., getting the scalar correct is enough), which breaks (2) as one would think that getting to have the right “shape” of is important for policy iteration algorithms. ↩
-
(Update 10/1) Regarding critic quality, the description of issue #2 actually alludes to a mix of two separate issues: (1) that the critic is approximating and not the latest policy, and (2) that the critic is only accurate under the old state-action distribution for whatever policy it’s evaluating (see the previous footnote). Fully on-policy sampling of trajectories (and re-training critic) addresses both issues simultaneously. When that’s the not the case, I am more concerned about (2) than (1), since PI says (1) would be fine if you have universally accurate critic. As a side note, one can also run into (1) in practice even if MC return is used as the critic (which does not require training): if rolling out long trajectories is costly, we may choose to keep updating the actor for a while based on the old policy’s trajectories. ↩
-
(Update 9/30) When state space is large or even continuous it is virtually impossible for an actor to take action distributions independently across all states. The real problem here is likely that of proper generalization across the state space: the parametric form of actor will enforce the policy to choose similar action distributions on some notion of similar states, and this similarity is determined by the actor architecture; this can be fine if (or ) also behave similarly across those states. So eventually it boils down to whether the notion of state similarity implicitly baked into the actor architecture is consistent with the state similarity of the underlying MDP. ↩
-
I just hope this is not going to be another round of “theory exists → empirics do it wrong but things work → find it’s better to do it according to theory → claim major novel discovery”. ↩