MIT's HardFlow Puts Hard Limits on Generative AI Output
MIT researchers report a deployment-time method that forces pretrained flow-matching models to satisfy hard safety constraints, with no retraining required.

A team at MIT has published a method for making generative models obey strict rules at the moment they produce an answer, rather than hoping they learned the rules during training. The approach, called HardFlow, treats constrained generation as a control problem and applies it to pretrained flow-matching models without touching their weights. The work appeared in IEEE Transactions on Pattern Analysis and Machine Intelligence in September 2026.
The problem HardFlow is aimed at
Generative models are good at producing plausible variety. That is exactly what makes them awkward in settings where some outputs are not merely worse but unacceptable. A robot arm plotting a route across a factory floor cannot pass through a support column. A planner routing a machine through a workcell cannot exceed a joint limit. A model controlling a physical process cannot propose a state the equipment cannot reach.
The usual fix is to train the model on data that mostly respects the rules and then hope the learned distribution stays inside them. That works statistically and fails individually. A model that satisfies a safety rule in 99.9 percent of samples is still a model that will eventually generate a collision, and in a safety-critical system the tail is the whole story. Filtering or rejection sampling at the output stage helps, but it wastes compute and degrades badly when the feasible region is small relative to what the model likes to produce.
An alternative is to push the constraint into every step of the generation process. Flow-matching models — a close relative of diffusion models — build an output by starting from noise and transforming it through a sequence of small steps. One natural instinct is to project each intermediate step back into the allowed region. The MIT group argues this is too blunt. Intermediate states in a generative trajectory are not partial answers in any meaningful physical sense, so forcing them to be feasible constrains the search prematurely and pushes the model toward conservative, low-quality solutions.
How the method works
HardFlow's central move is to require feasibility only of the final output, and to treat everything before that as a trajectory that can be optimized. The researchers reformulate hard-constrained sampling as a trajectory-optimization problem drawn from optimal control theory — the branch of engineering that asks how to steer a system from a starting state to a target state while respecting limits along the way.
In that framing, the generative process is the system being steered, the noise-to-output path is the trajectory, and the safety rule is a terminal condition the trajectory must land on. That reframing buys freedom: the intermediate states are allowed to wander outside the feasible region as long as the endpoint is inside it. In practice that means the model can explore a wider space of candidate solutions and still be guaranteed to deliver something legal.
The obvious objection is cost. Trajectory optimization over a full generative rollout is expensive, and generative sampling is already the slow part of these systems. The team's answer is to exploit the structure of flow-matching models to decompose the big optimization into a sequence of smaller, single-step subproblems, then apply a set of transformations and approximations to make each subproblem cheap. The reported result is that HardFlow's compute cost is comparable to or lower than the baselines it was measured against, which is the difference between a research curiosity and something a robotics team might actually run.
The work is credited to senior author Navid Azizan, the Alfred H. and Jean M. Hayes Career Development Associate Professor in MIT's Department of Mechanical Engineering, with appointments in the Institute for Data, Systems, and Society and the Laboratory for Information and Decision Systems. Lead author Zeyang Li is a graduate student in mechanical engineering and LIDS, joined by Kaveh Alim of IDSS and LIDS. Azizan has framed the motivation as a mismatch between what generative models are good at — exploring possibilities — and the fact that the physical world draws firm lines around what counts as acceptable.
What the results show, and what they do not
The team reports testing across robotic manipulation, maze navigation, and text-guided image editing, and says the method achieved perfect constraint satisfaction in every experiment while consistently beating baseline methods on measures of solution quality. In the manipulator task, they report that HardFlow avoided collisions while still finding fast paths, where competing methods either collided or produced significantly slower routes.
Two things are worth separating here. The constraint-satisfaction claim is the stronger one, because it follows from the structure of the method rather than from a lucky dataset: if the terminal condition is enforced as part of the optimization, feasibility is not a statistical property being measured but a property being imposed. The quality claim is the more contingent one. "Outperformed the baselines" is a statement about a specific set of tasks, a specific set of comparison methods, and a specific definition of quality, and none of those generalize automatically.
The task list also deserves a caveat. Maze navigation and tabletop manipulation are the standard proving grounds for constrained planning precisely because their constraints are clean — geometry, distance, obstacle boundaries. Real deployment constraints are often messier: they involve uncertainty about where the obstacle actually is, dynamics the model does not observe, and rules that are only approximately expressible in the math. A method that guarantees satisfaction of the constraint as written offers no protection when the constraint as written is an incomplete description of the hazard. That is a limitation of the framing, not of this particular paper, but it is the gap between a clean benchmark and a factory floor.
The image-editing result points somewhere different and arguably more interesting. Constraints there are not physical safety limits but task-specific requirements, which suggests the same machinery could apply to content rules, format requirements, or structural guarantees in domains with no robot in sight.
The researchers note a possible extension in which the method also adaptively updates the underlying model, rather than only steering it at sampling time. That would change the deployment story considerably — the current appeal is precisely that it is a wrapper around a frozen pretrained model.
What to watch
- Whether independent groups reproduce the perfect-constraint-satisfaction result on tasks the MIT team did not choose, especially ones with non-convex or poorly conditioned feasible regions.
- How the per-sample latency behaves as constraint complexity grows — comparable compute on maze navigation is not the same as comparable compute on a high-degree-of-freedom manipulator with dozens of simultaneous limits.
- Whether the approach transfers to diffusion models and other samplers, or remains specific to the structure of flow matching that makes the single-step decomposition work.
- Uptake in non-robotics domains, where the constraint is a task requirement rather than a physical boundary, since that is where the method could reach the largest number of users.
- Any follow-up on the adaptive-model extension, which would trade the current retraining-free simplicity for potentially better solution quality.
Keep reading
More in Machine Learning →
MIT's Case Against Building More Data Centers: Use the Ones We Have
MIT associate professor Christina Delimitrou argues that cloud infrastructure wastes enormous capacity, and that machine learning can reclaim it. The profile is light on hard numbers.
5 min read

MIT's Cathy Wu on Why Reinforcement Learning Keeps Breaking — and the Workaround That Cut Training Costs 30x
An MIT profile of associate professor Cathy Wu traces years of failed RL experiments to a 2023 result: train on the 10% of problems that generalize, and skip the rest. Up to 30x more efficient.
5 min read

Anthropic Says Robots Can Already Do a Third of US Work Hours — at 300x the Wrong Price
Anthropic's new robot exposure index finds today's machines can perform 74% of physical US job tasks, but are cost-competitive on just 0.3% of work. Economics beats capability.
5 min read