HardFlow: Hard-Constrained Sampling for Flow-Matching Models via Trajectory Optimization
On the map: Diffusion models → Diffusion and flow policies for robotics
Abstract (arXiv)
Diffusion and flow-matching have emerged as powerful methodologies for generative modeling, with remarkable success in capturing complex data distributions and enabling flexible guidance at inference time. Many downstream applications, however, demand enforcing hard constraints on generated samples (for example, robot trajectories must avoid obstacles), a requirement that goes beyond simple guidance. Prevailing projection-based approaches constrain the entire sampling path to the constraint manifold, which is overly restrictive and degrades sample quality. In this paper, we introduce a novel framework that reformulates hard-constrained sampling as a trajectory optimization problem. Our key insight is to leverage numerical optimal control to steer the sampling trajectory so that constraints are satisfied precisely at the terminal time. By exploiting the underlying structure of flow-matching models and adopting techniques from model predictive control, we transform this otherwise complex constrained optimization problem into a tractable surrogate that can be solved efficiently and effectively. Furthermore, this trajectory optimization perspective offers significant flexibility beyond mere constraint satisfaction, allowing for the inclusion of integral costs to minimize distribution shift and terminal objectives to further enhance sample quality, all within a unified framework. We provide a control-theoretic analysis of our method, establishing bounds on the approximation error between our tractable surrogate and the ideal formulation. Extensive experiments across diverse domains, including robotics (planning), partial differential equations (boundary control), and vision (text-guided image editing), demonstrate that our algorithm, which we name textitHardFlow, substantially outperforms existing methods in both constraint satisfaction and sample quality.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Placed in Diffusion and flow policies for robotics, one of 14 directions in Diffusion models. Builds on 49 of its 66 references that are in the map. First posted on arXiv 11 Nov 2025.
Builds on
49 of 66 references.
Closest ancestors · 10
Same direction, newest first
- 2025SafeFlowMatcher: Safe and Fast Planning using Flow Matching with Control Barrier Functions29 Sep
- 2025DDAT: Diffusion Policies Enforcing Dynamically Admissible Robot Trajectories20 Feb
- 2025From Uncertain to Safe: Conformal Adaptation of Diffusion Models for Safe PDE Control4 Feb
- 2025Score as Action: Fine-Tuning Diffusion Generative Models by Continuous-time Reinforcement Learning3 Feb
- 2024Motion Planning Diffusion: Learning and Adapting Robot Motion Planning with Diffusion Models27 Dec
- 2024Fast and Robust Visuomotor Riemannian Flow Matching Policy14 Dec
- 2024Diffusion Predictive Control with Constraints12 Dec
- 2024Adjoint Matching: Fine-tuning Flow and Diffusion Generative Models with Memoryless Stochastic Optimal Control13 Sep
- 2023SafeDiffuser: Safe Planning with Diffusion Probabilistic Models31 May
- 2023Diffusion Policy: Visuomotor Policy Learning via Action Diffusion7 Mar
Other references · 39
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Denoising Diffusion Probabilistic Modelscited by 20,851
- 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,694
- 2018The Unreasonable Effectiveness of Deep Features as a Perceptual Metriccited by 11,029
- 2020Denoising Diffusion Implicit Modelscited by 9,655
- 2021Diffusion Models Beat GANs on Image Synthesiscited by 8,185
- 2015Deep Unsupervised Learning using Nonequilibrium Thermodynamicscited by 7,005
- 2022Classifier-Free Diffusion Guidancecited by 5,717
- 2022Flow Matching for Generative Modelingcited by 5,426
- 2024Scaling Rectified Flow Transformers for High-Resolution Image Synthesiscited by 4,094
- 2022Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flowcited by 3,550
- 2022Elucidating the Design Space of Diffusion-Based Generative Modelscited by 2,994
27 more
- 2017Progressive Growing of GANs for Improved Quality, Stability, and Variationcited by 2,967
- 2022Video Diffusion Modelscited by 2,280
- 2020D4RL: Datasets for Deep Data-Driven Reinforcement Learningcited by 1,406
- 2022Diffusion Posterior Sampling for General Noisy Inverse Problemscited by 1,375
- 2022Planning with Diffusion for Flexible Behavior Synthesiscited by 1,023
- 2024Movie Gen: A Cast of Media Foundation Modelscited by 614
- 2022Zero-Shot Image Restoration Using Denoising Diffusion Null-Space Modelcited by 574
- 2023Universal Guidance for Diffusion Modelscited by 426
- 2022PhysDiff: Physics-Guided Human Motion Diffusion Modelcited by 365
- 2024Pyramidal Flow Matching for Efficient Video Generative Modelingcited by 354
- 2021Path Integral Sampler: a stochastic control approach for samplingcited by 175
- 2022An optimal control perspective on diffusion-based generative modelingcited by 145
- 2023Denoising Diffusion Samplerscited by 144
- 2019Theoretical guarantees for sampling and inference in generative models with latent diffusionscited by 97
- 2024Constrained Synthesis with Projected Diffusion Modelscited by 83
- 2025Adjoint Sampling: Highly Scalable Diffusion Samplers via Adjoint Matchingcited by 78
- 2024Gradient Guidance for Diffusion Models: An Optimization Perspectivecited by 59
- 2024Symbolic Music Generation with Non-Differentiable Rule Guided Diffusioncited by 52
- 2024Towards Diverse Behaviors: A Benchmark for Imitation Learning with Human Demonstrationscited by 51
- 2025On the Guidance of Flow Matchingcited by 44
- 2025Diffusion Tree Sampling: Scalable inference-time alignment of diffusion modelscited by 31
- 2024CoBL-Diffusion: Diffusion-Based Conditional Robot Planning in Dynamic Environments Using Control Barrier and Lyapunov Functionscited by 30
- 2024Training Free Guided Flow Matching with Optimal Controlcited by 23
- 2025Training-Free Guidance Beyond Differentiability: Scalable Path Steering with Tree Search in Diffusion and Flow Modelscited by 23
- 2025Variational Control for Guidance in Diffusion Modelscited by 22
- 2025Training-Free Constrained Generation With Stable Diffusion Modelscited by 20
- 2025Projected Coupled Diffusion for Test-Time Constrained Joint Generationcited by 6
Built on by
Citing papers per year: 2026: 10.
10 papers.
- 2026Provably Safe Generative Sampling with Constricting Barrier Functionscited by 2
- 2026Solving Inverse Problems with Flow-based Models via Model Predictive Controlcited by 1
- 2026DiRecT: Safe Diffusion-Based Planning via Receding-Horizon Denoisingcited by 1
- 2026Steering Generative Robot Policies with Lexicographic Preferencescited by 1
- 2026CCFM: Collision-Constrained Flow Matching for Safety-Critical Scenario Generationcited by 0
- 2026Constrained Flow Matching via Lagrangian Dual Flowscited by 0
- 2026Self-Augmented Diffusion Guidance for Physics-Informed Generationcited by 0
- 2026Denoising as Projection: Constrained Optimization with Gradient-Guided Diffusioncited by 0
- 2026ParetoTransport: Generative Optimization by Mass Transport Toward The Pareto Frontcited by 0
- 2026Let It Go or Learn to Self-Correct: Continuous Diffusion for Constrained Discrete Taskscited by 0
- 2026Steering Generative Robot Policies with Lexicographic Preferences14 Sep 2026
- 2026Let It Go or Learn to Self-Correct: Continuous Diffusion for Constrained Discrete Tasks8 Sep 2026
- 2026ParetoTransport: Generative Optimization by Mass Transport Toward The Pareto Front7 Sep 2026
- 2026Denoising as Projection: Constrained Optimization with Gradient-Guided Diffusion30 Aug 2026
- 2026Self-Augmented Diffusion Guidance for Physics-Informed Generation27 Aug 2026
- 2026Constrained Flow Matching via Lagrangian Dual Flows5 Jul 2026
- 2026CCFM: Collision-Constrained Flow Matching for Safety-Critical Scenario Generation5 Jul 2026
- 2026DiRecT: Safe Diffusion-Based Planning via Receding-Horizon Denoising13 Jun 2026
- 2026Provably Safe Generative Sampling with Constricting Barrier Functions24 Feb 2026
- 2026Solving Inverse Problems with Flow-based Models via Model Predictive Control30 Jan 2026
Similar, not cited
Close in wording, no citation either way
- 2026MintFlow: Minimal Trajectory Intervention for Constrained Flow Matching
- 2026Constraint-Aware Flow Matching: Decision Aligned End-to-End Training for Constrained Sampling
- 2026ConFlow: Constraints-Guided Learning with Flow Matching for Motion Generation
- 2025Theoretical Guarantees for High Order Trajectory Refinement in Generative Flows
- 2025Chance-constrained Flow Matching for High-Fidelity Constraint-aware Generation
- 2025PegasusFlow: Parallel Rolling-Denoising Score Sampling for Robot Diffusion Planner Flow Matching
- 2024Gradient-Free Generation for Hard-Constrained Systems
- 2026Enforcing Constraints in Generative Sampling via Adaptive Correction Scheduling