Skip to main content

RL 010

· 15 min read

Policy Search Methods​

Instead of VV and QQ functions, we directly estimate the optimal policy.

πθ(a∣s)≈P(a∣s,θ)\pi^{\theta}(a|s) \approx P(a|s, \theta)

  • Policy was generated directly from the value function (e.g. ϵ\epsilon-greedy)
  • Parameterize the policy directly.
    • Instead of v(s,w)v(s,w) or q^(s,a,w)\hat{q}(s,a,w), we have πθ(a∣s)\pi^{\theta}(a|s)
    • Given a particular state ss, what actions should we take? (What is probability of that particular action?)
    • θ\theta is a learnable parameter which could be a neural network.

Value-based and Policy-based Methods​

  • Value-based: Learnt value function, Implicit policy (e.g. ϵ\epsilon-greedy)
  • Policy-based: No value function, Learnt policy.
    • Good convergence properties
    • Effective in high-dimensional or continuous action spaces
      • if it is really continuous and large, it is not efficient as well.
    • Can learn stochastic policies.
    • Sometimes policies are relatively simple, values and models are complex.
    • Typically reaches local optima.
    • Obtained knowledge is specific and does not generalize well.
  • Actor-Critic: Learnt value function, Learnt policy.

Policy Gradient Techniques​

  • Trust-Region Based: Optimize the policy in a trust zone (closer circle).

Stochastic policies​

Rock-Paper-Scissors​

  • A deterministic policy is easily exploited
    • Deterministic policy: If we follow a set of action or sequence of actions, we will definitely reach the goal and will always reach teh same location.
  • A uniform random policy is optimal policy.

Grid World​

Grid World

ϕ(s,a)=(1010⏟walls,0100⏟actions)\phi(s,a) = \big(\underbrace{1 0 1 0}_{walls}, \underbrace{0 1 0 0}_{actions}\big)
  • Agent cannot differentiate between the grey states.
  • ϕ(s,a)\phi(s,a) features describing state ss and action aa.
  • ϕ(s,E)=(1,0,1,0⏟NESW,0,1,0,0⏟NESW)\phi(s,E) = (\underbrace{1, 0, 1, 0}_{\text{NESW}}, \underbrace{0, 1, 0, 0}_{\text{NESW}}) is the North and the South are walls and the agent will move to the East.
  • If π(grey)=W\pi(\text{grey}) = W, then when the agent is in the left grey state, it will move west, get stuck in a loop, and never reach the goal.

Grid World Stochastic

  • Therefore, an optimal stochastic policy moves randomly EE or WW in grey states.
    • πθ(wall to N and S, move E)=0.5\pi_{\theta}(\text{wall to N and S, move E}) = 0.5
    • πθ(wall to N and S, move W)=0.5\pi_{\theta}(\text{wall to N and S, move W}) = 0.5
  • The agent will reach the goal with high probability.
  • Policy-based methods can learn Stochastic policies. 4563

Objective Function in Policy-based Methods​

Given a policy πθ(a∣s)\pi_{\theta}(a|s) with parameters θ\theta, the goal is to find the best θ\theta.

J1(θ)=vπθ(S1)J_1(\theta) = v_{\pi_{\theta}}(S_1)
  • In an episodic task (with an end state), J1(θ)J_1(\theta) is for that particular start state and measures how much expected return we can get.
  • S1S_1 is the start state.
  • J(θ)J(\theta) is the measure of the quality of the policy or the objective function to optimize.
JavV(θ)=∑sμπθ(s)vπθ(s)J_{avV}(\theta) = \sum_{s}\mu_{\pi\theta}(s)v_{\pi\theta}(s)
  • In continuing environments (doesn't have an end state), consider the states and take the average value weighted by how often the agent visits each state.
  • μπθ(s)\mu_{\pi\theta}(s) is how often the agent is visiting that particular state ss.
JavR(θ)=∑sμπθ(s)∑aπθ(a∣s)∑rp(r∣s,a)rJ_{avR}(\theta) = \sum_{s}\mu_{\pi\theta}(s)\sum_{a}\pi_{\theta}(a|s)\sum_{r}p(r|s,a)r
  • Use the average reward per time step.
  • Small batches can be used to estimate this average reward during training.

Policy-based Methods​

  • Policy-based RL is an optimization problem, find θ\theta that maximize J(θ)J(\theta).
    • J(θ)J(\theta) is the policy objective function.
  • Gradient-free methods: Hill Climbing, Genetic Algorithms, ...
  • Gradient-based

Δθ=α∇θJ(θ)\Delta{\theta} = \alpha \nabla_{\theta} J(\theta)

  • Policy gradient method will search for a local minimum in J(θ)J(\theta) by ascending the gradient of the Policy.
    • why ascending? because we want to maximize the objective function's value/rewards.
    • ∇θJ(θ)=(∂J(θ)θ1⋮∂J(θ)θn)\nabla_{\theta} J(\theta) = \begin{pmatrix} \frac{\partial J(\theta)}{\theta_1} \\ \vdots \\ \frac{\partial J(\theta)}{\theta_n} \end{pmatrix}
    • α\alpha is the step size.
ΔθJ(θ)=∇θEd[vπθ(s)]\Delta{\theta} J(\theta) = \nabla_{\theta} \mathbb{E}_d[v_{\pi\theta}(s)]
  • Assume the policy πθ\pi_{\theta} is differentiable.
  • Compute an estimate of the policy gradient.
  • Compute ΔθJ(θ)\Delta{\theta} J(\theta) using Monte Carlo samples since we need to explore the environment, gather information, and then learn the policy.

Score Function​

  • Assume the policy πθ\pi_{\theta} is differentiable.
  • ∇θπθ(s,a)\nabla_{\theta} \pi_{\theta}(s, a) is the gradient.
∇θπθ(s,a)=πθ(s,a)∇θπθ(s,a)πθ(s,a)=πθ(s,a)∇θlog⁡πθ(s,a)(∵ ∇θlog⁡f(θ)=1f(θ)∇θf(θ))\begin{aligned} \nabla_\theta \pi_\theta(s,a) &= \pi_\theta(s,a) \frac{\nabla_\theta \pi_\theta(s,a)} {\pi_\theta(s,a)} \\ &= \pi_\theta(s,a) \nabla_\theta \log \pi_\theta(s,a) \quad \big( \because \ \nabla_\theta \log f(\theta) = \frac{1}{f(\theta)} \nabla_\theta f(\theta) \big) \end{aligned}
  • Multiplying and dividing by πθ(s,a)\pi_\theta(s,a) is called the Likelihood Ratio Trick.
    • Since πθ(s,a)πθ(s,a)=1\frac{\pi_\theta(s,a)}{\pi_\theta(s,a)} = 1, this does not change the original value.
      • ∇θπθ(s,a)\nabla_\theta \pi_\theta(s,a) is Gradient of the policy
      • πθ(s,a)\pi_\theta(s,a) is the policy.
      • ∇θπθ(s,a)πθ(s,a)\frac{\nabla_\theta \pi_\theta(s,a)}{\pi_\theta(s,a)} measures how sensitive the policy is to changes in θ\theta, relative to the policy value itself.
    • From the derivative rule of the logarithm, ∇θπθ(s,a)πθ(s,a)=∇θlog⁡πθ(s,a)\frac{\nabla_\theta \pi_\theta(s,a)}{\pi_\theta(s,a)} = \nabla_\theta \log \pi_\theta(s,a).
  • Score Function: ∇θlog⁡πθ(s,a)\nabla_\theta \log \pi_\theta(s,a).

Policy Gradient Theorem​

Policy Gradient = How policy changes ×\times How good the action is.

  • It generalizes the likelihood ratio approach to multi-step MDPs.
  • Replaces the instantaneous reward r(s,a)r(s,a) with the action value function Qπθ(s,a)Q^{\pi\theta}(s,a).
    • s1→a1s2→a2s3→a3Goals_1 \xrightarrow{a_1} s_2 \xrightarrow{a_2} s_3 \xrightarrow{a_3} \text{Goal}
 ∇θJ(θ)=Eπθ[∇θlog⁡πθ(s,a)⏟Score FunctionQπθ(s,a)⏟Action Value Function]\ \nabla_\theta J(\theta) = \mathbb{E}_{\pi\theta}[ \underbrace{\nabla_\theta \log \pi_\theta(s,a)}_{\text{Score Function}} \underbrace{Q^{\pi\theta}(s,a)}_{\text{Action Value Function}} ]
  • The theorem applies to start state objective, average reward, and average value objectives.
  • Qπθ(s,a)Q^{\pi_\theta}(s,a): the expected long-term reward starting from state ss, taking action aa and following policy πθ\pi_\theta
  • ∇θlog⁡πθ(s,a)\nabla_\theta \log \pi_\theta(s,a): How sensitive the policy is to changes in θ\theta.
  • Eπθ[⋅]\mathbb{E}{\pi\theta}[\cdot]: Average over all possible states and actions according to the policy πθ\pi_\theta.
  • ∇θJ(θ)\nabla_\theta J(\theta): The direction in which θ\theta should be changed to increase the objective J(θ)J(\theta).

Simplified Policy Gradient steps​

  1. Loop
  2. Collect trajectories for Policy πθ\pi_\theta
  3. Estimate advantage function AA
  4. Compute Policy Gradient g^\hat{g}
  5. Update Policy Parameter θnew=θold+αg^\theta_{\text{new}} = \theta_{\text{old}} + \alpha \hat{g}
  • g^\hat{g} is the estimated policy gradient.
    • Can be MC policy gradient, or Actor-Critic Policy Gradient.
  • if α\alpha is too big, data collected under bad policy and it cannot be recovered.
  • if α\alpha is too small, it is not efficient use of experience.

REINFORCE Algorithm​

  • Monte Carlo Policy Gradient: explore and learn from the environment and learn the optimal policy.
  • Update Parameters by Stochastic Gradient Ascent.
  • Using policy gradient theorem: find the partial derivatives to find the direction of the gradient.
  • Using return vtv_t as an unbiased sample of Qπθ(s,a)Q^{\pi\theta}(s,a).
    • Qπθ(st,at)=Eπθ[vt∣st,at]Q^{\pi\theta}(s_t,a_t) = \mathbb{E}_{\pi\theta}[v_t | s_t, a_t]

Δθ=α∇θlog⁡πθ(st,at)vt\Delta{\theta} = \alpha \nabla_\theta \log \pi_\theta(s_t,a_t) v_t

Function REINFORCEInitialize θ arbitrarilyfor each episode {s1,a1,r1,…,sT−1,aT−1,rT}∼πθ dofor t=1 to T−1 doθ←θ+α∇θlog⁡πθ(st,at)vtreturn θ\begin{array}{l} \textbf{Function REINFORCE} \\ \qquad \text{Initialize } \theta \text{ arbitrarily} \\ \qquad \textbf{for each episode } \{s_1,a_1,r_1,\ldots,s_{T-1},a_{T-1},r_T\} \sim \pi_\theta \textbf{ do} \\ \qquad\qquad \textbf{for } t=1 \textbf{ to } T-1 \textbf{ do} \\ \qquad\qquad\qquad \theta \leftarrow \theta + \alpha \nabla_\theta \log \pi_\theta(s_t,a_t) v_t \\ \qquad \textbf{return } \theta \\ \end{array}

REINFORCE: Sutton and Barto​

Input: a differentiable policy parameterization π(a∣s,θ)Algorithm parameter: step size α>0Initialize policy parameter θ∈Rd′ (e.g., to 0)Loop forever (for each episode):Generate an episode S0,A0,R1,…,ST−1,AT−1,RT, following π(⋅∣⋅,θ)Loop for each step of the episode t=0,1,…,T−1:G←∑k=t+1Tγk−t−1Rk(Gt)θ←θ+αγtG∇ln⁡π(At∣St,θ)\begin{array}{l} \textbf{Input: } \text{a differentiable policy parameterization } \pi(a \mid s,\theta) \\ \textbf{Algorithm parameter: } \text{step size } \alpha > 0 \\ \textbf{Initialize } \text{policy parameter } \theta \in \mathbb{R}^{d'} \text{ (e.g., to 0)} \\ \\ \textbf{Loop forever (for each episode):} \\ \qquad \text{Generate an episode } S_0,A_0,R_1,\ldots,S_{T-1},A_{T-1},R_T, \text{ following } \pi(\cdot \mid \cdot,\theta) \\ \qquad \textbf{Loop for each step of the episode } t=0,1,\ldots,T-1: \\ \qquad\qquad G \leftarrow \sum_{k=t+1}^{T} \gamma^{k-t-1}R_k \qquad (G_t) \\ \qquad\qquad \theta \leftarrow \theta + \alpha \gamma^t G \nabla \ln \pi(A_t \mid S_t,\theta) \end{array}
  • Slow to converge.
  • Going to have low bias but high variance.

Actor-Critic​

  • Actor has a supervisor (Critic) that tells it how good or bad the action actor took is.
  • Actor: Controls agent's behavior using Policy-based methods.
  • Critic: Measures how good the action taken by the agent is using Value-based methods.

Reducing Variance using a Critic​

Qw(s,a)≈Qπθ(s,a)Q_w(s,a) \approx Q^{\pi\theta}(s,a)

  • Monte Carlo policy gradient has high variance.
  • Use a Critic to estimate the action-value function.
  • Actor-Critic algorithms maintains two sets of parameters:
  • Critic: Updates action-value function parameters ww.
    • It is solving the problem of policy evaluation.
    • How good is the policy πθ\pi_\theta for current parameters θ\theta?
    • MC or TD methods to estimate the value function.
  • Actor: Updates policy parameters θ\theta in the direction advised by the Critic.
ΔθJ(θ)=Eπθ[∇θlog⁡πθ(s,a)Qw(s,a)]Δθ=α∇θlog⁡πθ(s,a)Qw(s,a)\Delta_{\theta} J(\theta) = \mathbb{E}_{\pi\theta}[ \nabla_\theta \log \pi_\theta(s,a) Q_w(s,a) ] \\ \Delta_{\theta} = \alpha \nabla_\theta \log \pi_\theta(s,a) Q_w(s,a)
  • It follows an approximate policy gradient.

Action-Value Actor-Critic​

  • Using Linear value function approximation: Qw(s,a)=ϕ(s,a)TwQ_w(s,a) = \phi(s,a)^T w
  • Critic: Use Linear TD(0) to update ww.
  • Actor: Use policy gradient to update θ\theta.
Function Actor-CriticInitialize θ,sSample a∼πθfor each step doSample reward r=RsaSample transition s′∼PsaSample action a′∼πθ(s′,a′)δ=r+γQw(s′,a′)−Qw(s,a)θ=θ+α∇θlog⁡πθ(s,a)Qw(s,a)w←w+βδϕ(s,a)a←a′,  s←s′\begin{array}{l} \textbf{Function Actor-Critic} \\ \qquad \text{Initialize } \theta, s \\ \qquad \text{Sample } a \sim \pi_\theta \\ \\ \qquad \textbf{for each step do} \\ \qquad\qquad \text{Sample reward } r = R_s^a \\ \qquad\qquad\text{Sample transition } s' \sim P_s^a \\ \qquad\qquad \text{Sample action } a' \sim \pi_\theta(s',a') \\ \\ \qquad\qquad \delta = r + \gamma Q_w(s',a') - Q_w(s,a) \\ \qquad\qquad \theta = \theta + \alpha \nabla_\theta \log \pi_\theta(s,a) Q_w(s,a) \\ \\ \qquad\qquad \mathbf{w} \leftarrow \mathbf{w} + \beta \delta \phi(s,a) \\ \qquad\qquad a \leftarrow a',\; s \leftarrow s' \end{array}
  • δ\delta is Critic.
  • θ\theta is Actor.
  • Update ww: Critic can provide a better advice.

Actor-Critic: Sutton and Barto​

Input: a differentiable policy parameterization π(a∣s,θ)Input: a differentiable state-value function parameterization v^(s,w)Parameters: step sizes αθ>0,  αw>0Initialize policy parameter θ∈Rd′ and state-value weights w∈Rd (e.g., to 0)Loop forever (for each episode):Initialize S (first state of episode)I←1Loop while S is not terminal (for each time step):A∼π(⋅∣S,θ)Take action A,  observe S′,Rδ←R+γv^(S′,w)−v^(S,w)(if S′ is terminal, then v^(S′,w)≐0)w←w+αwδ∇v^(S,w)θ←θ+αθIδ∇ln⁡π(A∣S,θ)I←γIS←S′\begin{array}{l} \textbf{Input: } \text{a differentiable policy parameterization } \pi(a \mid s,\theta) \\ \textbf{Input: } \text{a differentiable state-value function parameterization } \hat{v}(s,\mathbf{w}) \\ \textbf{Parameters: } \text{step sizes } \alpha^\theta > 0,\; \alpha^{\mathbf{w}} > 0 \\ \textbf{Initialize } \text{policy parameter } \theta \in \mathbb{R}^{d'} \text{ and state-value weights } \mathbf{w} \in \mathbb{R}^{d} \text{ (e.g., to 0)} \\ \textbf{Loop forever (for each episode):} \\ \qquad \text{Initialize } S \text{ (first state of episode)} \\ \qquad I \leftarrow 1 \\ \qquad \textbf{Loop while } S \textbf{ is not terminal (for each time step):} \\ \qquad\qquad A \sim \pi(\cdot \mid S,\theta) \\ \qquad\qquad \text{Take action } A,\; \text{observe } S',R \\ \qquad\qquad \delta \leftarrow R + \gamma \hat{v}(S',\mathbf{w}) - \hat{v}(S,\mathbf{w}) \qquad \left( \text{if } S' \text{ is terminal, then } \hat{v}(S',\mathbf{w}) \doteq 0 \right) \\ \qquad\qquad \mathbf{w} \leftarrow \mathbf{w} + \alpha^{\mathbf{w}} \delta \nabla \hat{v}(S,\mathbf{w}) \\ \qquad\qquad \theta \leftarrow \theta + \alpha^\theta I \delta \nabla \ln \pi(A \mid S,\theta) \\ \qquad\qquad I \leftarrow \gamma I \\ \qquad\qquad S \leftarrow S' \end{array}

TRPO, Trust Region Policy Optimization​

A(s,a)=Q(s,a)−V(s)A(s,a) = Q(s,a) - V(s)

  • Advantage: the difference between the Q and the V values.
    • How good is an action compared to the average action for a specific state.
  • Q(s,a)Q(s,a) = the expected long-term return when taking action aa in state ss
  • V(s)V(s) = the expected average long-term return when following the policy from state ss
  • Used in many Deep RL algorithms such as TRPO, PPO, GRP and etc.
  • Stationary Target: Fixed target during training.

Update the old policy to a new policy such that they are with in a "Trusted" distance apart.

  • Conservative policy update allows improvement instead of degradation of policy.
  • Improve training stability by avoiding parameter updates that changes the policy too much at one step.
  • By enforcing KL divergence constraint on size of the policy update at each iteration.

Kullback-Leibler Divergence​

KL divergence score

KL(P∣∣Q) KL(P || Q)

  • It quantifies how much one probability distribution differs from another probability distribution.
  • ∣∣|| indicates divergence or PP's divergence from QQ.

DKL(P∣∣Q)=∑x∈XP(x)log⁡P(x)Q(x)D_{KL}(P || Q) = \sum_{x \in X} P(x) \log \frac{P(x)}{Q(x)}

  • Given two probability distributions PP and QQ over a discrete random variable XX, the KL divergence is the expected value under PP of the log ratio between PP and QQ.
    • Multiplying by P(x)P(x) gives more weight to events that occur frequently under PP.
    • PP large, QQ small → large divergence
    • PP small, QQ large → effect is smaller
  • e.g. πold(a1∣s)=0.8\pi_{\text{old}}(a_1|s) = 0.8 and πold(a2∣s)=0.2\pi_{\text{old}}(a_2|s) = 0.2, while πnew(a1∣s)=0.1\pi_{\text{new}}(a_1|s) = 0.1 and πnew(a2∣s)=0.9\pi_{\text{new}}(a_2|s) = 0.9
    • The policy changed drastically in one update step.
  • TRPO prevents this by enforcing DKL(πold∥πnew)≤δD_{KL}(\pi_{\text{old}} \| \pi_{\text{new}}) \leq \delta.

TRPO vs Gradient Descent​

ComparisonGradient DescentTrust Region
Optimization approachPicks the steepest direction.Defines a region in which to search for the next point.
StepMoves forward by a step size.Determines the maximum step size to explore.
Next pointMoves directly in the selected direction.Locates the optimal point within the trust region.
Search processRepeats the directional step.Resumes the search from the selected point.
Main characteristicFast and simple for optimizing an objective function.Controls how far the optimization explores at each step.
In Reinforcement LearningMay not work well in reinforcement learning.Provides a restricted region for finding the next optimal point.

TRPO vs Gradient Descent

PPO, Proximal Policy Optimization​

  • TRPO is relatively complicated, every time we need to find trust region and solve the optimization problem, leading to high computational cost.
  • PPO simplifies it by using a Clipped Surrogate function
  • Based on a ratio of two policies
    • Current Policy πθ\pi_{\theta}
    • Baseline Policy (Old Policy) πθold\pi_{\theta_{\text{old}}}

Policy Ratio​

rt(θ)=πθ(at∣st)πθold(at∣st)r_t(\theta) = \frac{\pi_\theta(a_t|s_t)} {\pi_{\theta_{\text{old}}}(a_t|s_t)}
  • rt(θ)=1r_t(\theta)=1: no policy change
  • rt(θ)>1r_t(\theta)>1: the action becomes more likely
  • rt(θ)<1r_t(\theta)<1: the action becomes less likely

The surrogate objective is:

J(θ)=Et[rt(θ)A^t]J(\theta) = \mathbb{E}_t \left[ r_t(\theta)\hat A_t \right]
  • A^t>0\hat A_t>0: the action was better than expected → increase its probability.
  • A^t<0\hat A_t<0: the action was worse than expected → decrease its probability.
  • Without a restriction, the policy may change too much in a single update.

Clipped Surrogate Objective​

JCLIP(θ)=E^t[min⁡(rt(θ)A^t⏟Normal Policy Gradient objective,clip⁡(rt(θ),1−ϵ,1+ϵ)⏟Clipped Policy Gradient ObjectiveA^t)]J^{CLIP}(\theta) = \hat{\mathbb E}_t \left[ \min ( \underbrace{r_t(\theta)\hat A_t}_{\text{Normal Policy Gradient objective}}, \underbrace{\operatorname{clip} (r_t(\theta),1-\epsilon,1+\epsilon)}_{\text{Clipped Policy Gradient Objective}}\hat A_t ) \right]
  • rt(θ)=πθ(at∣st)πθold(at∣st)r_t(\theta) = \frac{\pi_\theta(a_t|s_t)}{\pi_{\theta_{\text{old}}}(a_t|s_t)} is the ratio of the new policy to the old policy.
  • A^t=Q(st,at)−V(st)\hat A_t = Q(s_t,a_t) - V(s_t) is the advantage function.
  • ϵ\epsilon is a hyperparameter, usually 0.10.1 or 0.20.2.
  • If ϵ=0.2\epsilon=0.2, the clipping range is [0.8,1.2][0.8,1.2].
  • For A^t>0\hat A_t>0, PPO removes the benefit of increasing rtr_t above 1+ϵ1+\epsilon.
  • For A^t<0\hat A_t<0, PPO removes the benefit of decreasing rtr_t below 1−ϵ1-\epsilon.
  • The policy ratio itself is not strictly forced to remain inside the clipping range.
  • Instead, clipping removes the incentive for excessively large beneficial policy updates.

Clipped Surrogate Objective

Algorithm: PPO with Clipped ObjectiveInput: θ0, ϵfor k=0,1,2,… doCollect set of partial trajectories Dk on policy πk=π(θk)Estimate advantages A^tπk using any advantage estimation algorithmCompute policy updateθk+1=arg⁡max⁡θLθkCLIP(θ)by taking K steps of minibatch SGD (via Adam), whereLθkCLIP(θ)=Eτ∼πk[∑t=0Tmin⁡(rt(θ)A^tπk,clip⁡(rt(θ),1−ϵ,1+ϵ)A^tπk)]\begin{array}{l} \textbf{Algorithm: PPO with Clipped Objective} \\ \textbf{Input: } \theta_0,\ \epsilon \\ \textbf{for } k=0,1,2,\ldots \textbf{ do} \\ \qquad \text{Collect set of partial trajectories } \mathcal{D}_k \text{ on policy } \pi_k=\pi(\theta_k) \\ \qquad \text{Estimate advantages } \hat{A}_t^{\pi_k} \text{ using any advantage estimation algorithm} \\ \\ \qquad \text{Compute policy update} \\ \qquad \theta_{k+1} = \arg\max_{\theta} \mathcal{L}_{\theta_k}^{CLIP}(\theta) \\ \\ \qquad \text{by taking } K \text{ steps of minibatch SGD (via Adam), where} \\ \qquad \mathcal{L}_{\theta_k}^{CLIP}(\theta) = \mathbb{E}_{\tau\sim\pi_k} \left[ \sum_{t=0}^{T} \min \left( r_t(\theta)\hat{A}_t^{\pi_k}, \operatorname{clip} \left( r_t(\theta),1-\epsilon,1+\epsilon \right) \hat{A}_t^{\pi_k} \right) \right] \\ \end{array}
  • θ0\theta_0: Initial policy parameters.
  • ϵ\epsilon: Clipping threshold.
  • A^tπk\hat{A}_t^{\pi_k}: Aπ(s,a)=Qπ(s,a)−Vπ(s)A_\pi(s,a)=Q_\pi(s,a)-V_\pi(s), where at∼π(at∣st),st+1∼P(st+1∣st,at)a_t\sim\pi(a_t\mid s_t),\quad s_{t+1}\sim P(s_{t+1}\mid s_t,a_t), for t≥0t\ge0.