executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
ppo_clipped_surrogate_objectiveCompute and validate PPO clipped probability-ratio surrogate losses and diagnostics for policy update recovery or implementation.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when implementing, auditing, or recovering the core objective from Proximal Policy Optimization. It is appropriate when you have action log probabilities under an old behavior policy, action log probabilities under a candidate new policy, and aligned advantage estimates.
Do not use it to collect trajectories or update model parameters; those are separate responsibilities.
old_log_probs: aligned numeric list of sampled-action log probabilities under the old policy.new_log_probs: aligned numeric list under the candidate policy.advantages: aligned numeric list of advantages.clip_epsilon: positive clipping width, typically 0.2.The script returns JSON with ratios, unclipped, clipped, objective_terms, mean_objective, loss, clip_fraction, and approx_kl.
ratio = exp(new_log_prob - old_log_prob).unclipped = ratio * advantage.clipped = clip(ratio, 1-epsilon, 1+epsilon) * advantage.minimum(unclipped, clipped) per sample and average it.loss = -mean_objective if using a minimization optimizer.clip_fraction and approx_kl to ensure the update is auditable.Run:
python tests/test_clipped_surrogate.py
python scripts/compute_clipped_surrogate.py --old-log-probs '[0,0]' --new-log-probs '[0.3,-0.3]' --advantages '[1,-1]' --clip-epsilon 0.2
This skill does not estimate advantages, sample environments, or train parameters. It focuses only on the PPO objective and diagnostics.