Manuscript Offprint

arXiv:2610.03202

Contextual Flow Matching: Adaptive Step Selection in Flow Models for Efficient Visual Generation

Divya Jyoti Bajpai, Arun Verma, Manjesh Kumar Hanawal

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Flow Matching enables high-quality visual generation via continuous-time dynamics, but inference remains costly due to multiple sequential function evaluations. Existing acceleration methods reduce the number of function evaluations but often introduce additional training overhead, degrade quality, or fail to account for input-dependent variability. We propose CoFLOW, an inference-time method that adaptively selects the step counts each generation based on the prompt features. Our context-aware CoFLOW is trained online with an unsupervised reward that balances inference efficiency and generation fidelity. Our method is plug-and-play, requiring no retraining of the underlying generative model. It generalizes to image and video generation, achieving over 2.5×2.5\times speedup while preserving perceptual and semantic quality. We further provide a theoretical analysis establishing an O(1/K)O(1/K) forward-Euler discretization error bound under standard regularity conditions.

1 Introduction

Flow Matching (FM) [1] has recently emerged as a powerful paradigm for visual generation [2]. In this framework, a time-dependent vector field governs the evolution of samples, and integrating this dynamics produces high-quality outputs along smooth trajectories. Compared to diffusion-based approaches [3], FM can achieve comparable or superior perceptual fidelity with fewer function evaluations (steps), making it an attractive alternative for both image and video generation. Despite these advantages, inference efficiency remains a central challenge [4, 5, 6]. Generating a single sample requires sequential numerical integration of the learned dynamics, which involves multiple forward passes of the model over time. This inherent serial processing becomes increasingly expensive as model capacity scales and tasks demand higher spatial resolutions or longer temporal horizons, resulting in substantial inference latency in practical deployments.

A range of methods have been proposed to reduce inference latency in visual generations. These methods include distillation [4, 5, 7], step truncation [8, 9], and consistency-based training [10, 11, 12]. While these approaches effectively reduce the number of function evaluations, they introduce non-trivial trade-offs, including additional training costs and reliance on teacher models or large-scale datasets. Such training overhead can offset the computational benefits gained at inference time. Several training-free methods have also been proposed that rely on heuristic step-skipping [13, 14, 15] based on intermediate signals. However, these training-free methods require accurate, expensive

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

Figure

Our Method

A photo of a cat.

5 Steps

10 Steps

15 Steps

20 Steps

25 Steps

40 Steps

Our Method

50 Steps

A photo of a cat travelling to the moon in a UFO.

Figure 1: Generation across integration step budgets. Different inputs can exhibit different behavior as the integration budget changes. The rightmost plots illustrate relative velocity variation along the corresponding trajectories.

estimates of step importance, and any estimation errors can accumulate over time, irreversibly degrading generation quality.

The difficulty of a generative task and associated computational requirements can vary substantially. For example, a simple prompt “A photo of a cat” requires less computation than a prompt like “A photo of a cat traveling to the moon in a UFO” (see Fig. 1) due to the need for fine-grained and prolonged trajectory refinement of the generative process. The complexity of prompts can then influence the number of steps. AdaDiff [16] adapts to such input-dependent complexity by using a pre-trained policy that decides the number of steps required to complete the generative task. However, pre-training such a policy is expensive, and the trained policy can be sensitive to distribution shifts at inference time. Our goal in this work is to develop an input-adaptive online strategy that eliminates the need for pre-training.

We introduce CoFLOW: Contextual Flow Matching, an inference-time input-adaptive step selection method for Flow Models, thereby reducing inference cost. CoFLOW uses the contextual bandit [17] framework to learn the optimal number of steps for each generation task in an online fashion. It treats prompt-specific features, like semantic embeddings, complexity cues, and prior observations from similar inputs as context, and uses a neural network to predict the number of steps required. Once the number of steps is decided, it executes the corresponding full generation trajectory. The neural network is trained on the fly by optimizing a reward that balances computational cost and trajectory refinement. The reward is motivated by the observation that complex prompts induce larger variations in the velocity field across timesteps (see Fig 1 and 6).

CoFLOW is fully task-agnostic, adapts to multiple existing solvers (see Appendix A.9), and applies seamlessly to image generation, image editing, and video generation while maintaining high-fidelity outputs. We further provide theoretical grounding by deriving an upper bound on the discretization error induced by suboptimal step selection. Together, these components establish a principled adaptive inference framework that reduces unnecessary computation while preserving generation quality.

We summarize the key contributions of this paper as follows:

• We propose a novel adaptive inference paradigm that predicts an input-dependent step budget using a neural contextual bandits algorithm, conditioned solely on prompt-specific features.

• We design an unsupervised reward mechanism based on trajectory dynamics, leveraging variations in the learned velocity field to balance computational cost and generation fidelity.

• We provide a theoretical analysis establishing an O(1/K)O(1/K) discretization-error bound, highlighting the role of input-dependent flow dynamics in adaptive inference.

• Experimental results across image and video benchmarks show that our method achieves inference acceleration ( >2.5×> 2.5\times) while maintaining quality and outperforming baselines.

References (41)