← Back to Reinforcement Learning Mind Map
中文·English
🎮 Reinforcement LearningID: policy-gradient

Policy Gradient Theorem

策略梯度 REINFORCE
🎯Core Definition
The policy gradient theorem gives a model-free gradient of J(θ)=Eτ[R(τ)]J(\theta)=\mathbb{E}_{\tau}[R(\tau)]; the core is the log-derivative trick and the expectation form ∇θJ=Eτ[∑t∇θlog⁡πθ(at∣st)Gt]\nabla_\theta J = \mathbb{E}_{\tau}[\sum_t \nabla_\theta \log \pi_\theta(a_t|s_t) G_t]. Derivation:
📌Overview
1. Differentiate and multiply/divide by πθ(τ)\pi_\theta(\tau): ∇θJ=Eτ[∇θlog⁡πθ(τ)R(τ)]\nabla_\theta J = \mathbb{E}_{\tau}[\nabla_\theta \log \pi_\theta(\tau) R(\tau)], via the log-derivative trick ∇θlog⁡πθ(a∣s)=∇θπθ(a∣s)πθ(a∣s)\nabla_\theta \log \pi_\theta(a|s) = \frac{\nabla_\theta \pi_\theta(a|s)}{\pi_\theta(a|s)} (turning a gradient of probabilities into the gradient of their logs, keeping the estimator unbiased); 2. Factor the trajectory πθ(τ)=μ(s0)∏tπθ(at∣st)P(st+1∣st,at)\pi_\theta(\tau) = \mu(s_0)\prod_t \pi_\theta(a_t|s_t)P(s_{t+1}|s_t,a_t) and take the log: the dynamics terms μ,P\mu, P do not depend on θ\theta and cancel, leaving ∑t∇θlog⁡πθ(at∣st)\sum_t \nabla_\theta \log \pi_\theta(a_t|s_t) — which is why no model is needed; 3. By causality, action ata_t affects only future returns, so replace the full return with reward-to-go Gt=∑k≥tγk−trkG_t = \sum_{k\ge t}\gamma^{k-t}r_k (lower variance), giving the REINFORCE update θ←θ+η∑t∇θlog⁡πθ(at∣st)Gt\theta \leftarrow \theta + \eta \sum_t \nabla_\theta \log \pi_\theta(a_t|s_t) G_t.
💡Use Cases
episodic tasks (full trajectories, MC-style) and continuous action spaces; REINFORCE is the simplest implementation, and GRPO/RLHF group-relative updates build on it.
⚡Key Problems Solved
differentiating the probability directly is hard and full-return estimates have huge variance. Subtracting a baseline b(s)b(s) gives ∇θJ=E[∇θlog⁡πθ(a∣s)(Gt−b(s))]\nabla_\theta J = \mathbb{E}[\nabla_\theta \log \pi_\theta(a|s)(G_t - b(s))]. Unbiasedness proof: E[∇θlog⁡πθ(a∣s)b(s)]=b(s)∑aπθ(a∣s)∇θπθ(a∣s)πθ(a∣s)=b(s)∇θ∑aπθ(a∣s)=b(s)∇θ1=0\mathbb{E}[\nabla_\theta \log \pi_\theta(a|s) b(s)] = b(s)\sum_a \pi_\theta(a|s)\frac{\nabla_\theta \pi_\theta(a|s)}{\pi_\theta(a|s)} = b(s)\nabla_\theta\sum_a \pi_\theta(a|s) = b(s)\nabla_\theta 1 = 0, so a baseline never biases the gradient and only cancels action-independent variance; b(s)=V(s)b(s)=V(s) gives the advantage form and leads to Actor-Critic; step-size sensitivity led to TRPO/PPO.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Policy Gradient Theorem.
Use Cases
In production engineering, what are the primary use cases for Policy Gradient Theorem and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Whiteboard: derive the policy gradient theorem from J(θ)=E_τ[R(τ)]; why do the dynamics terms cancel?
2
What is the log-derivative trick, and why does it yield an unbiased gradient estimator?
3
Prove E[∇log π(a|s)·b(s)] = 0 and explain why a baseline reduces variance without biasing the gradient.
4
Why does reward-to-go G_t have lower variance than the full return? How does REINFORCE relate to MC methods?
5
Root causes of high variance and step-size sensitivity; which improvements (TRPO/PPO/GAE) emerged?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Policy Gradient Theorem"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice ➔
← Previous CardExploration-ExploitationNext Card →TRPO → PPO Lineage

🔗 More Reinforcement Learning Knowledge Cards

Actor-CriticBehavioral CloningContextual BanditCoT & Reasoning RL