Skip to main content

LeapAlign: Post-Training Flow Matching Models at Any Generation Step by Building Two-Step Trajectories

AuthorsZhanhao Liang et al.
Year2026
HF Upvotes9
arXiv2604.15311
PDFDownload
HF PageView on Hugging Face

Abstract

This paper focuses on the alignment of flow matching models with human preferences. A promising way is fine-tuning by directly backpropagating reward gradients through the differentiable generation process of flow matching. However, backpropagating through long trajectories results in prohibitive memory costs and gradient explosion. Therefore, direct-gradient methods struggle to update early generation steps, which are crucial for determining the global structure of the final image. To address this issue, we introduce LeapAlign, a fine-tuning method that reduces computational cost and enables direct gradient propagation from reward to early generation steps. Specifically, we shorten the long trajectory into only two steps by designing two consecutive leaps, each skipping multiple ODE sampling steps and predicting future latents in a single step. By randomizing the start and end timesteps of the leaps, LeapAlign leads to efficient and stable model updates at any generation step. To better use such shortened trajectories, we assign higher training weights to those that are more consistent with the long generation path. To further enhance gradient stability, we reduce the weights of gradient terms with large magnitude, instead of completely removing them as done in previous works. When fine-tuning the Flux model, LeapAlign consistently outperforms state-of-the-art GRPO-based and direct-gradient methods across various metrics, achieving superior image quality and image-text alignment.


Engineering Breakdown

Plain English

This paper addresses a critical bottleneck in aligning flow matching generative models with human preferences through reward gradient backpropagation. The authors identify that directly backpropagating rewards through long ODE sampling trajectories causes prohibitive memory consumption and gradient explosion, making it nearly impossible to update early generation steps that determine the final image's global structure. They propose LeapAlign, a fine-tuning method that compresses long trajectories into just two steps using consecutive leaps that skip multiple ODE samples, enabling efficient gradient flow from reward signals back to early generation steps while dramatically reducing computational cost.

Core Technical Contribution

LeapAlign's core innovation is a trajectory compression strategy that replaces sequential ODE sampling with strategic skip patterns, collapsing multi-hundred-step generation processes into two critical decision points. Rather than backpropagating through every intermediate step (which causes memory explosion and vanishing/exploding gradients), the method learns where to 'leap' forward through the sampling space, preserving gradient signal to early steps while reducing the backpropagation depth. This is a novel departure from standard direct-gradient reinforcement learning approaches that attempt to differentiate through entire forward passes; instead, it restructures the forward pass itself to be gradient-friendly. The technique is specific to flow matching models, exploiting their continuous ODE-based sampling process in a way that wouldn't apply to discrete diffusion or autoregressive models.

How It Works

LeapAlign operates on flow matching models, which generate samples by solving ODEs over continuous time steps. During standard generation, the model runs many ODE solver steps (e.g., 100-1000) sequentially from noise to data. In LeapAlign's fine-tuning phase, the method strategically selects two 'leap points' in the trajectory where gradients from the reward model are most informative. Rather than computing gradients through all intermediate steps, it backpropagates only through these two critical checkpoints, with each leap spanning multiple skipped ODE steps. The model learns which intermediate steps to skip by optimizing a jump strategy that preserves the gradient signal needed to update early-stage generation, where coarse structure decisions are made. The two-step structure acts as a bottleneck that forces the model to learn the most impactful trajectory modifications for reward optimization.

Production Impact

For teams deploying flow matching models in image generation or other domains, LeapAlign directly addresses a major scaling limitation: you can now use RLHF-style reward feedback to fine-tune models without running out of GPU memory or hitting gradient instability. This unlocks practical human-preference alignment for models that previously required either expensive distributed training or approximations like actor-critic methods. In a production pipeline, you'd replace standard supervised fine-tuning with LeapAlign's trajectory-compression approach, reducing peak memory from potentially 100+ GB to manageable levels while maintaining gradient quality. The trade-off is that you need a well-calibrated reward model and must profile which leap points work best for your specific reward signal; the method also assumes your ODE solver is differentiable, which rules out some numerical solvers. Integration complexity is moderate—you're modifying the backward pass and sampling strategy, but the forward generation remains standard flow matching.

Limitations and When Not to Use This

LeapAlign's two-step leap strategy is heuristic and may not be optimal for all reward functions or model architectures; the paper doesn't provide principled guidance on where to place leap points adaptively. The approach assumes the reward signal is smooth and well-aligned with image quality—if your reward model is noisy or adversarially learned, gradient explosion could still occur despite the trajectory compression. The method is specific to flow matching and doesn't immediately transfer to other generative paradigms like diffusion or autoregressive models, limiting its generality. The paper doesn't discuss convergence properties, failure modes when leap points are misspecified, or how performance degrades with shallow ODE solvers; these are critical for production safety.

Research Context

This work builds directly on the flow matching generative modeling framework and extends recent efforts in aligning diffusion/generative models with human feedback (like DiffusionDPO and other RLHF variants). It tackles a specific failure mode of naive direct-gradient methods that has been observed in diffusion model alignment but was not previously solved for flow matching. The paper positions itself as a bridge between expensive gradient-through-trajectory approaches and cheaper but less effective ranking-based methods like DPO. It opens research directions around principled trajectory compression, adaptive leap selection, and extending the technique to other continuous-trajectory generative models.


:::tip Subscribe Get weekly breakdowns of papers like this in AI Letters - the newsletter for engineers building production AI systems. :::


Back to Research Lab → · Subscribe to AI Letters →

© 2026 EngineersOfAI. All rights reserved.