We collect data with an old policy πθold, then optimize a newπθ. To reuse the old samples, we reweight:
Ea∼πθold[πθold(a∣s)πθ(a∣s)A^]
Define the probability ratio:
rt(θ)=πθold(at∣st)πθ(at∣st)
Why a ratio?rt>1 means the new policy makes this action more likely than the old one did. This surrogate objective LCPI=E[rtA^t] is the "conservative policy iteration" objective.
Why entropy H? Encourages exploration by keeping the policy from becoming deterministic too fast.
Why one shared step? Actor and critic often share a network; we run K epochs of minibatch SGD on the same collected batch — that's the sample-efficiency win over REINFORCE.
Imagine you're learning to shoot basketball hoops. After some shots you know which moves helped and which didn't. You want to change your technique — but if you change everything at once based on a few lucky shots, you'll ruin your form. So you make a rule: "I'll adjust my technique, but never by more than a little bit at a time." If a move worked, I do a bit more of it — but I stop once I've already changed enough. If a move was bad, I do a bit less — but again, only a little. That "only change a little" rule is the clip in PPO. It lets you learn fast without wrecking what already works.
rt(θ)=πθ(at∣st)/πθold(at∣st) — how much more/less likely the new policy makes the sampled action vs the old policy.
Write the PPO clipped objective.
LCLIP=Et[min(rtA^t,clip(rt,1−ϵ,1+ϵ)A^t)]
Why does PPO take the min of clipped and unclipped terms?
To form a pessimistic lower bound: it removes incentive to move too far when it helps, but still lets you fully correct updates that move in the wrong direction.
For A^>0 and rt>1+ϵ, what is the objective gradient?
Zero — the clipped branch is active, so no incentive to increase rt further.
What problem does clipping replace from TRPO?
The hard KL trust-region constraint; clipping approximates it with cheap first-order updates.
What does ϵ control and its typical value?
The trust-region width [1−ϵ,1+ϵ]; typically ϵ=0.2.
What is GAE and what does λ trade off?
Generalized Advantage Estimation, A^t=∑(γλ)lδt+l; λ trades bias (low) vs variance (high), typically 0.95.
Why can PPO run multiple SGD epochs on one batch?
Importance sampling (rt) lets it reuse data collected by the old policy, giving sample efficiency over REINFORCE.
What are the three terms of the full PPO loss?
Clipped policy surrogate, value-function MSE loss, and entropy bonus for exploration.
Why is the entropy bonus included?
To keep the policy stochastic and encourage exploration, preventing premature collapse to a deterministic policy.
Dekho, PPO ka core idea bahut simple hai. Policy gradient methods me hum policy ko improve karte hain, par problem yeh hai ki agar ek hi update me policy ko bahut zyada change kar diya, toh policy collapse ho jaati hai — kyunki gradient sirf current policy ke aas-paas hi reliable hota hai. Toh PPO bolta hai: "improve toh karo, par thoda-thoda, apne purane policy ke close raho." Isko hi trust region kehte hain.
Iske liye PPO ek ratio use karta hai: rt=πnew/πold — matlab naya policy us action ko kitna zyada ya kam likely bana raha hai. Fir yeh ratio ko [0.8,1.2] me clip kar deta hai (jab ϵ=0.2). Agar action accha tha (A^>0) aur ratio bahut upar chala gaya, PPO ka gradient zero ho jaata hai — matlab "bas, ab aur mat badha." Agar action bura tha, toh usko zyada suppress karne se rokta hai. Par ek important baat: agar galti se humne bure action ko zyada likely kar diya, toh min wali trick usko fully penalize karti hai — yaani apni galti sudharne ki hamesha permission hai.
Yeh matter isliye karta hai kyunki PPO ek hi data batch pe multiple SGD epochs chala sakta hai (importance sampling ki wajah se), toh REINFORCE se zyada sample-efficient hai. Aur TRPO jaisi complicated second-order maths (Fisher matrix, conjugate gradient) ki zaroorat nahi — sirf normal Adam optimizer se kaam ho jaata hai. Isiliye PPO aaj real-world RL (robotics, ChatGPT ka RLHF) me sabse zyada use hota hai — simple, stable, aur efficient.