Trajectory Stitching for Solving Inverse Problems with Flow-Based Models

Alexander Denker, Zeljko Kereta, Carola-Bibiane Schönlieb, Moshe Eliasof

Introduction

Inverse problems—such as recovering a clean image from a blurry, noisy, or partially observed input—are fundamental to computer vision and medical imaging. Modern generative models, particularly diffusion and flow-matching models, serve as excellent priors for these tasks because they inherently "know" the manifold of natural images.

However, leveraging these models typically involves Latent Space Optimization (LSO), where one searches for an initial noise vector that, when passed through the generative model, yields an image matching the observed data. While conceptually simple, this "single-shooting" approach suffers from severe computational and numerical bottlenecks. MS-Flow introduces a "multiple-shooting" framework that breaks down the generative trajectory into manageable segments, stitching them together to achieve constant memory usage and superior image reconstruction.

The Bottlenecks of Single-Shooting

The standard LSO approach has two major flaws:

  1. Memory Hogging: Updating the starting noise requires backpropagating through the entire generative trajectory. This mandates storing every intermediate step in GPU memory, which quickly becomes intractable as the number of timesteps increases.
  2. Poor Conditioning: Generative trajectories are long and highly non-linear. Minute changes to the initial noise can lead to unpredictable, wild variations at the end of the trajectory, causing vanishing or exploding gradients that make optimization unstable and slow to converge.

MS-Flow: A Multiple-Shooting Approach

To overcome these limitations, the authors propose MS-Flow (Multiple-Shooting Flow). Instead of treating the generative path as a single, unbreakable shot from noise to image, MS-Flow divides the trajectory into $K$ segments. The algorithm simultaneously optimizes a sequence of intermediate latent states, $\{x_0, \dots, x_K\}$.

Key technical innovations include:

  • Trajectory Stitching: Rather than enforcing a strict, hard Ordinary Differential Equation (ODE) constraint, MS-Flow applies soft penalties. Each segment is encouraged to follow the learned flow dynamics but is allowed slight deviations during optimization to better fit the observed data.
  • Alternating Minimization: The optimization alternates between two steps: updating the trajectory points to maintain consistency with the flow model, and updating the final estimate to ensure consistency with the observed data (e.g., the blurry input).
  • Jacobian-Free Updates: To further accelerate the process, the authors introduce a variant that bypasses the calculation of complex Vector-Jacobian Products (VJPs) of the flow model, reducing the computational burden to simple forward passes.

Key Insights and Advantages

MS-Flow fundamentally changes the scaling laws of latent space optimization. Unlike standard methods where memory scales linearly with the number of timesteps, MS-Flow maintains a constant memory footprint. This enables the use of much finer time discretizations without requiring high-end GPU clusters.

Furthermore, segmenting the trajectory eliminates the "long-horizon sensitivity" problem. Errors are prevented from accumulating and exploding across the entire path, resulting in significantly more stable convergence. By introducing a separate auxiliary variable for the final reconstructed image ($x_*$), MS-Flow gracefully balances adherence to the flow dynamics with the necessity of matching the observed data.

Experimental Validation

The researchers evaluated MS-Flow across diverse benchmarks, including OrganCMNIST for sparse-angle CT scans, CelebA for Gaussian deblurring, inpainting, and super-resolution, and FFHQ for scaling to massive latent flow models.

  • Efficiency: In a 12-timestep test, MS-Flow with Jacobian-free updates was nearly 40x faster than the D-Flow baseline (4.44s vs. 175.57s per image) while consuming significantly less memory.
  • Reconstruction Quality: On CelebA Gaussian deblurring, MS-Flow achieved a PSNR of 39.04 dB, substantially outperforming D-Flow (36.07 dB) and other state-of-the-art solvers.
  • Scaling to Stable Diffusion 3.5: MS-Flow successfully performed deblurring using SD 3.5. This is a major milestone, as backpropagating through such a massive model for multiple timesteps is typically computationally prohibitive.

Limitations and Future Directions

While highly effective, MS-Flow introduces new hyperparameters, such as weights for trajectory consistency ($\gamma$) and data consistency ($\alpha$). Although fixed values perform well, automated tuning could yield further improvements.

Additionally, the current framework focuses on deterministic ODE-based flows. Extending this stitching logic to Stochastic Differential Equations (SDEs)—the backbone of many diffusion models—represents a promising frontier. Finally, incorporating adaptive penalty updates, akin to the Alternating Direction Method of Multipliers (ADMM), could further enhance the robustness of trajectory matching.

Summary updated

BibTeX
@inproceedings{denker2026trajectory,
  author = {Alexander Denker and Zeljko Kereta and Carola-Bibiane Schönlieb and Moshe Eliasof},
  title = {{Trajectory Stitching for Solving Inverse Problems with Flow-Based Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=dZMH5XQeb7},
}
Figure