MIT’s HardFlow algorithm enhances pretrained generative AI models, enabling them to meet strict safety requirements without retraining. Unlike traditional approaches that constrain every step, HardFlow reformulates the task as a trajectory-optimization problem, allowing models to produce high-quality outputs while satisfying hard constraints effectively across various applications.