- Introduced by
- Ronald Williams (REINFORCE); Sutton et al. (policy gradient theorem)
- Year
- 1992
- Type
- Policy-based reinforcement learning
- Family
- Reinforcement learning
What does it do?
Policy gradient methods are reinforcement-learning algorithms that optimize a parameterized policy directly by gradient ascent on the expected return.
Pure policy-gradient methods do not learn action-values in order to act greedily; actor-critic variants additionally learn a value function, used as a critic. They build on Ronald Williams' 1992 REINFORCE algorithm and on the policy gradient theorem of Sutton and colleagues (2000). Because the policy can be any differentiable distribution, they handle stochastic and continuous action spaces and form the basis of many modern actor-critic and deep-RL algorithms.
The intuition behind the method
Value-based methods such as Q-learning estimate how good each action is and then choose the best one; pure policy gradient methods skip that step and adjust the policy itself. The policy is a probability distribution over actions with tunable parameters. After acting and observing the return, the parameters are nudged so that actions which led to high reward become more likely and poor ones less likely, which is gradient ascent on expected reward. This works for continuous controls, such as a steering angle, where taking a maximum over all actions is impractical. Subtracting a baseline, typically a value estimate, keeps the noisy gradient stable.
History
Ronald Williams introduced REINFORCE, the foundational Monte-Carlo policy gradient method, in 1992. Related policy-learning methods were studied earlier, including work by Williams in 1987, and they were largely supplanted in the 1990s by action-value methods. Sutton, McAllester, Singh, and Mansour (2000) introduced the term 'policy gradient methods' and gave the policy gradient theorem for function approximation, which made neural-network policies and the actor-critic family possible. Later work on A3C, TRPO, PPO, and DDPG/SAC built on this foundation, and attention to policy-gradient and actor-critic methods has returned in recent years. The approach is also central to reinforcement learning from human feedback (RLHF), used to align large language models. Policy gradients are the policy-based counterpart to value-based methods such as Q-learning.
When to use it
Choose policy gradient methods when the action space is continuous or high-dimensional, when a stochastic policy is useful (for exploration, partial observability, or multiple agents), or when a neural-network policy should be optimized end-to-end. Typical settings include robotic control, continuous-control tasks, dialogue or recommendation policies, and the policy-optimization step of RLHF for language models. Avoid them when the action space is small and discrete and Q-learning or DQN can be applied, since value-based methods are often simpler and more sample-efficient there. Also expect high-variance gradient estimates (mitigated by baselines or critics), typically on-policy and sample-inefficient learning, sensitivity to step size and reward scaling, and a risk of local optima. Trust-region variants such as TRPO and PPO were developed specifically to address step-size instability.
Limitations and considerations
- Gradient estimates have high variance, so baselines or critics are needed to make learning practical.
- Usually on-policy and less sample-efficient than off-policy value methods.
- Sensitive to learning rate and reward scale, and can converge to local optima.
- Stability requires care, because large update steps can collapse the policy.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Optimize the policy directly, and handle continuous and high-dimensional action spaces without maximizing over actions.
- Represent stochastic policies naturally, which supports exploration and partially observed problems.
- Work with neural-network function approximation, which is the basis of deep policy-gradient methods.
- Provide the foundation for later algorithms such as A2C/A3C, TRPO, PPO, and DDPG, and for RLHF.
Applications
- Continuous control in robotics and simulated environments, such as setting a steering angle.
- Sequential decision-making tasks with stochastic policies, including game-playing agents.
- Dialogue and recommendation policies that must adapt through interaction.
- Reinforcement learning from human feedback (RLHF) for language models.
How it works
How it works
The goal is to maximize J(θ), the expected discounted return of trajectories generated by the policy π_θ. Unlike value methods, the object being optimized is the policy's parameters directly, and the policy can be stochastic and continuous.
Formula
J(\theta) = \mathbb{E}_{\tau\sim\pi_\theta}\!\left[\textstyle\sum_t \gamma^{t} r_t\right]The policy gradient theorem expresses the gradient of the expected return as an expectation of the score function (the gradient of the log-policy), weighted by the action's value. The gradient does not require differentiating the environment dynamics, so it can be estimated from sampled experience.
Formula
\nabla_\theta J(\theta) = \mathbb{E}_{\pi_\theta}\!\left[\nabla_\theta \log \pi_\theta(a\mid s)\, Q^{\pi}(s,a)\right]REINFORCE is a Monte-Carlo estimator: after an episode, for each step it moves the parameters along the log-policy gradient, scaled by the return from that step minus a baseline. The baseline, often a state-value estimate, reduces variance without adding bias, which makes the noisy gradient usable in practice.
Formula
\theta \leftarrow \theta + \alpha\,\nabla_\theta \log \pi_\theta(a_t\mid s_t)\,(G_t - b(s_t))
Actor-critic methods learn two components together: an actor (the policy), updated by the policy gradient, and a critic (a value function) that supplies a lower-variance estimate of the advantage, meaning how much better an action is than average. The critic's bootstrapped estimates replace high-variance Monte-Carlo returns, giving more stable and sample-efficient learning. This structure underlies A2C/A3C and PPO. DDPG is also an actor-critic method, but it uses a deterministic policy gradient rather than the stochastic score-function estimator in the formulas above.
Formula
\text{critic estimates } Q^{\pi}/V^{\pi}\ (\text{baseline}),\ \text{actor follows } \nabla_\theta \log\pi_\theta \cdot ACommon pitfalls
- Omitting a baseline or critic, which leaves the gradient too noisy for the policy to learn.
- Reusing off-policy data with a plain on-policy estimator, which biases the gradient.
- Using large or unscaled rewards or step sizes, which can make the policy unstable or cause it to collapse.
- Allowing the policy to become near-deterministic too early, which removes exploration.
Frequently asked questions
How do policy gradients differ from Q-learning?
Q-learning learns action-values and acts greedily, while policy gradients parameterize the policy and optimize it directly by gradient ascent on expected return. Policy gradients handle continuous and stochastic actions naturally but have higher variance and are usually on-policy. Q-learning is off-policy and is often more sample-efficient when the action space is small and discrete.
What is an actor-critic method?
It combines a policy (the actor), updated by the policy gradient, with a learned value function (the critic) that estimates how good states or actions are. The critic provides a lower-variance advantage signal, which stabilizes and speeds up learning. A2C/A3C, PPO, and DDPG are actor-critic algorithms.
Why do policy gradients use a baseline?
The raw gradient estimate is very noisy. Subtracting a baseline, typically a state-value estimate, from the return reduces the gradient's variance without introducing bias, which makes learning more stable and efficient. The advantage function (return minus value) is the common choice.
Related methods
Sources
Williams, R. J. (1992). Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3–4), 229–256.
Open DOI referenceSutton, R. S., McAllester, D., Singh, S., & Mansour, Y. (2000). Policy gradient methods for reinforcement learning with function approximation. Advances in Neural Information Processing Systems, 12, 1057–1063.
Open publication referenceRLbook2018, Ch. 13 (Bibliographical and Historical Remarks), p. 337–338