Skip to content
Back to skills

Bbvi Variance Reduction

ASecurity

Compute BBVI Rao-Blackwellized and score-function control-variate gradient estimators with variance diagnostics.

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

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 bbvi_variance_reduction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bbvi Variance Reduction?

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

Security grade badge for Bbvi Variance Reduction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-bbvi-variance-reduction/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-bbvi-variance-reduction)

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: bbvi_variance_reduction
description: Compute BBVI Rao-Blackwellized and score-function control-variate gradient estimators with variance diagnostics.
---

# BBVI Variance Reduction

## When To Use

Use this skill after forming BBVI score-function terms when you can identify local model terms for a variational factor or want to apply the paper's score-function control variate. It preserves black-box behavior because it requires only local log-density values and score functions.

Do not use it to update parameters or to claim variance reduction without numeric diagnostics.

## Inputs

- `score`: sample-by-parameter score values for one variational factor.
- `local_signal`: per-sample local learning signal for that factor.
- `full_signal`: optional per-sample full learning signal for naive comparison.

## Outputs

- `rao_blackwell_terms` and `rao_blackwell_estimate`.
- `control_variate_scale` and `control_variate_estimate`.
- `variance`: naive, Rao-Blackwellized, and control-variate empirical variances.
- `variance_reduction_ratio`: naive variance divided by control-variate variance when available.

## Workflow

1. Normalize scores and validate sample counts.
2. Compute Rao-Blackwellized local terms as `score * local_signal`.
3. Estimate the control-variate scale by aggregated covariance divided by aggregated score variance.
4. Compute corrected terms as local terms minus `a_hat * score`.
5. Report variance diagnostics over per-sample term norms.

## Validation

Run:

```bash
python tests/test_variance_reduction.py
```

## Limitations

The caller must supply valid local terms. This skill does not infer a Markov blanket from an arbitrary model graph.

Files in this skill

  • SKILL.md1.6 KB
  • scripts/variance_reduction.py4.3 KB
  • tests/test_variance_reduction.py923 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.