Skip to content
Back to skills

Ppo Clipped Surrogate Objective

ASecurity

Compute and validate PPO clipped probability-ratio surrogate losses and diagnostics for policy update recovery or implementation.

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
toolspythonbash

Works with

  • cli

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill ppo_clipped_surrogate_objective --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ppo Clipped Surrogate Objective?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ppo Clipped Surrogate Objective
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-ppo-clipped-surrogate-objective-arex-skill/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-ppo-clipped-surrogate-objective-arex-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: ppo_clipped_surrogate_objective
description: Compute and validate PPO clipped probability-ratio surrogate losses and diagnostics for policy update recovery or implementation.
---

# PPO Clipped Surrogate Objective

## When To Use

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.

## Inputs

- `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`.

## Outputs

The script returns JSON with `ratios`, `unclipped`, `clipped`, `objective_terms`, `mean_objective`, `loss`, `clip_fraction`, and `approx_kl`.

## Workflow

1. Freeze old-policy log probabilities before computing ratios.
2. Compute `ratio = exp(new_log_prob - old_log_prob)`.
3. Compute `unclipped = ratio * advantage`.
4. Compute `clipped = clip(ratio, 1-epsilon, 1+epsilon) * advantage`.
5. Use `minimum(unclipped, clipped)` per sample and average it.
6. Minimize `loss = -mean_objective` if using a minimization optimizer.
7. Inspect `clip_fraction` and `approx_kl` to ensure the update is auditable.

## Validation

Run:

```bash
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
```

## Limitations

This skill does not estimate advantages, sample environments, or train parameters. It focuses only on the PPO objective and diagnostics.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.