ConicFlow: constrained Inference-time optimal control for flow matching models

Shervin Khalafi, Kasra Fallah, Sung Cho, Dongsheng Ding, James Anderson, Alejandro RibeiroarXiv 2026

TL;DR

ConicFlow is a new framework that treats constrained sampling from flow matching models as an optimal control problem. By combining receding-horizon control with a primal-dual algorithm and "flow map" terminal predictions, it generates samples that satisfy hard constraints and achieve high rewards with significantly less path deviation and computational effort than existing baselines.

What Problem Does This Paper Address?

Generative models like diffusion and flow matching produce stunningly realistic samples, but they are notoriously difficult to "steer." In many real-world applications—like safety-critical robotics or precise image editing—we don't just want a good sample; we need a sample that satisfies specific hard constraints (e.g., "the image must contain a person with red hair" or "the robot trajectory must avoid this obstacle").

Existing methods typically fall into two camps:

  1. Fine-tuning: Retraining the model for every new constraint, which is prohibitively expensive.
  2. Inference-time guidance: Using "soft" rewards to nudge the model. While flexible, these often fail to guarantee that hard constraints are actually met and can lead to samples that look "unnatural" because they deviate too far from the model's learned data manifold.

ConicFlow aims to bridge this gap by providing a mathematically rigorous way to enforce hard constraints at inference time while staying as close as possible to the original model's behavior.

Methods

The authors frame the generation process as a continuous-time optimal control problem. The goal is to find a "control input" (a perturbation to the model's velocity field) that minimizes the deviation from the original path while maximizing a terminal reward and satisfying terminal constraints.

To make this practical, they introduce three key innovations:

  • Receding-Horizon Control (RHC): Instead of trying to optimize the entire generation path at once—which is computationally heavy—they optimize only a short "window" of the future. They take one step, shift the window, and repeat.
  • Terminal Prediction via Flow Maps (RH-T): Standard RHC often fails because it only looks at the end of the short window. ConicFlow uses the model's own "flow map" (a learned operator that predicts future states) to jump ahead and estimate where the sample will land at the very end of the generation process. This allows the short-term optimizer to account for long-term goals.
  • Receding-Horizon Primal-Dual Algorithm: They use dual multipliers to represent the "difficulty" of satisfying each constraint. These multipliers are updated throughout the sampling process, effectively "learning" how much to steer the model to ensure the final result is feasible.

Datasets

The authors evaluated ConicFlow across two distinct regimes:

  • Synthetic 2D Data: Using the "two moons" dataset to visualize how the model steers trajectories toward specific regions or off-manifold targets.
  • High-Dimensional Image Editing: Using the FLUX.1-dev model. They tested the framework on tasks like changing attributes (e.g., "portrait of a man" $\rightarrow$ "smiling face") using rewards and constraints derived from CLIP, ImageReward, and PickScore.

Key Insights and Ideas

  • Flow Maps as "Time Machines": The most clever insight is using flow maps within the control loop. By predicting the terminal state from an intermediate point, the algorithm can enforce constraints on the final image without needing to simulate every single step during the optimization phase.
  • Path Fidelity Matters: By explicitly penalizing the "control energy" (the squared norm of the perturbation), ConicFlow ensures that the generated samples stay close to the data manifold. This results in fewer artifacts compared to methods that simply project samples onto a feasible set.
  • Theoretical Guarantees: Unlike many empirical "guidance" papers, this work provides formal bounds on suboptimality and proves that the terminal-estimate variant (RH-T) is tighter when flow dynamics change slowly.

Key Results

ConicFlow demonstrates a superior trade-off between reward, constraint satisfaction, and sample quality:

  • Efficiency: In image editing tasks, ConicFlow achieved the same reward levels as the state-of-the-art HardFlow baseline but with up to 20x less control energy.
  • Feasibility: It maintained a near-100% success rate in satisfying hard constraints, even as the constraints became more difficult (higher threshold multipliers $m$). In contrast, HardFlow's success rate dropped significantly under tough constraints.
Figure 2: Trade-off between terminal reward and total control cost. Left: Reward vs. control energy on the editing task, traced by sweeping λ (upper left is better). Right: Edits from each method at approximately matched reward; ConicFlow reaches the same reward with much lower control energy.
  • Visual Quality: Qualitatively, ConicFlow produces edits that look more like the original image while successfully incorporating the requested changes, whereas baselines often introduce visible noise or artifacts when forced to meet strict constraints.
Figure 2: Trade-off between terminal reward and total control cost. Left: Reward vs. control energy on the editing task, traced by sweeping λ (upper left is better). Right: Edits from each method at approximately matched reward; ConicFlow reaches the same reward with much lower control energy.

Limitations and Future Work

  • Computational Cost: While more efficient than full-trajectory optimization, ConicFlow is still significantly slower than uncontrolled sampling. For FLUX, it takes roughly 300-600 seconds per image compared to just a few seconds for a standard run.
  • Convexity Assumptions: The theoretical convergence guarantees rely on convex-affine assumptions. While the method works well on non-convex neural networks in practice, the theory doesn't fully cover these cases yet.
  • Future Directions: The authors suggest exploring more efficient ways to approximate the gradients of the flow map and extending the framework to handle constraints that must be satisfied throughout the trajectory (path constraints) rather than just at the end.

Summary updated

BibTeX
@misc{khalafi2026conicflow,
  author = {Shervin Khalafi and Kasra Fallah and Sung Cho and Dongsheng Ding and James Anderson and Alejandro Ribeiro},
  title = {{ConicFlow: constrained Inference-time optimal control for flow matching models}},
  year = {2026},
  eprint = {2610.14307},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.14307},
}
Figure