Expand description
Rectified Flow Matching (RFM) helpers.
In the FM literature, “rectification” is largely about the coupling (\pi(x_0,x_1)): choosing (or improving) which base samples are paired with which target samples so that trajectories become straighter / less “curly”.
This module provides small, testable coupling utilities built on top of wass (OT).
Functions§
- apply_
pairing - Apply the selected pairing strategy to a minibatch of source and target points.
- greedy_
bipartite_ match_ from_ weights - Build a greedy one-to-one matching (a permutation) from a nonnegative
n×nweight matrix. - minibatch_
exp_ greedy_ pairing - Fast minibatch pairing: convert costs to weights via
exp(-cost / temp)then greedy match. - minibatch_
ot_ greedy_ pairing - Compute a minibatch OT coupling between two equal-sized point clouds
xandy, then return a greedy one-to-one matching derived from the transport plan. - minibatch_
ot_ greedy_ pairing_ normalized - Like
minibatch_ot_greedy_pairingbut normalizes the cost matrix before Sinkhorn. - minibatch_
ot_ selective_ pairing - Partial Sinkhorn pairing:
- minibatch_
partial_ rowwise_ pairing - Partial pairing heuristic:
- minibatch_
rowwise_ nearest_ pairing - Fast minibatch pairing: greedy row-wise nearest neighbor on the Euclidean cost matrix.