Skip to content
Back to skills

Annealed Langevin Sampler

ASecurity

Run annealed Langevin dynamics with composed scores for F-NPSE or PF-NPSE posterior sampling.

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

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Annealed Langevin Sampler?

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

Security grade badge for Annealed Langevin Sampler
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-annealed-langevin-sampler/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-annealed-langevin-sampler)

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

Download with Pro
SKILL.md
---
name: annealed_langevin_sampler
description: Run annealed Langevin dynamics with composed scores for F-NPSE or PF-NPSE posterior sampling.
---

# Annealed Langevin Sampler

Use this skill when a recovery needs to sample from a posterior approximation using a score function already composed from F-NPSE or PF-NPSE terms. It implements the paper's Algorithm 1 in a bounded, deterministic-seeded form suitable for tests and recovery harnesses.

Do not use this skill to train score networks or to define the F-NPSE algebra. It consumes a callable score and a reference sampler.

## Inputs

- Initial samples from the high-noise reference distribution, or a reference sampler.
- Composed score callable `score(theta, t)`.
- Time levels ordered from high noise to low noise.
- Step size, Langevin steps per level, and random seed.

## Outputs

- Final posterior samples.
- Trace metadata with score norms, sample means, level count, step size, and seed.

## Workflow

1. Initialize samples from the reference distribution.
2. Traverse time levels from high noise to low noise.
3. Apply `theta <- theta + 0.5 * step_size * score(theta, t) + sqrt(step_size) * noise`.
4. Log per-level summary statistics.
5. Return samples and trace.

## Validation

Run:

```bash
python /share/project/yuyang/workspace/Paper2Skills/Distiller/skills/module-to-skill/scripts/validate_skill_tree.py <skill_dir> --run-tests
```

The tests use an exact Gaussian score and verify that samples move toward the target mean while preserving trace metadata.

## Limitations

The sampler is sensitive to step size and score scaling. Recovery scripts should expose these settings and avoid interpreting a short bounded run as a full-scale reproduction of the paper's 400-level experiments.

Files in this skill

  • SKILL.md1.7 KB
  • scripts/langevin_sampler.py4.3 KB
  • tests/test_langevin_sampler.py532 B

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.