Source-linked AI summary
PathGuide: Dynamic Classifier-Free Guidance via On-Policy Transport Alignment
Avishag Nevo, Tamir Hazan
TL;DR
Fixed CFG scales do not account for trajectory-dependent path errors in conditional flow generation. PathGuide selects scalar guidance through an on-policy weak-continuity transport criterion, yielding a closed-form local optimizer and online or offline schedules. Experiments report improved path alignment and endpoint fidelity over fixed and adaptive training-free baselines.
Problem
Fixed or hand-crafted CFG schedules can be path-inconsistent because different trajectory segments require different guidance strengths, while learned-field errors can drive rollout drift.
Method
PathGuide evaluates a weak-form mismatch between the guided and exact conditional fields on the realized rollout, producing a strictly quadratic local objective with a closed-form scalar selector.
Results
PathGuide consistently improves path alignment and endpoint fidelity over existing training-free baselines across controlled Gaussian-mixture flow-matching experiments and multiple flow families.
Takeaways & Limitations
Guidance can be selected online during sampling or fitted offline as a reusable piecewise-constant schedule based on on-policy transport alignment.
Takeaways & Limitations
Online selection adds estimator overhead, the selector is local in time, and performance depends on the chosen test-function family H.
Abstract
from arXiv · showhide
While modern generative models excel at modeling complex data, precise inference-time control in conditional generation remains a critical challenge. Classifier-free guidance (CFG) is a primary mechanism for such control, yet it is typically treated as a static tuning parameter. In flow-based models, however, the guidance scale fundamentally dictates the velocity field and the resulting probability path, making guidance selection a dynamic path-optimization problem. We introduce PathGuide, a framework that reformulates scalar CFG selection as an on-policy transport problem. Leveraging the weak form of the continuity equation, we derive a selection criterion with a direct path-correctness interpretation: we prove that if the guided field is weakly equivalent to the exact conditional field along the generated rollout, the sampler's path coincides with the target conditional law. For scalar CFG, this criterion yields a strictly quadratic local objective with an efficient, closed-form selector for each solver interval. PathGuide enables optimal guidance scales to be computed and used online during generation or fitted offline as a reusable piecewise-constant schedule. We validate our method on low-resolution image manifolds and controlled settings across various continuous-time flow constructions, demonstrating that this transport-based selector improves path alignment and sample fidelity over both fixed and state-of-the-art adaptive guidance baselines.
1 Introduction
Conditional generation relies on inference-time guidance, but fixed or hand-crafted CFG schedules can be path-inconsistent. PathGuide formulates scalar guidance selection as an on-policy transport problem with a principled local objective and closed-form optimization.
- Motivation: Inference-time CFG is widely used to steer trained generators toward desired conditions, but constant or hand-crafted schedules can require different strengths across trajectory segments.Excessive guidance can reduce diversity and trigger mode collapse.
- Prior limitations: Existing approaches adapt guidance heuristically, train auxiliary correction networks, or impose geometric constraints to mitigate guidance failures.These methods address issues such as faulty guidance interactions and mode collapse.
- PathGuide: PathGuide reformulates scalar CFG selection as an on-policy transport problem grounded in the weak continuity equation.Its criterion links weak equivalence between guided and exact conditional fields to path correctness under uniqueness conditions.
- PathGuide: The resulting local objective is strictly quadratic for scalar CFG and provides an efficient closed-form optimal guidance scale.The selector is derived from the sampler’s empirical rollout and the endpoint-conditioned structure of flow matching.
- Practical framework: PathGuide supports online adaptation during sampling and offline fitting of reusable piecewise-constant schedules.Controlled Gaussian-mixture flow-matching experiments report consistent improvements in path alignment and endpoint fidelity over training-free baselines.
2 Related Work
Prior work increasingly recognizes that guidance should adapt to trajectory-dependent conditioning sensitivity and that terminal samples alone do not capture path quality. PathGuide differs by optimizing guidance directly on the sampler’s realized rollout with a variational transport criterion.
- Continuous-time transport: Flow Matching and Rectified Flow expose endpoint-conditioned paths that can be repurposed to diagnose local consistency between guided velocities and the ground-truth transport law.The paper uses this decomposition as an inference-time diagnostic rather than only as a training objective.
- Adaptive guidance: Different intervals of generative trajectories exhibit varying conditioning sensitivities, motivating adaptive, annealed, and feedback-based guidance schedules.The cited methods modulate guidance through heuristic triggers or learned policies.
- Adaptive guidance: Existing adaptive schedulers often lack a formal distributional guarantee, whereas PathGuide derives a variational criterion from the weak continuity equation.The stated goal is to preserve probability-path integrity without manual tuning or auxiliary training.
- CFG corrections: Other methods repair CFG updates through manifold-aware corrections or solver-level refinements, while PathGuide optimizes the scalar input to the update.This distinguishes schedule selection from modifying the guidance update itself.
- On-policy selection: PathGuide optimizes guidance on the sampler’s realized rollout rather than on schedules defined beforehand over idealized paths.The framework targets trajectory faithfulness to the target conditional distribution.
3 Continuous-Time Flows and Guidance
Continuous-time flow models transport a reference distribution along velocity fields, with densities governed by the continuity equation. In conditional generation, CFG extrapolates learned conditional and unconditional velocity fields, while learned-field errors can make the guidance scale a corrective parameter.
- Flow foundations: A continuous-time flow evolves a probability path from a tractable reference distribution p_0 to a target data distribution approximation p_1 over t ∈ [0, 1].The flow is generated by a time-dependent velocity field and its associated dynamics.
- Flow foundations: The velocity field induces a flow map through an ODE, and the time-t density is the pushforward p_t = (ϕ_t)#p_0.The density-field pair satisfies the continuity equation expressing local conservation of probability mass.
- Flow foundations: The continuity equation also admits a weak form using smooth compactly supported test functions.PathGuide later uses this weak formulation to construct its transport-consistency criterion.
- Classifier-free guidance: CFG forms a guided velocity field using a scalar scale ω_t, with ω_t = 1 recovering the nominal conditional field and ω_t > 1 amplifying conditional–unconditional differences.In flow models, guidance is applied directly to learned velocity fields.
- Flow Matching: Flow Matching learns conditional velocity fields by marginalizing endpoint-conditioned paths, then uses the learned field to integrate samples from the reference distribution.The exact marginal conditional field is defined from the endpoint-conditioned construction and approximated by a neural network.
- Classifier-free guidance: Because learned conditional fields are imperfect, guidance scales can calibrate the guided flow to compensate for approximation errors relative to the true transport law.This motivates selecting a time-dependent guidance schedule rather than assuming a universally sufficient constant.
4 Dynamic Classifier-Free Guidance via On-Policy Transport Alignment
PathGuide selects classifier-free guidance scales as an on-policy transport control, matching the guided field to the exact conditional field along the sampler’s realized rollout. Its local objective supports closed-form scalar selection and both online adaptation and reusable offline schedules.
- Earlier velocity-field errors propagate through the ODE solver, causing the realized probability path to drift from the target conditional distribution.
- PathGuide chooses each guidance scale to minimize weak-form mismatch between the guided and exact conditional fields under the rollout law realized so far.The criterion targets accumulated learning errors and recalibrates the realized probability path toward the target conditional distribution.
- Under weak equivalence and the stated uniqueness assumptions, the generated rollout path coincides with the exact conditional path.
- The selector operates recursively on solver intervals, committing each scale before advancing the ODE solver using the rollout produced by the committed schedule.The practical procedure estimates local quadratic coefficients from rollout particles at each interval.
- For scalar CFG, the local objective is one-dimensional quadratic, yielding an efficient closed-form guidance selector when its denominator is nonzero.If the denominator vanishes, the objective is constant and every admissible guidance value is optimal.
- PathGuide supports online recalibration during sampling and offline fitting of reusable piecewise-constant schedules for a fixed backbone, solver, and grid.Offline schedules avoid computing the selector at every inference step, while the backbone remains unmodified.
- By decoupling drift estimation from generative inference, the framework targets probability-path stabilization in both compute-constrained and quality-critical settings.
5 Experimental Validation
Experiments evaluate whether PathGuide improves rollout alignment, terminal quality, schedule reuse, and estimator efficiency across controlled flow settings and MNIST.
- Experimental Setup: The Gaussian-mixture testbed evaluates rollout distributions throughout the trajectory because intermediate conditional marginals and posterior weights are available in closed form.This tests path alignment rather than only terminal samples.
- Online path alignment: Figure 1 compares true-velocity, plain conditional, and practically selected rollouts using MMD, KL, and W2 discrepancies.The true-velocity rollout provides a discretization reference, while the plain learned conditional field accumulates drift.
- Endpoint quality: The evaluation compares terminal generation quality against plain CFG, CFG-Zero∗, CFG-MP, and Rectified-CFG++ under matched experimental conditions.Table 1 reports metrics at T = 200 and T = 500 using 214 generated samples per seed.
- Endpoint quality: PathGuide schedules remain effective on MNIST for both Optimal Transport and Rectified Flow variants.Table 2 reports paired PathGuide-minus-tuned-CFG FID differences of −0.103 for RF and −0.175 for OT.
- Reuse under coarser inference: Coarsening the inference grid produces degradation of ≤4%, supporting reuse of schedules fitted on a finer grid.The schedules are compressed by averaging guidance values within corresponding coarse intervals.
- Schedule diagnostics: Fitted schedules follow low-objective regions, preserve their global shape across resolutions, and better track the oracle as grids are refined.Monte Carlo metrics and schedule distance stabilize at moderate budgets, while runtime continues to increase.
6 Conclusion and Future Work
PathGuide’s theoretical development establishes identities and assumptions supporting its on-policy quadratic selector, while the conclusion notes computational, modeling, and empirical-scope boundaries.
- Limitations and future work: The method’s stated boundaries include online estimator overhead, local-in-time selection, test-function tradeoffs, scalar-control focus, and evaluation limited to a two-class Gaussian mixture and MNIST.The paper makes no claim of generalization to large backbones, higher dimensions, or open-ended conditional generation.
- Foundations: The framework assumes regular conditional paths, valid endpoint posterior weights, weakly continuous generated rollouts, and uniqueness of the exact conditional continuity-equation solution.These assumptions support the subsequent transport identities and path-correctness result.
- Foundations: The marginal conditional field is obtained by averaging endpoint-conditioned velocity fields using posterior endpoint weights.The appendix proves this through differentiation, regularity, and integration over endpoints.
- Path correctness: If the generated rollout is a weak solution driven by the exact conditional field and starts from the same initial law, uniqueness implies coincidence with the target conditional path.The appendix states this equality for the generated law over the relevant time interval.
- On-policy objective: The local objective is on-policy because it is weighted by the rollout generated by previously committed guidance values rather than the ideal path.This makes the criterion depend on the sampler’s realized history.
- Scalar CFG selector: Under scalar CFG, the local objective is strictly quadratic in the current guidance value, enabling an efficient closed-form selector.The quadratic form follows because the guided field is affine in the scalar guidance value.
B.9 From the local objective to the interval-wise implementation
PathGuide implements interval-wise guidance selection by estimating a local weak-form objective from rollout particles and endpoint samples. It supports online selection during sampling and offline fitting of reusable piecewise-constant schedules.
- Interval-wise discretization: Guidance is held fixed on each solver interval and selected using a left-endpoint discretization of the local weak-form objective.The interval is [t_i, t_i+1).
- Offline reuse: Offline mode stores the fitted piecewise-constant schedule and later reuses it without endpoint sampling or posterior-weight computation.Reuse assumes the same backbone, solver, grid, and condition.
- Online estimation: At each interval, the procedure uses current rollout particles, draws endpoint samples, computes posterior weights, and estimates multi-test coefficients.The rollout follows the already committed guidance history, while endpoint samples come from q(· | y).
- Algorithm outputs: Algorithm 1 appends the selected value, advances rollout particles by one solver step, and returns either particles with the schedule or only the fitted schedule.The returned schedule contains one selected value per solver interval.
- Budgets: The implementation tracks T solver intervals, M endpoint samples, N rollout particles, and L weak test functions.These quantities determine the principal sampling and estimation budgets.
- Closed-form selection: The empirical interval objective yields a closed-form multi-test selector after coefficient estimation.The factor 1/L does not affect the minimizer.
D Conditional paths used for experimental validation
The validation covers several conditional continuous-time paths, all parameterized by generation time from a Gaussian source to a conditional endpoint law. It specifies shared solver, sampling, testing, and reproducibility conventions for comparing these paths.
- Time convention: Generation time runs from t = 0 at the Gaussian source to t = 1 at the conditional endpoint law.For class label y, endpoint samples are drawn from x_1 ∼ q(· | y) and source samples from x_0 ∼ N(0, I).
- Gaussian path variants: The affine Gaussian template defines endpoint-conditioned laws and velocity fields, while the along-sample label is used when paired source samples are available.Optimal-transport Gaussian paths are included among the path variants.
- Rectified flow: Rectified flow uses deterministic straight-line interpolation, with a_t = 1 − t and b_t = t.Its along-sample velocity label is defined from this interpolation.
- I-CFM: I-CFM independently samples z = (x_0, x_1) and adds constant-in-time Gaussian noise to the linear interpolation.The path is x_t = (1 − t)x_0 + tx_1 + σ_icfm ε.
- Variance-preserving path: The VP path uses signal coefficient ᾱ_t and evaluates its field only at solver times below t = 1.Endpoint quantities at t = 1 are obtained from the target law rather than the VP field equation.
- Validation protocol: The experiments use shared grids, matched initial latents, and inference seeds, with reported results given as mean ± sample standard deviation.The default setup uses T = 200, M = 214, N = 214, and L = 212.
E.2 Metric definitions
The evaluation defines distributional and kernel-based metrics by comparing generated endpoint samples with reference samples. Metrics are computed per class, averaged using class priors, and reported with sample-standard-deviation error bars.
- Gaussian metrics: Gaussian-fit KL compares the empirical Gaussian fit of generated samples with the reference Gaussian fit.The fits use empirical means and covariances for the generated and reference sets.
- Gaussian metrics: Gaussian W2 reports the Gaussian Wasserstein distance between generated and reference fitted distributions.It is one of the distributional metrics used in evaluation.
- Reporting convention: Metrics are computed per class, averaged with class prior ρ_y, and accompanied by sample-standard-deviation error bars over inference seeds.This aggregation applies to every reported table or curve.
- Kernel metric: Kernel evaluation compares generated and reference endpoint samples using an RBF-kernel metric.The default kernel is multi-bandwidth RBF, with one class-specific bandwidth shared across methods and seeds.
E.3 Data-generating law
The controlled data-generating study uses an analytic two-class Gaussian mixture with a standard Gaussian source and no saved dataset splits. Models and baselines share matched evaluation conditions, while proposed schedules are selected using the stated fitting-seed rule.
- Data-generating law: The endpoint law is an analytic two-class Gaussian mixture with means (−2, 0) and (2, 0), identity covariances, and samples generated directly from the law.The source law is p_0 = N(0, I_2), independent of y.
- Model settings: The flow variants use fixed validation settings including I-CFM noise σ_icfm = 10−3, VP β_min = 0.1, β_max = 20.0, and t_max = 1 − 10−5.All reported methods use frozen trained velocity fields.
- Model settings: The Gaussian-mixture experiments use a conditional MLP in d = 2 with hidden width 64 and three layers, trained for 20,000 iterations.Training uses Adam with learning rate 10−3, batch size 256, gradient clipping at norm 1.0, and no EMA.
- Baseline comparison: Baseline comparisons use the same reference grid, matched latents, and inference seeds, with each baseline represented by its best configuration under average-rank selection.The selection is taken over the evaluated Cartesian-product sweep.
- Schedule selection: For the proposed method, Gaussian-mixture tables use the schedule from the first fitting seed, whereas MNIST selects the fitting seed with the lowest mean FID.All three MNIST fitting seeds are reported below the best baseline.
E.6 Test functions
PathGuide uses low-degree polynomial test functions to estimate local transport mismatch, with a mixed linear-quadratic family as the practical default. Probe sensitivity is generally manageable, but the family’s detectability is limited to the moments it captures.
- Test-function construction: The default weak-form objective uses polynomial test functions up to degree two, sampled from Gaussian ensembles and multiplied by a compact-support bump.The bump is set so truncation is mathematically formal and does not affect numerical results.
- Detectability: Linear tests detect mean-velocity mismatch, while quadratic tests additionally target the symmetric first spatial moment governing second-moment evolution.An orthogonal third-Hermite mismatch is nearly invisible, motivating richer families for higher-order discrepancies.
- Sensitivity and reproducibility: At L = 212, independent probe draws produce mean schedule standard deviations of 0.00033 for linear, 0.00207 for mixed, and 0.00660 for quadratic-only families.The result supports high reproducibility for the default mixed family.
- Probe allocation: At equal budget on MNIST, adding cubic probes yields at most modest gains, whereas an all-cubic family fails outright.The comparison supports the default (2048, 2048, 0) mixed allocation.
- Numerical stabilization: The selector’s least-squares quotient becomes unstable when the empirical CFG direction is nearly zero, so a running-max denominator floor stabilizes the update.With η = 10^-2, the floor is active in 24.10% of updates and the lower-bound projection occurs in 53.34%.
F Ablation Study
The ablations examine schedule reuse, estimator design, probe families, sampling budgets, path-discrepancy correlation, lower-bound constraints, and computational cost. Across these tests, the weak-form selector improves path or endpoint alignment while fitted schedules preserve standard CFG deployment cost.
- Schedule reusability: Offline schedules can be fitted once for a fixed backbone, solver, grid, class, and test-function family, then reused across later deployments.This provides a pay-once, use-many-times alternative to online selection.
- Estimator design: Posterior endpoint weighting and denominator stabilization are evaluated as core design choices, with stabilization essential for preventing guidance spikes when the denominator vanishes.The stability floor has minimal effect in well-conditioned regimes.
- Test functions and budgets: The mixed linear-quadratic family provides the best balance under fixed computational budget, capturing both first- and second-moment mismatches.The sensitivity analysis varies L, M, and N to assess estimator-resource trade-offs.
- Path-discrepancy validation: The held-out finite residual is evaluated against next-step path discrepancy across fixed rollout states and guidance candidates using Spearman correlation with bootstrap confidence intervals.Table 8 summarizes the correlation over 360 cells per flow.
- Criterion comparison: With identical endpoint-conditioned information, the on-policy weak-form selector outperforms direct pointwise projection on RF, I-CFM, and OT across all three metrics, and ties on VP.This comparison attributes the gain to the selection criterion rather than the endpoint-conditioned estimate.
- Computational cost: The estimator reuses backbone evaluations required by the ODE step, adds no NFE, and costs approximately 7 GMM or 4 MNIST CFG generations per fit.Stored-schedule deployment has the same backbone-evaluation cost as standard CFG and amortizes after two deployments.
NeurIPS Paper Checklist
The checklist records that the paper’s claims and contributions accurately reflect its scope, while experimental, theoretical, reproducibility, and limitation disclosures are documented in the appendices and relevant sections.
- Claims and scope: The abstract and introduction accurately state the paper’s scope and contributions.The checklist explicitly records this assessment.
- Limitations: Section 6 discusses the main limitations of the method and experiments, including assumptions and scope boundaries.The checklist marks limitation discussion as present.
- Theory assumptions and proofs: The paper provides a proof sketch in the main text, complete proofs in Appendix B, and assumptions in the relevant statements and Appendix B.1.This addresses the checklist’s theory-assumption and proof requirement.
- Reproducibility: Appendix E provides the experimental protocol and details needed to reproduce the main experimental results.The supplementary material includes code, configurations, checkpoints, and reproduction commands.
- Statistical reporting: Reported tables and curves include means and sample-standard-deviation results over matched inference seeds.The checklist identifies the full statistical details as available in Appendix E.
- Compute disclosure: Appendix F.4 reports the hardware, software environment, wall-clock times, and total compute for the experiments.The experiments used a single workstation with six NVIDIA RTX 2080 Ti GPUs.
- Societal impact: The work is characterized as a methodological study of guidance selection without introducing generative capabilities beyond the underlying models.This frames the checklist’s societal-impact assessment.