Skip to content
Back to skills

Msfm Batch Coupling

ASecurity

Construct uniform and exact small-batch BatchOT couplings for Multisample Flow Matching recovery and tests.

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

Works with

  • cli

Security analysis

A100/100

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Msfm Batch Coupling?

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

Security grade badge for Msfm Batch Coupling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-msfm-batch-coupling/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-msfm-batch-coupling)

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

SKILL.md
---
name: msfm_batch_coupling
description: Construct uniform and exact small-batch BatchOT couplings for Multisample Flow Matching recovery and tests.
---

# MSFM Batch Coupling

Use this skill when a workflow needs the Multisample Flow Matching pairing step: two equal-size minibatches are converted into either a uniform/independent CondOT baseline or an exact small-batch BatchOT assignment.

Do not use this skill for large production batches unless the exhaustive `batch_ot` implementation is replaced by a scalable assignment or Sinkhorn solver.

## Inputs

- Source batch: JSON list of numeric vectors.
- Target batch: JSON list of numeric vectors with the same length and dimension.
- Method: `uniform` or `batch_ot`.

## Outputs

- Pair indices.
- Mean squared transport cost.
- Coupling matrix and row/column marginal checks.

## Workflow

1. Validate non-empty equal-size source and target batches.
2. Compute pairwise squared Euclidean costs.
3. For `uniform`, report the independent expected cost and a uniform doubly stochastic matrix.
4. For `batch_ot`, solve the exact minimum-cost permutation for small batches.
5. Use row and column sums to confirm marginal preservation.

## Validation

Run:

```bash
python scripts/coupling.py --self-test
python tests/test_coupling.py
```

## Limitations

- `batch_ot` is exhaustive and intended for bounded recovery/tests.
- The script implements square couplings only.
- It preserves the paper mechanism but is not a full high-dimensional training 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…