Source-linked AI summary
On the Guidance of Flow Matching
Ruiqi Feng, Chenglei Yu, Wenhao Deng, Peiyan Hu, Tailin Wu
TL;DR
Guidance for flow matching remains underexplored because it is more general than diffusion guidance and existing methods cover only part of its design space. This paper proposes a general framework and derives multiple guidance approaches. Experiments across synthetic data, image inverse problems, and offline reinforcement learning demonstrate their effectiveness.
Problem
Guidance for general flow matching remains underexplored, while many existing methods assume Gaussian sources and simple probability paths.
Source: §1 · p. 1Method
The paper develops a theoretically justified general framework and derives training-free, training-based, and approximate guidance methods from it.
Source: §1 · p. 2Results
Experiments on synthetic datasets, image inverse problems, and offline reinforcement-learning benchmarks demonstrate the proposed methods’ effectiveness.
Source: §1 · p. 2Takeaways & Limitations
The framework’s theoretical analysis and empirical comparisons provide guidance for choosing methods across generative tasks.
Source: §1 · p. 2The framework assumes P ≈ 1; when coupling is strong, the guidance vector field may no longer have the correct direction.
Source: §5 · p. 9
Abstract
from arXiv · showhide
Flow matching has shown state-of-the-art performance in various generative tasks, ranging from image generation to decision-making, where generation under energy guidance (abbreviated as guidance in the following) is pivotal. However, the guidance of flow matching is more general than and thus substantially different from that of its predecessor, diffusion models. Therefore, the challenge in guidance for general flow matching remains largely underexplored. In this paper, we propose the first framework of general guidance for flow matching. From this framework, we derive a family of guidance techniques that can be applied to general flow matching. These include a new training-free asymptotically exact guidance, novel training losses for training-based guidance, and two classes of approximate guidance that cover classical gradient guidance methods as special cases. We theoretically investigate these different methods to give a practical guideline for choosing suitable methods in different scenarios. Experiments on synthetic datasets, image inverse problems, and offline reinforcement learning demonstrate the effectiveness of our proposed guidance methods and verify the correctness of our flow matching guidance framework. Code to reproduce the experiments can be found at https://github.com/AI4Science-WestlakeU/flow_guidance.
1. Introduction
Flow matching supports flexible probability paths, but guidance for its broader design space remains less explored than diffusion guidance. The paper presents a general framework and derives guidance methods that are theoretically justified and empirically evaluated.
1. Introduction
- Existing flow-matching guidance often assumes Gaussian sources and simple paths, leaving guidance for the broader design space unresolved.These assumptions restrict the flexibility that distinguishes flow matching from diffusion models.Source: §1 · pp. 1–2
- Experiments on synthetic datasets, image inverse problems, and offline reinforcement-learning benchmarks demonstrate the proposed methods’ effectiveness.The image inverse-problem experiments compare guidance types to inform method choice.Source: §1 · p. 2
- The paper proposes a theoretically justified unified framework for guidance with arbitrary source distributions, couplings, and conditional paths.It derives training-free asymptotically exact guidance, training-based guidance losses, and approximate methods covering classical guidance techniques.Source: §1 · p. 2
- The framework theoretically justifies classical guidance methods for general flow matching, beyond derivations limited to Gaussian-source settings.The paper also compares methods across tasks to inform guidance selection.Source: §1 · p. 2
2. Background
Flow matching learns a vector field that transports samples from a tractable base distribution to a target distribution along a probability path. Conditional flow matching makes this vector-field learning tractable.
2. Background
- A vector field transports samples from a tractable base distribution to a target distribution along a probability path.Solving the associated ordinary differential equation produces samples from the target distribution.Source: §2 · p. 2
- Flow matching learns the marginal vector field through conditional vector fields and paths indexed by data couplings.The coupling distribution specifies the paired samples used to define those conditional paths.Source: §2 · p. 2
- The direct marginal-vector-field loss is intractable, so an equivalent conditional flow-matching loss provides a tractable training objective.The conditional loss can be used to train the vector-field model.Source: §2 · p. 2
3. Guidance Vector Fields
The paper organizes general flow-matching guidance around a unified guidance vector field, then develops Monte Carlo, approximate, and training-based approaches. Its framework covers arbitrary sources, couplings, and conditional paths.
3. Guidance Vector Fields
- The guidance-method roadmap also includes local and covariance-based approximations, derivative-free variants, and exact training-based guidance.It identifies gsim-MC and inverse-problem-specific gsim-A, then introduces training losses for gϕ.Source: §3 · pp. 2–3
3.1. General Guidance Vector Fields
- The framework characterizes how adding a guidance vector field can make the flow generate samples from an energy-weighted target distribution.The target assigns greater likelihood to samples with lower energy.Source: §3.1 · p. 3
- The framework assumes P ≈ 1, an approximation that can be exact for independent couplings but may matter when dependent couplings differ substantially.Under uncoupled affine Gaussian paths, the guidance reduces to a commonly used diffusion guidance term; the paper also considers dependent couplings or non-Gaussian sources.Source: §3.1 · p. 3
3.2. Monte Carlo Estimation, gMC
- The section derives Monte Carlo guidance as a training-free, asymptotically exact estimate of the general guidance field.The method’s integral estimates require samples from an intractable conditional distribution, motivating its sampling-based estimation.Source: §3.2 · p. 3
gMC
The gMC method estimates guidance with Monte Carlo sampling and applies across source distributions and couplings. Its variance makes it less suitable for high-dimensional tasks or sharply varying energy functions.
gMC
- The overview places gMC among guidance methods derived from a unified expression, alongside training-based methods and classical diffusion guidance.The figure presents the relationships among the guidance methods.Source: Figure 1 · p. 4, gMC · p. 4
- gMC is unbiased and applicable to arbitrary source distributions and dependent couplings, including optimal-transport couplings and rectified flow.It is described as the first training-free, asymptotically exact guidance estimate for flow matching with a non-Gaussian source.Source: gMC · p. 4
- High Monte Carlo variance limits gMC with few samples, making it more suitable for gently varying energy functions and relatively low-dimensional data.The paper notes unsatisfactory performance on high-dimensional image inverse problems and suggests importance sampling as one variance-reduction technique.Source: gMC · p. 4
gMC-IS
The section presents gMC-IS sampling with a proposal chosen to improve scalability, and local Taylor approximations around the conditional mean to make guidance integrals tractable.
gMC-IS
- A proposal distribution that tracks the energy-weighted target can improve gMC-IS scalability, with its density ratio estimable by an unbiased Hutchinson trace estimator.The authors leave empirical investigation of gMC-IS to future work.Source: gMC-IS · p. 4, §3.3 · p. 4
3.3. Localized p(x1|x)
- Approximating the conditional endpoint distribution near its mean makes the integrals in the guidance equations tractable.The method uses Taylor expansion around the mean and approximates both the normalizing constant and guidance.Source: §3.3 · pp. 4–5
gMC-IS
- The authors leave empirical investigation of gMC-IS to future work.Source: §3.3 · p. 4
glocal
The section develops local guidance by approximating around the conditional endpoint mean and preconditioning the estimated energy gradient with conditional covariance. It also describes Gaussian approximations to the conditional distribution and their use in guidance.
glocal
- The approximation error is small for smooth energies and as t approaches 1, when the conditional endpoint covariance is small.The provided error bound is presented as more practical than the DPS Jensen-gap bound because it bounds guidance-field error.Source: glocal · p. 5
- Under the affine-path assumption, the endpoint estimate can use the learned velocity field; with the common linear schedule it matches the one-step Euler endpoint estimate.The assumption permits dependent couplings, including those with π(x0|x1) ≠ p(x0).Source: glocal · p. 5
- Local guidance approximates the guidance field near the conditional mean, with the estimated energy gradient preconditioned by the covariance of the conditional endpoint distribution.The affine-path derivation expresses the guidance using the covariance matrix and the gradient at the estimated endpoint.Source: glocal · p. 5
- Covariance can be approximated with a manually scheduled scalar matrix or learned from the conditional distribution, and local guidance adds no function evaluations over unguided sampling.The learned covariance is determined by the original distribution and is agnostic to the energy function.Source: glocal · p. 5
- Under the uncoupled affine Gaussian path assumption, the inverse conditional covariance depends affinely on the velocity-field Jacobian, connecting this guidance to classical diffusion methods.The resulting method covers loss-guided diffusion and diffusion posterior sampling.Source: glocal · pp. 5–6
3.4. Gaussian Approximation of p(z|xt)
- Approximating p(z|xt) with a Gaussian uses its mean and covariance; for known inverse-problem energies guidance can be derived analytically, while Monte Carlo estimation is available when J is unknown.The inverse-problem example uses a known degradation operator with Gaussian measurement noise under the affine-path assumption.Source: §3.4 · p. 6
gsim-inv-A
The section relates approximate guidance to established methods and develops trainable guidance losses. It reports that gMC and gϕ perform best across the illustrated synthetic settings, while diffusion guidance fails.
gsim-inv-A
- The framework’s gsim guidance exactly covers ΠGDM and OT-ODE, and is theoretically justified for dependent couplings such as OT-CFM.Source: gsim-inv-A · p. 6
3.5. Training-based Guidance gϕ
- gMC and gϕ yield the best guidance across the synthetic settings shown, while diffusion guidance fails.Figure 2 visualizes source and target distributions, start and end points, and flow trajectories.Source: Figure 2 · p. 7
- Training-based guidance losses provide unbiased gradient estimates without flow-matching-specific assumptions, and their minimizer recovers the true normalizer and guidance.Alternative losses share the same minimizer; ℓMRGM is identical to a training-based flow-matching guidance loss proposed by Zhang et al. (2025).Source: §3.5 · p. 7
4. Experiments
Experiments compare flow-matching guidance across synthetic data, offline planning, and image inverse problems. Results vary by setting: gMC and gϕ closely match synthetic targets, while image and planning tasks favor different methods.
4. Experiments
- The experiments benchmark guidance methods on synthetic datasets, generative decision-making, and image inverse problems to test learned and Monte Carlo guidance as well as practical method choice.Table 1 reports normalized scores averaged over five seeded runs, with 100 corresponding to expert scores.Source: §4 · p. 7, Table 1 · p. 8
4.1. Synthetic Dataset
- Across non-Gaussian synthetic datasets, gMC and gϕ nearly match the ground-truth distributions, while exact diffusion guidance distorts them under paths that violate its uncoupled affine Gaussian assumption.Gradient-based approximate methods concentrate samples on points instead of preserving the data manifold; as gMC’s sample count rises from 5 to 10^4, its Wasserstein-2 error approaches or surpasses the original model’s error, an approximate lower bound.Source: §4.1 · p. 8
4.2. Planning
- MC-based guidance beats the second-best method gcov-G by 3.5 points on average and is best in 7 of 9 Locomotion tasks.gcov-G generally scores 8.0 more than gcov-A but requires more computation for differentiation through the vector-field model; learned gϕ falls 10.4 points behind the best method on average.Source: §4.2 · p. 8, Table 1 · p. 8
4.3. Image Inverse Problems
- ΠGDM is best on 8 of 12 image-inverse metrics; gsim-A has lower FID than ΠGDM by 1.5 on average and stays within 3% of the best or runner-up in 5 of 6 other metrics.gcov-G is best or runner-up across all four superresolution metrics and three of four deblurring metrics; gMC performs poorly because the complex inverse-problem objective requires an infeasibly large sample budget.Source: Table 2 · p. 9, §4.3 · p. 9
- The image inverse-problem evaluation uses CelebA-HQ at 256×256 across inpainting, superresolution, and deblurring, reporting FID, LPIPS, PSNR, and SSIM on 3,000 test samples.The experiment benchmarks guidance performance on higher-dimensional generative tasks.Source: §4.3 · p. 9
5. Limitations and Future Works
The framework assumes P is approximately 1; strong coupling can invalidate the guidance vector-field direction. The authors also identify gMC’s sample efficiency on high-dimensional data and leave further efficiency improvements for future work.
- When coupling is strong, the guidance vector field no longer has the correct direction under the assumption P ≈ 1.The authors propose estimating P in future work to address exact coupling.Source: §5 · p. 9
- gMC has low sample efficiency on high-dimensional datasets, motivating further work on importance sampling and variance reduction.The authors also identify possible add-on vector fields to improve sampling efficiency and leave that direction for future work.Source: §5 · p. 9
- The authors leave improvements to specific guidance methods, including gMC-IS and control-variable techniques, for future work.They also propose exploring guided vector fields with properties such as straightness to facilitate sampling efficiency.Source: §5 · p. 9
6. Conclusion
The conclusion presents a general flow-matching guidance framework and a family of experimentally verified methods, with classical guidance methods covered as special cases. The accompanying theoretical material relates energy guidance to posterior sampling.
6. Conclusion
- The proposed framework derives Monte Carlo-based, approximate, and learned guidance methods, all verified by experiments, and covers multiple classical methods as special cases.The paper provides a theoretical derivation for each guidance method.Source: §6 · p. 9
A. Complete Theoretical Derivations and Proofs
- The appendix’s theoretical analysis includes proofs concerning guided sampling, the image-inverse-problem vector field, and recovery of ΠGDM under the uncoupled affine Gaussian path assumption.It also derives gsum-inv-A.Source: A. Complete Theoretical Derivations… · p. 13
A.1. Energy Guided Sampling as Posterior Sampling
- Energy-guided sampling from the reweighted distribution is equivalent to sampling from p(x|y).The appendix explains that an energy guidance algorithm can perform conditional generation from p(y|x) by setting J(x) = p(y|x).Source: §A.1 · p. 13
A.2. General Guidance
This appendix develops general guidance constructions and their approximations, special cases, training losses, and Monte Carlo variants, clarifying their assumptions, error conditions, and relationships to classical guidance. It also describes synthetic experiments assessing gMC’s asymptotic exactness using Wasserstein-2 distance.
A.2. General Guidance
- Theorem A.1 states that adding guidance gt to the original vector field yields a vector field generating the energy-reweighted target distribution and a path with the same noising process and conditional vector fields.The reverse coupling is also unchanged, while the constructed vector field is only one of infinitely many possible fields for that terminal distribution.Source: §A.2 · pp. 13–14
A.3. The P = 1 Approximation
- OT-CFM and uncoupled CFM have small relative VF error at all flow times on CelebA 256×256, supporting P = 1 for dependent couplings in realistic datasets.The comparison uses OT-CFM with batch size 128; the passage does not provide the error values.Source: Table 3 · p. 15, §A.3 · p. 15
A.4. Uncoupled Affine Gaussian Guidance
- General flow-matching guidance exactly covers diffusion guidance under an uncoupled affine Gaussian path, but this derivation does not extend to coupled paths.For the common σt = 1 − t, αt = t schedule, the guidance scheduler is unstable near t = 0; other schedules may avoid this instability.Source: §A.4 · pp. 15, 17
A.5. Proof of Proposition 3.5
- The intractable marginal loss has the same gradient as the tractable conditional loss.This establishes the gradient equivalence used to justify guidance matching training.Source: §A.5 · pp. 17–18
A.6. Other Ways to Obtain ZϕZ
- Contrastive learning for ZϕZ can sample from p(x1|xt) instead of p(x0, x1|xt) with the same Zt, while Monte Carlo estimation is available when p(xt|x0, x1) is known.The Monte Carlo estimate samples pairs from p(x0, x1); the contrastive approach is also applicable to coupled paths.Source: §A.6 · p. 18
A.7. Guidance Matching Losses
- The guidance-matching losses GM, VGM, RGM, and MRGM have the same expected gradient, and MRGM is the only one that does not require the auxiliary model ZϕZ.RGM uses a weight dependent on xt that emphasizes cases where the expectation of e−J(x1) under p(x1|xt) is small.Source: §A.7 · pp. 18, 19, 21
A.8. Algorithm Details and Variants of gMC
- With independent couplings, Monte Carlo guidance estimation can condition on x0 or x1, halving the integration-region dimensionality and making estimation more efficient.For the independent data coupling π(x0|x1) = p(x0), the estimation can be simplified to the x1-conditioned case.Source: §A.8 · p. 22
- The variance-reducing gMC variant uses importance sampling, which requires a known density for the forward path p(xt|x1).The appendix points to an algorithm that estimates guidance by Monte Carlo sampling.Source: §A.8 · p. 22
A.9. Localized Approximation
- The localized-guidance approximation error is bounded by a term scaling with the Hessian magnitude, conditional covariance norm, and sample dimension, and is smaller for smooth objectives and well-predicted x1 near t = 1.Accuracy also improves when the estimate E[x1] lies in a region where J is small; small vector-field norms C1 or C2 do not necessarily improve accuracy because relative error may increase.Source: §A.9 · p. 25
A.10. Estimation of ˆx1
- For affine paths with small σtε, the conditional expectation of x1 can be estimated, and the approximation becomes exact under Assumption 3.3, including for dependent couplings.The passage identifies this small-noise condition with independent-coupling flow matching and with methods such as optimal-transport conditional flow matching and Schrödinger Bridge conditional flow matching (Tong et al., 2024).Source: §A.10 · pp. 25–26
A.11. Proof of gcov
- Under the affine-path assumption, the residual approximation error in the covariance-based guidance derivation vanishes as σt and its time derivative approach zero.The proof identifies the residual term Υ and states that its norm converges to zero in this limit.Source: §A.11 · pp. 26–27
A.12. The Jacobian Trick
- Under Assumption 3.3, the inverse covariance of p(x1|xt) is affine to the Jacobian of the vector field with respect to the estimated x1.The appendix generalizes a similar result from Ye et al. (2024) to affine Gaussian path flow matching.Source: §A.12 · p. 27
A.13. Proof for gsim-inv
- For inverse-problem guidance, a Gaussian approximation to p(x1|xt) retains coupling through covariance off-diagonal blocks, whereas diagonal or scalar covariance assumptions discard that dependence.The general coupled affine-path calculation can be intractable because it requires matrix inversion; the text therefore considers approximations that retain nonzero off-diagonal blocks.Source: §A.13 · pp. 29–30
Special case: the non-coupled affine Gaussian path
- The derived affine-path guidance accommodates dependent coupling, including OT-CFM, and exactly covers classical diffusion guidance ΠGDM (Song et al., 2023a) and affine-Gaussian guidance OT-ODE (Pokle et al., 2024).In the uncoupled case, x0 and x1 can still be conditionally dependent given xt, so the conditional distribution is not generally block diagonal.Source: Special case: the non-coupled affine… · pp. 30, 32
B.1. Synthetic Dataset Experiment Details
- The synthetic experiment evaluates gMC’s asymptotic exactness by comparing guided samples with the ground-truth energy-weighted distribution using W2 distance, with model error w shown as a dashed-line performance floor.The learned source distribution gives the flow-matching model a small error w, so the guided distribution’s W2 distance is not expected to be substantially below w; no numerical results are provided here.Source: §B.1 · p. 32
B.2. Planning Experiment Details
The planning experiments use flow-matching models to generate future state-action sequences, with a critic predicting their discounted return and guidance steering sampling toward higher-return plans. The section describes the offline-RL data, guidance tuning, and how to interpret critic-based returns.
B.2. Planning Experiment Details
- Experiments use D4RL Locomotion datasets containing non-expert behavior, including mixtures of expert and medium-level behavior or replay-buffer data from an RL agent.Source: §B.2 · p. 32
- The planner generates sequences of future state-action pairs, and a critic predicts their discounted return-to-go for guidance.The guided target is proportional to the behavior distribution weighted by the exponential of the critic return.Source: §B.2 · p. 32
- The flow-matching planner uses an 8-layer Transformer, a 20-step planning horizon, and stride 1; evaluation reuses the same base model across guidance methods.The models are trained on offline data, and the reported normalized score assigns 100 to the expert RL agent’s return.Source: §B.2 · p. 33
- Gradient-guided plans can receive inflated critic returns when they fall outside the critic’s training distribution, so higher predicted return does not necessarily mean better performance.The target energy-weighted distribution is intended to keep guided samples near the behavior model’s support, alleviating distribution shift.Source: §B.2 · p. 34
- The section reports full D4RL Locomotion results for the mini-batch optimal-transport CFM base model in Table 4.The caption says entries within 95% of the best score per task are highlighted; baselines are excluded from the ranking.Source: Table 4 · p. 34
B.3. Image Experiment Details
The image experiments evaluate flow-matching guidance on deblurring, box-inpainting, and super-resolution, using CelebA data and several image-quality metrics. The section also notes that Monte Carlo guidance can struggle when limited sampling cannot capture the rare images needed for accurate guidance.
B.3. Image Experiment Details
- The section provides full CFM-base image results in Table 5 and an epsilon ablation for gMC in Table 6.The Table 6 caption identifies the best and second-best results per task, while the text says gMC performance is insensitive to epsilon.Source: Table 5 · p. 35, Table 6 · p. 36
- The evaluation uses CelebA test images for central box-inpainting, 4× super-resolution, and Gaussian deblurring.The test set follows an 8:1:1 train-validation-test split; 3,000 test images are sampled for the three tasks.Source: §B.3 · p. 36
- For all three inverse problems, the degraded images receive Gaussian noise with standard deviation 0.05.The deblurring kernel is 61×61 with standard deviation 1.0, super-resolution downsamples by four, and inpainting uses a centered 40×40 mask.Source: §B.3 · p. 36
- Image quality is assessed with FID, LPIPS, PSNR, and SSIM, covering distribution distance, perceptual similarity, signal preservation, and structural consistency.Source: §B.3 · p. 36
- Limited Monte Carlo samples give gMC high-variance estimates on image inverse problems, where accurate guidance requires sampling images that already resemble the degraded reference.The authors note that obtaining enough such samples may require an infeasibly large sample count; more advanced sampling or combining gMC with lower-variance biased methods may help.Source: §B.3 · p. 36
Related papers
This paper cites
- Score-Based Generative Modeling through Stochastic Differential Equations2020
- Classifier-Free Diffusion Guidance2022
- Diffusion Models Beat GANs on Image Synthesis2021
- Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow2022
- Generative Modeling by Estimating Gradients of the Data Distribution2019
- Diffusion Posterior Sampling for General Noisy Inverse Problems2022
Cited by
- JevVLA: Jev-Inspired Energy-Based Adaptation for Vision-Language-Action Policies2026
- Conditional Flow Models for Offline Maximum Entropy Reinforcement Learning2026
- GAV: A scientific experimentation environment for PDE agents2026
- CLEAR: Cooperative Latent Flow for Visual Counterfactual Explanations with Accurate Region Preservation2026
- A Survey of Flow Matching in Reinforcement Learning2026
- An Efficient Quantum Circuit for Flow Model Execution Using Quantum Neural Networks2026