← Back to Reinforcement Learning Mind Map
🎮 Reinforcement LearningID: trpo

TRPO → PPO Lineage

TRPO 与 PPO 脉络
🎯Core Definition
TRPO (Trust Region Policy Optimization) constrains the single-step policy update via a KL trust region to guarantee monotonic improvement:
📌Overview
max⁡θ  Es,a∼πθold[πθ(a∣s)πθold(a∣s)Aπθold(s,a)]s.t.  Es[DKL(πθold(⋅∣s)∥πθ(⋅∣s))]≤δ\max_\theta\; \mathbb{E}_{s,a\sim\pi_{\theta_{old}}}\left[\frac{\pi_\theta(a|s)}{\pi_{\theta_{old}}(a|s)} A^{\pi_{\theta_{old}}}(s,a)\right] \quad \text{s.t.}\; \mathbb{E}_s\left[D_{KL}(\pi_{\theta_{old}}(\cdot|s) \| \pi_\theta(\cdot|s))\right] \le \delta \nDerivation: 1. Linearize the surrogate objective at θold\theta_{old}: maximize gTΔθg^T\Delta\theta with g=∇θEs,a∼πθold[πθ(a∣s)πθold(a∣s)A]g = \nabla_\theta\mathbb{E}_{s,a\sim\pi_{\theta_{old}}}[\frac{\pi_\theta(a|s)}{\pi_{\theta_{old}}(a|s)} A] — the expectation is sampled under the old policy (the probability ratio is the importance weight); 2. The KL constraint vanishes to first order at θold\theta_{old}; expanding to second order gives 12ΔθTFΔθ≤δ\frac{1}{2}\Delta\theta^T F\Delta\theta \le \delta with the Fisher matrix F=Es,a[∇θlog⁡πθ(a∣s)∇θlog⁡πθ(a∣s)T]F = \mathbb{E}_{s,a}[\nabla_\theta\log\pi_\theta(a|s)\nabla_\theta\log\pi_\theta(a|s)^T] (negative expected Hessian — the Hessian approximation, no second-order derivatives needed); 3. Lagrangian solution gives the natural gradient Δθ=αF−1g\Delta\theta = \alpha F^{-1}g; solve Fx=gFx = g by conjugate gradients (avoiding the O(n2)O(n^2) explicit inverse) and backtrack the step α\alpha by line search using the monotonic-improvement bound (KKL, with C=4εγ(1−γ)2C = \frac{4\varepsilon\gamma}{(1-\gamma)^2}).
💡Use Cases
continuous control where monotonic improvement matters and samples are expensive; the conceptual source of constrained updates in offline RL.
⚡Key Problems Solved
vanilla policy gradient can collapse the policy with one large step. TRPO provides a trust region via a second-order KL constraint, but each iteration needs conjugate gradient and line search — expensive and complex. PPO approximates the same constraint to first order by clipping the ratio to [1−ε,1+ε][1-\varepsilon, 1+\varepsilon] (a small KL trust region), keeping TRPO's stability with plain first-order SGD — that is the TRPO → PPO lineage: constrained optimization becomes a clipped surrogate objective.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of TRPO → PPO Lineage.
Use Cases
In production engineering, what are the primary use cases for TRPO → PPO Lineage and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write TRPO's constrained problem: the surrogate objective and the KL constraint E[D_KL]≤δ.
2
Whiteboard: linearize the objective, expand KL to second order, derive the natural gradient Δθ=αF⁻¹g, and explain why the Fisher matrix approximates the Hessian.
3
How does TRPO guarantee monotonic improvement? Roles of line search and the coefficient C=4εγ/(1-γ)².
4
The TRPO → PPO lineage: how does ratio clipping approximate the KL trust region?
5
Where is TRPO's computational bottleneck (Hessian/conjugate gradient), and how is it accelerated in practice?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "TRPO → PPO Lineage"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardPolicy Gradient TheoremNext Card →DQN Trio

🔗 More Reinforcement Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/RL/card/trpo
中文速览与面试要点

TRPO 与 PPO 脉络 (TRPO → PPO Lineage)

定义: TRPO (Trust Region Policy Optimization, 信任域策略优化) 用 KL 散度信任域约束限制策略单步更新幅度,保证单调改进。优化问题: _ \; E_s,a _ _old [ _ (a|s) _ _old(a|s) A^ _ _old(s,a) ] s.t.\; E_s [D_KL( _ _old( |s) \| _ ( |s)) ] 推导链: 1. 对替代目标在 _old 处一阶(线性)近似: g^T ,其中 g = _ E_s,a _ _old[ _ (a|s) _ _old(a|s) A] —— 期望按旧策略采样即可,无需重采样(重要性采样权重恰为概率比); 2. KL 约束在 _old 处一阶为零(散度在相等点取极小)、展开到二阶: 12 ^T F ,其中 Fisher 矩阵 F = E_s,a[ _ _ (a|s) _ _ (a|s)^T] 是期望海森的负值(海森近似),无需二阶导即可估计; 3. 拉格朗日法求解得自然梯度方向 = F^-1g:用共轭梯度法解线性系统 Fx = g(避免 O(n^2) 的显式逆矩阵),再按单调改进界(KKL 定理,系数 C = 4 (1- )^2)做线性搜索回溯步长 ,保证目标不降。 使用场景: 需要单调改进保证、采样昂贵(样本量有限)的连续控制任务;也是离线 RL 中约束策略更新的思想源头。 解决的问题: 普通策略梯度一步过大即策略崩溃。TRPO 用二阶 KL 约束给出信任域,但每次迭代要解 Fisher 逆(共轭梯度)与线性搜索,工程复杂、代价高。PPO 用概率比截断 [1- , 1+ ] 一阶近似同一约束(一个小的 KL 信任域),得到 TRPO 的稳定性而只需一阶 SGD —— 这就是 TRPO → PPO 的脉络:约束优化被转化为带 clip 的代理目标。

核心要点

  • 写出 TRPO 的约束优化问题:替代目标与 KL 约束 E[D_KL]≤δ 分别是什么?
  • 白板手推: 目标线性化 + KL 二阶展开,推导自然梯度方向 Δθ=αF⁻¹g,说明 Fisher 矩阵为何是海森近似?
  • TRPO 如何保证单调改进?线性搜索与系数 C=4εγ/(1-γ)² 的作用?
  • TRPO 与 PPO 的脉络:概率比 clip 如何近似 KL 信任域?
  • TRPO 的计算瓶颈(海森/共轭梯度)在哪?实践中如何加速?