
MIT researchers have developed HardFlow, a method designed to make generative AI more useful in safety-critical applications where an almost correct answer is unacceptable. Such applications include robotics, physical system control, and computer vision, where outputs must obey strict safety, physical, or task-specific requirements.
Generative models are good at exploring many possible solutions, but existing approaches can struggle when hard constraints must always be satisfied. Consider a robot navigating a crowded factory. A path that nearly avoids an obstacle could still cause a collision. Conventional projection-based sampling addresses this problem by forcing intermediate outputs to satisfy constraints throughout generation. However, repeatedly imposing restrictions can prevent the model from discovering better final solutions.
HardFlow takes a different approach. Instead of requiring every intermediate step to meet the constraints, it gives the model greater freedom while generating possibilities and strictly enforces requirements on the final result. The researchers formulate this process as a trajectory-optimization problem using techniques from optimal control.
To make this optimization practical for large neural networks, the team uses the structure of flow-matching models to break the problem into smaller, single-step subproblems. This produces an efficient algorithm that can be applied at deployment without retraining an existing generative model.
HardFlow can also optimize desirable qualities beyond basic constraint satisfaction. For example, a robot could be instructed not only to avoid obstacles but also to find the shortest path to its destination.
Tests involving robotic manipulation, maze navigation, and text-guided image editing showed that HardFlow achieved perfect constraint satisfaction while producing higher-quality solutions than baseline techniques. In robot experiments, it found collision-free routes that were also faster than those generated by competing approaches. Its computation time was comparable to or lower than most alternatives.
The research suggests a practical route toward deploying generative AI in engineering systems where creativity and exploration are useful, but safety rules and physical constraints cannot be compromised.
