show me the PPO algorithm formula
- User
show me the PPO algorithm formula
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
show me the PPO algorithm formula
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Proximal Policy Optimization (PPO) is a reinforcement learning algorithm that enhances training stability by constraining the magnitude of policy updates. This is achieved through a clipped surrogate objective function, which prevents the policy from deviating excessively from the previous iteration.
The PPO objective function is defined as:
[ L(\theta) = \mathbb{E}_t \left[ \min\left( r_t(\theta) \hat{A}_t, \text{clip}(r_t(\theta), 1 - \epsilon, 1 + \epsilon) \hat{A}_t \right) \right] ]
Where:
( \theta ) represents the policy parameters.
( r_t(\theta) ) is the probability ratio between the new and old policies:
[ r_t(\theta) = \frac{\pi_\theta(a_t | s_t)}{\pi_{\theta_{\text{old}}}(a_t | s_t)} ]
Here, ( \pi_\theta(a_t | s_t) ) denotes the probability of taking action ( a_t ) in state ( s_t ) under the new policy, and ( \pi_{\theta_{\text{old}}}(a_t | s_t) ) under the old policy.
( \hat{A}_t ) is the estimated advantage function, indicating how much better or worse an action ( a_t ) is compared to the average action at state ( s_t ).
( \epsilon ) is a small hyperparameter (commonly set around 0.2) that defines the clipping range, controlling how much the new policy is allowed to deviate from the old one.
The clipping mechanism ensures that the policy updates remain within a specified range, thereby preventing large, destabilizing changes and promoting more stable learning[1].
In addition to the policy loss, PPO often incorporates a value function loss and an entropy bonus to encourage exploration. The total loss function is typically expressed as:
[ L_{\text{total}} = L_{\text{CLIP}}(\theta) + c_1 \cdot L_{\text{VF}}(\phi) - c_2 \cdot H(\pi_\theta) ]
Where:
This combination of objectives allows PPO to effectively balance exploration and exploitation, leading to robust and efficient policy learning[2].