Skip to content
Back to skills

Pplm Perturbation Loop

ASecurity

Run PPLM-style iterative normalized gradient perturbations with KL regularization and optimizer trace evidence.

  • 247 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 9, 2026
toolspythongit

Security analysis

A100/100

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Pplm Perturbation Loop?

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

Security grade badge for Pplm Perturbation Loop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-pplm-perturbation-loop/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-pplm-perturbation-loop)

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

SKILL.md
---
name: pplm_perturbation_loop
description: Run PPLM-style iterative normalized gradient perturbations with KL regularization and optimizer trace evidence.
---

# PPLM Perturbation Loop

Use this skill when a recovery or implementation needs the central PPLM mechanism: optimizing an inference-time perturbation while the base language-model parameters remain fixed.

## Inputs
- Base logits or hidden-state proxy values.
- Objective callback returning loss, gradient, and diagnostics.
- Step size, iteration count, optional KL regularization scale, and gradient normalization flag.

## Outputs
- Perturbed logits/proxy values.
- Per-step trace with loss, target mass, KL to the base distribution, and parameter values.
- Booleans showing an optimizer step changed the perturbation.

## Workflow
1. Initialize perturbation to zeros or supplied values.
2. Evaluate the attribute objective on `base + perturbation`.
3. Add a KL-style gradient term toward the base distribution when requested.
4. Normalize nonzero gradients, take a descent step, and log before/after values.
5. Return the final perturbed logits and trace.

## Validation
Run `python tests/test_perturbation_loop.py` or use the Distiller validator.

## Limitations
The helper is a faithful low-dimensional proxy for PPLM optimization, not a transformer past-key-value implementation.

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…