INTRODUCTIONDiffusion models (Sohl-Dickstein et al., 2015;Ho et al., 2020), and more generally flow-based models (Song et al., 2020b;Lipman et al., 2022;Albergo & Vanden-Eijnden, 2022), have become prominent in generation of images (Dhariwal & Nichol, 2021;Rombach et al., 2021), audio (Kong et al., 2020;Le et al., 2023), and molecules (Kong et al., 2020). While training flow models is relatively scalable and efficient, sampling from a flow-based model entails solving a Stochastic or Ordinary Differential Equation (SDE/ODE) in high dimensions, tracing a velocity field defined with the trained neural network. Using off-the-shelf solvers to approximate the solution of this ODE to a high precision requires a large Number (i.e., 100s) of Function Evaluations (NFE), making sampling one of the main standing challenges in flow models. Improving the sampling complexity of flow models, without degrading sample quality, will open up new applications that require fast sampling, and will help reducing the carbon footprint and deployment cost of these models.Current approaches for efficient sampling of flow models divide into two main groups: (i) Distillation: where the pre-trained model is fine-tuned to predict either the final sampling (Luhman & Luhman, 2021) or some intermediate solution steps (Salimans & Ho, 2022) of the ODE. Distillation does not guarantee sampling from the pre-trained model's distribution, but, when given access to the training data during distillation training, it is shown to empirically generate samples of comparable quality to the original model (Salimans & Ho, 2022;Meng et al., 2023). Unfortunately, the GPU time required to distill a model is comparable to the training time of the original model Salimans & Ho (2022), which is often considerable. (ii) Dedicated solvers: where the specific structure of the ODE is used to design a more efficient solver (Song et al., 2020a;Lu et al., 2022a;b) and/or employ a suitable solver family from the literature of numerical analysis (Zhang & Chen, 2022;Zhang et al., 2023). The main benefit of this approach is two-fold: First, it is consistent, i.e., as the number of steps (NFE) increases, the samples converge to those of the pre-trained model. Second, it does not require further training/fine-tuning of the pre-trained model, consequently avoiding long additional training times and access to training data. Related to our approach, some works have tried to learn an ODE solver within a certain class (Watson et al., 2021;Duan et al., 2023); however, they do not guarantee consistency and usually introduce moderate improvements over generic dedicated solvers. In this paper, we introduce Bespoke solvers, a framework for learning consistent ODE solvers custom-tailored to pre-trained flow models. The main motivation for Bespoke solvers is that different models exhibit sampling paths with different characteristics, leading to local truncation errors that are specific to each instance of a trained model. A key observation of this paper is that optimizing a solver for a particular model can significantly improve quality of samples for low NFE compared to existing dedicated solvers. Furthermore, Bespoke solvers use a very small number of learnable parameters and consequently are efficient to train. For example, we have trained n ∈ {5, 8, 10} steps Bespoke solvers for a pretrained ImageNet-64×64 flow model with {40, 64, 80} learnable parameters (resp.) producing images with Fréchet Inception Distances (FID) of 2.2, 1.79, 1.71 (resp.), where the latter is within 2% from the Ground Truth (GT) FID (1.68) computed with ∼ 180 NFE. The Bespoke solvers were trained (using a rather naive implementation) for roughly 1% of the GPU time required for training the original model. Figure 1 compares sampling at 10 NFE from a pre-trained AFHQ-256×256 flow model with order 2 Runge-Kutta (RK2) and its Bespoke version (RK2-Bes), along with the GT sample that requires ∼ 180 NFE. Our work brings the following contributions:1. A differentiable parametric family of consistent ODE solvers. 2. A tractable loss that bounds the global truncation error while allowing parallel computation.3. An algorithm for training a Bespoke n-step solver for a specific pre-trained model. 4. Significant improvement over dedicated solvers in generation quality for low NFE.
BESPOKE SOLVERSWe consider a pre-trained flow model taking some prior distribution (noise) p to a target (data) distribution q in data space R d . The flow model (Chen et al., 2018) is represented by a time-dependent Vector Field (VF) u : [0, 1] × R d → R d that transforms a noise sample x 0 ∼ p(x 0 ) to a data sample x 1 ∼ q(x 1 ) by solving the ODE ẋ(t) = u t (x(t)),with the initial condition x(0) = x 0 ∼ p(x 0 ), from time t = 0 until time t = 1, and ẋ(t) := d dt x(t). The solution at time t = 1, i.e., x(1) ∼ q(x(1)), is the generated target sample.Algorithm 1 Numerical ODE solver.Require: t 0 , x 0 for i = 0, 1, . . . , n -1 do (t i+1 , x i+1 ) = step(t i , x i ; u t ) end for return x n Numerical ODE solvers. Solving equation 1 is done in practice with numerical ODE solvers. A numerical solver is defined by an update rule:(t next , x next ) = step(t, x; u t ).(2) The update rule takes as input current time t and approximate solution x, and outputs the next time step t next and the corresponding approximation x next to the true solution x(t next ) at time t next . To approximate the solution at some desired end time, i.e., t = 1, one first initializes the solution at t = 0 and repeatedly applies the update rule in equation 2 n times, as presented in Algorithm 1. The step is designed so that t n = 1.An ODE solver (step) is said to be of order k if its local truncation error is∥x(t next ) -x next ∥ = O (t next -t) k+1 ,(3)asymptotically as t next → t, where t ∈ [0, 1) is arbitrary but fixed and t next , x next are defined by the solver, equation 2. A popular family of solvers that offers a wide range of orders is the Runge-Kutta (RK) family (Iserles, 2009). Two of the most popular members of the RK family are (set h = n -1 ):RK1 (Euler -order 1):step(t, x; u t ) = (t + h , x + hu t (x)) ,(4)RK2 (Midpoint -order 2): step(t, x; ut ) = t + h , x + hu t+ h 2 x + h 2 u t (x) . (5)Algorithm 2 Bespoke solver.Require: t 0 , x 0 , pre-trained u t , θ for i = 0, 1, . . . , n -1 do (t i+1 , x i+1 ) ← step θ (t i , x i ; u t ) end for return x n Approach outline. Given a pre-trained u t and a target number of time steps n our goal is to find a custom (Bespoke) solver that is optimal for approximating the samples x(1) defined via equation 1 from initial conditions sampled according to x(0) = x 0 ∼ p(x 0 ). To that end we develop two components: (i) a differentiable parametric family of update rules step θ , with parameters θ ∈ R p (where p is very small), where sampling is done by replacing step with step θ in Algorithm 1, see Algorithm 2; and (ii) a tractable loss bounding the global truncation error, i.e., the Root Mean Square Error (RMSE) between the approximate sample x θ n and the GT sample x(1), Global truncation error:L RMSE (θ) = E x0∼p(x0) x(1) -x θ n ,(6)where x θ n is the output of Algorithm 2, and ∥x∥ = (1 d d j=1 [x (j) ] 2 ) 1/2 .
PARAMETRIC FAMILY OF ODE SOLVERS THROUGH TRANSFORMED SAMPLING PATHSOur strategy for defining the parametric family of solvers step θ is using a generic base ODE solver, such as RK1 or RK2, applied to a parametric family of transformed paths. Transformed sampling paths. We transform the sample trajectories x(t) by applying two components: a time reparametrization and an arbitrary invertible transformation. That is,x(r) = φ r (x(t r )), r ∈ [0, 1],(7)where t r , φ r (x) are arbitrary functions in a family F defined by the following conditions: (i)Smoothness: t r : [0, 1] → [0, 1] is a diffeo- morphism 1 , and φ : [0, 1] × R d → R d is C 1 and a diffeomorphism in x.We also assume r t and φ -1 r are Lipschitz continuous with a constant L > 0. (ii) Boundary conditions: t r satisfies t 0 = 0 and t 1 = 1, and φ 0 (•) is the identity function, i.e., φ 0 (x) = x for all x ∈ R d . Figure 2 depicts a transformation of a path, x(t). Note that x(0) = x(0), however the end point x(1) does not have to coincide with x(1). Furthermore, as t r : [0, 1] → [0, 1] is a diffeomorphism, t r is strictly monotonically increasing.The motivation behind the definition of the transformed trajectories is that it allows reconstructing x(t) from x(r). Indeed, denoting r = r t the inverse function of t = t r we havex(t) = φ -1 rt (x(r t )). (8)Our hope is to find a transformation that simplifies sampling paths and allows the base solver to provide better approximations of the GT samples. The transformed trajectory xr is defined by a VF ūr (x) that can be given an explicit form as follows (proof in Appendix A):Proposition 2.1. Let x(t) be a solution to equation 1. Denote φr := d dr φ r and ṫr := d dr t r . Then x(r) defined in equation 7 is a solution to the ODE (equation 1) with the VFūr (x) = φr (φ -1 r (x)) + ṫr ∂ x φ r (φ -1 r (x))u tr (φ -1 r (x)).(9)Solvers via transformed paths. We are now ready to define our parametric family of solvers step θ (t, x; u t ): First we transform the input sample (t, x) according to equation 7 to(r, x) = (r t , φ rt (x)).(10)Next, we perform a step with the base solver of choice,(r next , xnext ) = step(r, x; ūr ),(11)and lastly, transform back using equation 8 to define the parametric solver step θ via(t next , x next ) = step θ (x, t; u t ) = t rnext , φ -1 rnext (x next ) . (12)The parameters θ denote the parameterized transformations t r and φ r satisfying the properties of F and the choice of a base solver step. In Section 2.2 we derive the explicit rules we use in this paper.Consistency of solvers. An important property of the parametric solver step θ is consistency.Namely, due to the properties of F, regardless of the particular choice of t r , φ r ∈ F, the solver step θ has the same local truncation error as the base solver.Theorem 2.2. (Consistency of parametric solvers) Given arbitrary t r , φ r in the family of functions F and a base ODE solver of order k, the corresponding ODE solver step θ is also of order k, i.e.,∥x(t next ) -x next ∥ = O((t next -t) k+1 ). (13)The proof is provided in Appendix B. Therefore, as long as t r , φ r (x) are in F, decreasing the base solver's step size h → 0 will result in our approximated sample x θ n converging to the exact sample x(1) of the trained model in the limit, i.e., x θ n → x(1) as n → ∞.
TWO USE CASESWe instantiate the Bespoke solver framework for two cases of interest (a full derivation is in Appendix E), and later prove that our choice of transformations in fact covers all "noise scheduler" configurations used in the standard diffusion model literature. In our use cases, we consider a timedependent scaling as our invertible transformation φ r , φ r (x) = s r x, and its inverseφ -1 r (x) = x/s r ,(14)where s : [0, 1] → R >0 is a strictly positive C 1 scaling function such that s 0 = 1 (i.e., satisfying the boundary condition of φ). The transformation of trajectories, i.e., equations 7 and 8, take the formx(r) = s r x(t r ), and x(t) = x(r t )/s tr ,(15)and we name this transformation: scale-time. The transformed VF ūr (equation 9) is thusūr (x) = ṡr s r x + ṫr s r u tr x s r . (16)Use case I: RK1-Bespoke. We consider RK1 (Euler) method (equation 4) as the base solver step and denoter i = ih, i ∈ [n], where [n] = {0, 1, . . . , n} and h = n -1 . Substituting equation 4 in equation 11, we get from equation 12 thatstep θ (t i , x i ; u t ) := t i+1 , s i + h ṡi s i+1 x i + h ṫi s i s i+1 u ti (x i ) ,(17)where we denotet i = t ri , ṫi = d dr | r=ri t r , s i = s ri , ṡi = d dr | r=ri s r , and i ∈ [n -1].The learnable parameters θ ∈ R p and their constraints are derived from the fact that the functions t r , φ r are members of F. There are p = 4n -1 parameters in total: θ = (θ t , θ s ), whereθ t : 0 = t 0 < t 1 < • • • < t n-1 < t n = 1 ṫ0 , . . . , ṫn-1 > 0 , θ s : s 1 , . . . , s n > 0 , s 0 = 1 ṡ0 , . . . , ṡn-1 . (18)Note that we ignore the Lipschitz constant constraints in F when deriving the constraints for θ.Use case II: RK2-Bespoke. Here we choose the RK2 (Midpoint) method (equation 5) as the base solver step. Similarly to the above, substituting equation 5 in equation 11, we getstep θ (t i , x i ; u t ) := t i+1 , s i s i+1 x i + h s i+1 ṡi+ 1 2 s i+ 1 2 z i + ṫi+ 1 2 s i+ 1 2 u t i+ 1 2 z i s i+ 1 2 , (19)where we set r i+ 1 2 = r i + h 2 , and accordingly t i+ 1 2 , ṫi+ 1 2 , s i+ 1 2 , and ṡi+ 1 2 are defined, andz i = s i + h 2 ṡi x i + h 2 s i ṫi u ti (x i ).(20)In this case there are p = 8n -1 learnable parameters, θ = (θ t , θ s ) ∈ R p , whereθ t : 0 = t 0 < t 1 2 < • • • < t n = 1 ṫ0 , ṫ 1 2 , . . . , ṫn-1 , ṫn-1 2 > 0 , θ s : s 1 2 , s 1 , . . . , s n > 0 , s 0 = 1 ṡ0 , ṡ 1 2 , . . . , ṡn-1 2 . (21)Equivalence of scale-time transformations and Gaussian Paths. We note that our scale-time transformation covers all possible trajectories used by diffusion and flow models trained with Gaussian distributions. Denote by p t (x) the probability density function of the random variable x(t), where x(t) is defined by a random initial sampling x(0) = x 0 ∼ p(x 0 ) and solving the ODE in equation 1.When training a Diffusion or Flow Matching models, p t has the form p t (x) = p t (x|x 1 )q(x 1 )dx 1 , where p t (x|x 1 ) = N (x|α t x 1 , σ2 t I). A pair of functions α, σ : [0, 1] → [0, 1] satisfying α 0 = 0 = σ 1 , α 1 = 1 = σ 0 , and strictly monotonic snr(t) = α t /σ t (22)is called a scheduler 2 . We use the term Gaussian Paths for the collection of probability paths p t (x) achieved by different schedulers. The velocity vector field that generates p t (x) and results from zero Diffusion/Flow Matching training loss isu t (x) = u t (x|x 1 ) p t (x|x 1 )q(x 1 ) p t (x) dx 1 ,(23)where u t (x|x 1 ) = σt σt x + αt -σt αt σt x 1 , as derived in Lipman et al. (2022). Next, we generalize a result by Kingma et al. (2021) and Karras et al. (2022) to consider marginal sampling paths x(t) defined by u t (x), and show that any two such paths are related by a scale-time transformation: Theorem 2.3. (Equivalence of Gaussian Paths and scale-time transformation) Consider a Gaussian Path defined by a scheduler (α t , σ t ), and let x(t) denote the solution of equation 1 with u t defined in equation 23 and initial condition x(0) = x 0 . Then, (i) For every other Gaussian Path defined by a scheduler (ᾱ r , σr ) with trajectories x(r) there exists a scale-time transformation with s 1 = 1 such that x(r) = s r x(t r ).(ii) For every scale-time transformation with s 1 = 1 there exists a Gaussian Path defined by a scheduler (ᾱ r , σr ) with trajectories x(r) such that s r x(t r ) = x(r).(Proof in Appendix C.) Assuming an ideal velocity field (equation 23), i.e., the pre-trained model is optimal, this theorem implies that searching over the scale-time transformations is equivalent to searching over all possible Gaussian Paths. Note, that in practice we allow s 1 ̸ = 1, expanding beyond the standard space of Gaussian Paths. Another interesting consequence of Theorem 2.3 (simply plug in t = 1) is that all ideal velocity fields in equation 23 define the same coupling, i.e., joint distribution, of noise x 0 and data x 1 .
RMSE UPPER BOUND LOSSOptimizing directly the RMSE loss (equation 6) is theoretically possible but would require keeping a full computational graph of Algorithm 2, i.e., n×order compositions of u t leading to a large memory footprint. Therefore, we instead derive an upper-bound to the RMSE loss that enables parallel computation over the steps of the solver, considerably reducing memory consumption. To construct the bound, let us fix an initial condition x 0 ∼ p(x 0 ) and denote as before x(1) to be the exact solution of the sample path (equation 1). Furthermore, consider a candidate solver step θ , and denote its t and x coordinate updates by step θ = (step θ t , step θ x ). Applying Algorithm 2 with t 0 = 0, x 0 produces a series of approximations x θ i , each corresponds to a time step t i , i ∈ [n]. Lastly, we denote bye θ i = x(t i ) -x θ i , d θ i = x(t i ) -step θ x (t i-1 , x(t i-1 ); u t )(24)the global and local truncation errors at time t i , respectively. Our goal is to bound the global error at the final time step t n = 1, i.e., e θ n . Using the update rule definition (equation 2) and triangle inequality we can bounde θ i+1 ≤ x(t i+1 ) -step θ x (t i , x(t i ); u t ) + step θ x (t i , x(t i ); u t ) -step θ x (t i , x θ i ; u t ) ≤ d θ i+1 + L θ i e θ i ,where L θ i is defined to be the Lipschitz constant of the function step θ x (t i , • ; u t ). To simplify notation we set by definition L θ n = 1 (this is possible since L θ n does not actually participate in the bound).Algorithm 3 Bespoke training.Require: pre-trained u t , number of steps n initialize θ ∈ R p while not converged dox 0 ∼ p(x 0 ) ▷ sample noise x(t) ← solve ODE 1 ▷ GT path L ← 0 ▷ init loss parallel for i = 0, ..., n -1 do x θ i+1 ← step θ x (x aux i (t i ), t i ; u t ) L+=M θ i+1 x aux i+1 (t i+1 )-x θ i+1end for θ ← θ -γ∇ θ L ▷ optimization step end while return θUsing the above bound n times and noting that e θ 0 = 0 we gete θ n ≤ n i=1 M θ i d θ i , where M θ i = n j=i L θ j .(25)Motivated by this bound we define our RMSE-Bound loss:L RMSE-B (θ) = E x0∼p(x0) n i=1 M θ i d θ i ,(26)where d θ i is defined in equation 24 and M θ i defined in equation 25. The constants L θ i depend both on the parameters θ and the Lipschitz constant L u of the network u t . As L u is difficult to estimate, we treat L u as a hyper-parameter, denoted L τ (in all experiments we use L τ = 1), and compute L θ i in terms of θ and L τ for our two Bespoke solvers, RK1 and RK2, in Appendix D. Assuming that L τ ≥ L u , an immediate consequence of the bound in equation 25 is that the RMSE-Bound loss bounds the RMSE loss, i.e., the global truncation error defined in equation 6,L RMSE (θ) ≤ L RMSE-B (θ).Implementation of the RMSE-Bound loss. We provide pseudocode for Bespoke training in Algorithm 3. During training, we need to have access to the GT path x(t) at times t i , i ∈ [n], which we compute with a generic solver. The Bespoke loss is constructed by plugging step θ (equations 17 or 19) into d i (equation 24). The gradient ∇ θ L RMSE-B (θ) requires the derivatives ∂x(t i )/∂t i . Computing the derivatives of x(t i ) can be done using the ODE it obeys, i.e., ẋ(t i ) = u ti (x i ). Therefore, a simple way to write the loss ensuring correct gradients w.r.t.t i is replace x(t i ) with x aux i (t i ) where x aux i (t) = x( t i ) + u ti (x( t i )) (t -t i ),(27)where • denotes the stop gradient operator; i.e., x aux i (t) is linear in t and its value and derivative w.r.t. t coincide with that of x(t i ) at time t = t i . Full details are provided in Appendix F. In Appendix K.1 we provide an ablation experiment comparing different Bespoke losses and corresponding algorithms including the direct RMSE loss (eq. 6) and our RMSE-Bound loss (eq. 26).
PREVIOUS WORKDiffusion models (Sohl-Dickstein et al., 2015;Ho et al., 2020) are a powerful paradigm for generative models that for sampling require solving a Stochastic Differential Equation (SDE), or its associated ODE, describing a (deterministic) flow process (Song et al., 2020a). Diffusion models have been generalized to paradigms directly aiming to learn a deterministic flow (Lipman et al., 2022;Albergo & Vanden-Eijnden, 2022;Liu et al., 2022). Flow-based models are efficient to train but costly to sample. Previous works had tackled the sample complexity of flow models by building dedicated solver schemes and distillation.Dedicated Solvers. This line of works introduced specialized ODE solvers exploiting the structure of the sampling ODE. Lu et al. (2022a); Zhang & Chen (2022) utilize the semi-linear structure of the score/ϵ-based sampling ODE to adopt a method of exponential integrators. (Zhang et al., 2023) further introduced refined error conditions to fulfill desired order conditions and achieve better sampling, while Lu et al. (2022b) adapted the method to guided sampling. Karras et al. (2022) suggested transforming the ODE to sample a different Gaussian Path for more efficient sampling, while also suggesting non-uniform time steps. In principle, all of these methods effectively proposed-based on intuition and heuristics-to apply a particular scale-time transformation to the sampling trajectories of the pre-trained model for more efficient sampling, while Bespoke solvers search for an optimal transformation within the entire space of scale-time transformations.Other works also aimed at learning the solver: Dockhorn et al. (2022) (GENIE) introduced a higherorder solver, and distilled the necessary JVP for their method; Watson et al. (2021) (DDSS) optimized a perceptual loss considering a family of generalized Gaussian diffusion models; Lam et al. (2021) improved the denoising process using bilateral filters, thereby indirectly affecting the efficiency of the ODE solver; Duan et al. (2023) suggested to learn a solver for diffusion models by replacing every other function evaluation by a linear subspace projection. Our Bespoke Solvers belong to this family of learnt solvers, however, they are consistent by construction (Theorem 2.2) and minimize a bound on the solution error (for the appropriate Lipschitz constant parameter). The main drawbacks of distillation methods is their long training time (Salimans & Ho, 2022), and lack of consistency, i.e., they do not sample from the distribution of the pre-trained model. Models and datasets. Our method works with pre-trained models: we use the pre-trained CIFAR10 (Krizhevsky & Hinton, 2009) model of (Song et al., 2020b) with published weights from EDM (Karras et al., 2022). Additionally, we trained diffusion/flow models on the datasets: CI-FAR10, AFHQ-256 (Choi et al., 2020a) and ImageNet-64/128 (Deng et al., 2009). Specifically, for ImageNet, as recommended by the authors (ima) we used the official face-blurred data (64×64 downsampled using the open source preprocessing scripts from Chrabaszcz et al. ( 2017)). For diffusion models, we used an ϵ-Variance Preserving (ϵ-VP) parameterization and schedule (Ho et al., 2020;Song et al., 2020b). For flow models, we used Flow Matching (Lipman et al., 2022) with Conditional Optimal Transport (FM-OT), and Flow Matching/v-prediction with Cosine Scheduling (FM/v-CS) (Salimans & Ho, 2022;Albergo & Vanden-Eijnden, 2022). Note that Flow Matching methods directly provide the velocity vector field u t (x), and we converted ϵ-VP to a velocity field using the identity in Song et al. (2020b). For conditional sampling we apply classifier free guidance (Ho & Salimans, 2022), so each evaluation uses two forward passes. Bespoke hyper-parameters and optimization. As our base ODE solvers, we tested RK1 (Euler) and RK2 (Midpoint). Furthermore, we have two hyper-parameters n -the number of steps, and L τ -the Lipschitz constant from lemmas D.2, D.3. We train our models with n ∈ {4, 5, 8, 10, 12} steps and fix L τ = 1. Ground Truth (GT) sample trajectories, x(t i ), are computed with an adaptive RK45 solver (Shampine, 1986). We compute FID (Heusel et al., 2017)  Bespoke RK1 vs. RK2. We compared RK1 and RK2 and their Bespoke versions on CIFAR10 and ImageNet-64 models (FM-OT and FM/v-CS). Figure 3 and Figures 10,9 show best validation RMSE (and corresponding PSNR). Using the same budget of function evaluations RK2/RK2-Bespoke produce considerably lower RMSE validation compared to RK1/RK1-Bespoke, respectively. We therefore opted for RK2/RK2-Bespoke for the rest of the experiments below.
EXPERIMENTSCIFAR10. We tested our method on the pre-trained CIFAR10 ϵ-VP model (Song et al., 2020b) released by EDM (Karras et al., 2022). Figure 4   ImageNet 64/128. We further experimented with the more challenging ImageNet-64×64 / 128×128 datasets. For ImageNet-64 we also trained 3 models as described above. For ImageNet-128, due to computational budget constraints, we only trained FM-OT (training requires nearly 2000 GPU days). Figure 5 compares RK2-Bespoke to various baselines including DPM 2 nd order (Lu et al., 2022a). As can be seen in the graphs, the Bespoke solvers improve both FID and RMSE. Interestingly, the Bespoke sampling takes all methods to similar RMSE levels, a fact that can be partially explained by Theorem 2.3. In Table 2, similar to AFHQ-256. We tested our method on the AFHQ dataset (Choi et al., 2020b) resized to 256×256 where as pre-trained model we used a FM-OT model we trained as described above. Ablations. We conducted two ablation experiments. First, Figure 16 shows the effect of training only time transform (keeping s r ≡ 1) and scale transformation (keeping t r = r). While the time transform is more significant than scale transform, incorporating scale improves RMSE for low NFE (which aligns with Theorem 2.2), and improve FID. Second, Figure 18 shows application of RK2-Bespoke solver trained on ImageNet-64 applied to ImageNet-128. The transferred solver, while sub-optimal compared to the Bespoke solver, still considerably improves the RK2 baseline in RMSE, and improves FID for higher NFE (16,20). Reusing Bespoke solvers can potentially be a cheap option to improve solvers. A TRANSFORMED PATHS (Appendix to Section 2.1.)
CONCLUSIONS, LIMITATIONS AND FUTURE WORKProposition A.1. Let x(t) be a solution to equation 1. Denote φr := d dr φ r and ṫr := d dr t r . Then x(r) defined in equation 7 is a solution to the ODE (equation 1) with the VFūr (x) = φr (φ -1 r (x)) + ṫr ∂ x φ r (φ -1 r (x))u tr (φ -1 r (x)).(9)Proof. Differentiating x(r) in equation 7, i.e., x(r) = φ r (x(t r )) w.r.t. r and using the chain rule givesẋ(r) = d dr (φ r (x(t r ))) = φr (x(t r )) + ∂ x φ r (x(t r )) ẋ(t r ) ṫr = φr (x(t r )) + ∂ x φ r (x(t r ))u tr (x(t r )) ṫr = φr (φ -1 r (x(r))) + ∂ x φ r (φ -1 r (x(r)))u tr (φ -1 r (x(r))) ṫr where in the third equality we used the fact that x(t) solves the ODE in equation 1 and therefore ẋ(t) = u t (x(t)); and in the last equality we applied φ -1 r to both sides of equation 7, i.e., x(t r ) = φ -1 r (x(r)). The above equation shows thatẋ(r) = u r (x(r)),(28)where ūr (x) is defined in equation 9, as required.B CONSISTENCY OF SOLVERS (Appendix to Section 2.1.)Figure 8: Proof notations and setup.Theorem 2.2. (Consistency of parametric solvers) Given arbitrary t r , φ r in the family of functions F and a base ODE solver of order k, the corresponding ODE solver step θ is also of order k, i.e., ∥x(t next ) -x next ∥ = O((t next -t) k+1 ).(13)Proof. Here (t, x) is our input sample x ∈ R d at time t ∈ [0, 1]. By definition r = r t , r next = r + h, and t next = t rnext . Furthermore, by definition x = φ r (x) is a sample at time r; x(r next ) is the solution to the ODE defined by ūr starting from (r, x); xnext is an approximation to x(r next ) as generated from the base ODE solver step. Lastly, x next = φ -1 rnext (x rnext ) and x(t next ) = φ -1 rnext (x(r next )). See Figure 8 for an illustration visualizing this setup. Now, since step is of order k we have thatx(r next ) -xnext = x(r next ) -step(x, r; ūr ) = O((r next -r) k+1 ).(29)Now,x(t next ) -x next = x(t next ) -φ -1 rnext (x next ) = x(t next ) -φ -1 rnext (x(r next ) + O((r next -r) k+1 )) = x(t next ) -φ -1 rnext (x(r next )) + O((r next -r) k+1 ) = O((r next -r) k+1 ) = O((t next -t) k+1 ),where in the first equality we used the definition of x next ; in the second equality we used equation 29; in the third equality we used the fact that φ -1 r is Lipschitz with constant L (for all r); in the fourth equality we used the definition of the path transform, x(t next ) = φ -1 rnext (x(r next )) as mentioned above; and in the last equality we used the fact that r t is also Lipschitz with a constant L and thereforer next -r = r tnext -r t = O(t next -t).C EQUIVALENCE OF GAUSSIAN PATHS AND SCALE-TIME TRANSFORMATIONS (Appendix to Section 2.2.) Theorem 2.3. (Equivalence of Gaussian Paths and scale-time transformation) Consider a Gaussian Path defined by a scheduler (α t , σ t ), and let x(t) denote the solution of equation 1 with u t defined in equation 23 and initial condition x(0) = x 0 . Then, (i) For every other Gaussian Path defined by a scheduler (ᾱ r , σr ) with trajectories x(r) there exists a scale-time transformation with s 1 = 1 such that x(r) = s r x(t r ).(ii) For every scale-time transformation with s 1 = 1 there exists a Gaussian Path defined by a scheduler (ᾱ r , σr ) with trajectories x(r) such that s r x(t r ) = x(r).Proof of theorem 2.3. Consider two arbitrary schedulers (α t , σ t ) and (ᾱ r , σr ). We can find s r , t r such that ᾱr = s r α tr , σr = s r σ tr .Indeed, one can check the following are such s r , t r :t r = snr -1 (snr(r)), s r = σr σ tr ,(31)where we remember snr is strictly monotonic as defined in equation 22, hence invertible. On the other hand, given an arbitrary scheduler (α t , σ t ) and an arbitrary scale-time transformation (t r , s r ) with s 1 = 1, we can define a scheduler ( ᾱr , σr ) via equation 30.For case (i), we are given another scheduler ᾱr , σr and define a scale-time transformation s r , t r with equation 31. For case (ii), we are given a scale-time transformation s r , t r and define a scheduler ᾱr , σr by equation 30.Now, the scheduler ᾱr , σr defines sampling paths x(r) given by the solution of the ODE in equation 1 with the marginal VF ū(1) r (x) defined in equation 23, i.e.,ū(1) r (x) = ūr (x|x 1 ) pr (x|x 1 )q(x 1 ) pr (x) dx 1 ,(32)where ūr (x|x 1 ) = σr σr x + αrσr ᾱr σr x 1 .The scale-time transformation s r , t r gives rise to a second VF ū(2) r (x) as in equation 16,ū(2) r (x) = ṡr s r x + ṫr s r u tr x s r ,(33)where u t is the VF defined by the scheduler (α t , σ t ) and equation 23.By uniqueness of ODE solutions, the theorem will be proved if we show thatū(1) r (x) = ū(2) r (x), ∀x ∈ R d , r ∈ [0, 1].(34)For that end, we use the notation of determinants to express ūr (x|x 1 ) = 1 σr 0 x x 1 σr ᾱr 1 σr αr 0 where in the second equality we substitute σr , αr as in equation 36, in the third and fourth equality we used the bi-linearity of determinants, and in the last equality we used the definition of u t (x|x 1 ) = , (35) ≤ L θ i ∥x -y∥ , ∀x, y ∈ R d . (39)We remember that step θ x (t i , • ; u t ) is defined using a base solver and the VF ūri (•); hence, we begin by computing a Lipschitz constant for ūri denoted L ū(r i ) in an auxiliary lemma: Lemma D.1. Assume that the original velocity field u t has a Lipschitz constant L u > 0. Then for everyr i ∈ [0, 1], L τ ≥ L u , and x, y ∈ R d ∥ū ri (x) -ūri (y)∥ ≤ L ū(r i ) ∥x -y∥ ,(40)whereL ū(r i ) = | ṡi | s i + ṫi L τ (41)Proof of lemma D.1. Since the original velocity field u has a Lipshitz constant L u > 0, for everyt ∈ [0, 1] and x, y ∈ R d ∥u t (x) -u t (y)∥ ≤ L u ∥x -y∥ .(42)Hence∥ū ri (x) -ūri (y)∥ = ṡi s i x + ṫi s i u ti x s i - ṡi s i y + ṫi s i u ti y s i (43) = ṡi s i (x -y) + ṫi s i u ti x s i -u ti y s i (44) ≤ | ṡi | s i ∥x -y∥ + ṫi s i u ti x s i -u ti y s i (45) ≤ | ṡi | s i + ṫi L u ∥x -y∥ (46) ≤ | ṡi | s i + ṫi L τ ∥x -y∥ . (47)We first apply the auxiliary lemma D.1 to compute a Lipschitz constant of step θ x (t i , • ; u t ) with RK1 (Euler method) as the base solver in lemma D.2 and for RK2 (Midpoint method) as the base solver in lemma D.3. Lemma D.2. (RK1 Lipschitz constant) Assume that the original velocity field u t has a Lipschitz constant L u > 0. Then, for every L τ ≥ L u ,L θ i = s i s i+1 (1 + hL ū(r i )) , (48)is a Lipschitz constant of RK1-Bespoke update rule, whereL ū(r i ) = | ṡi | s i + ṫi L τ . (49)Proof of lemma D.2. We begin with writing an explicit expression of step θ x (t i , x, ; u t ) for Euler solver in terms of the transformed velocity field ūr . That is,step θ x (t i , x, ; u t ) = 1 s i+1 [s i x + hū ri (s i x)] . (50)So that applying the triangle inequality and lemma D.1 givesstep θ x (t i , x; u t ) -step θ x (t i , y; u t ) = 1 s i+1 ∥s i x + hū ri (s i x) -[s i y + hū ri (s i y)]∥ ≤ s i s i+1 ∥x -y∥ + h s i+1 ∥ū ri (s i x) -ūri (s i y)∥ ≤ s i s i+1 ∥x -y∥ + h s i+1 | ṡi | s i + ṫi L τ ∥s i x -s i y∥ = s i s i+1 1 + h | ṡi | s i + ṫi L τ ∥x -y∥ .Lemma D.3. (RK2 Lipschitz constant) Assume that the original velocity field u t has a Lipschitz constant L u > 0. Then for everyL τ ≥ L u L θ i = s i s i+1 1 + hL ū(r i+ 1 2 ) 1 + h 2 L ū(r i ) (51)is a Lipschitz constant of RK2-Bespoke update rule, whereL ū(r i ) = | ṡi | s i + ṫi L τ . (52)Proof of lemma D.3. We begin by writing explicit expression of step θ x (t i , x; u t ) for RK2 (Midpoint) method in terms of the transformed velocity field ūr . We setz = s i x + h 2 ūri (s i x), w = s i y + h 2 ūri (s i y). (53) then step θ x (t i , x, ; u t ) = 1 s i+1 s i x + hū r i+ 1 2 (z) , (54) and step θ x (t i , y; u t ) = 1 s i+1 s i y + hū r i+ 1 2 (w) . (55)So that applying the triangle inequality and lemma D.1 givesstep θ x (t i , x; u t ) -step θ x (t i , y; u t ) ≤ s i s i+1 ∥x -y∥ + h s i+1 ūr i+ 1 2 (z) -ūr i+ 1 2 (w) ≤ s i s i+1 ∥x -y∥ + h s i+1 L ū(r i+ 1 2 ) ∥z -w∥ . (56)We apply the triangle inequality and the lemmaD.1 again to ∥z -w∥. That is,∥z -w∥ = s i x + h 2 ūri (s i x) -s i y + h 2 ūri (s i y) ≤ s i ∥x -y∥ + h 2 ∥ū ri (s i x) -ūri (s i y)∥ ≤ s i ∥x -y∥ + h 2 L ū(r i )s i ∥x -y∥ = s i 1 + h 2 L ū(r i ) ∥x -y∥ .Substitute back in equation 56 givess i s i+1 ∥x -y∥ + h s i+1 L ū(r i+ 1 2 ) ∥z -w∥ ≤ s i s i+1 1 + hL ū(r i+ 1 2 ) 1 + h 2 L ū(r i ) ∥x -y∥ .E DERIVATION OF PARAMETRIC SOLVER STEP θ (Appendix to Section 2.2.) This section presents a derivation of n-step parametric solverstep θ (t, x ; u t ) = step θ t (t, x ; u t ), step θ x (t, x ; u t )(57)for scale-time transformation (equation 15) with two options for a base solver: (i) RK1 method (Euler) as the base solver; and (ii) RK2 method (Midpoint). We do so by following equation 10-12. We begin with RK1 and derive equation 17. Given (t i , x i ), equation 10 for the scale time transformation is,xi = s i x i . (58)Then according to equation 11,xi+1 = step x (r i , xi , ūri ) (59) = xi + hū ri (x i ) (60) = xi + h ṡi s i xi + ṫi s i u ti xi s i (61) = s i x i + h ṡi x i + ṫi s i u ti (x i ) , (62)where in the second equality we apply an RK1 step (equation 4), in the third equality we substitute ūri using equation 16, and in the fourth equality we substitute xi as in equation 58. According to RK1 step (equation 4) we also have r i+1 = r i + h. Finally, equation 12 gives,step θ t (t i , x i ; u t ) = t i+1 (63) step θ x (t i , x i ; u t ) = s i + h ṡi s i+1 x i + h s i+1 ṫi s i u ti (x i ),(64)as in equation 17.Regarding the second case, equation 11 for the RK2 method (equation 5) is,xi+1 = step x (r i , xi , ūri ) (65) = xi + hū r i+ 1 2 (x i+ 1 2 ),(66)wherexi+ 1 2 = xi + h 2 ūri (x i ) (67)is the RK1 step from (r i , xi ) with step size h/2. Now substituting xi as defined equation 58 and ūr as defined in equation 16 we getxi+1 = s i x i + h ṡi+ 1 2 s i+ 1 2 xi+ 1 2 + ṫi+ 1 2 s i+ 1 2 u t i+ 1 2 xi+ 1 2 s i+ 1 2 . (68)wherexi+ 1 2 = s i + h 2 ṡi x i + h 2 s i ṫi u ti (x i ). (69)Lastly, according to equation 12 we havestep θ x (t i , x ; u t ) = s i s i+1 x i + h s i+1 ṡi+ 1 2 s i+ 1 2 xi+ 1 2 + ṫi+ 1 2 s i+ 1 2 u t i+ 1 2 xi+ 1 2 s i+ 1 2 , (70)as in equation 19 wherez i = xi+ 1 2 .F IMPLEMENTATION DETAILS (Appendix to Section 2.3.) This section presents further implementation details, complementing the main text. Our parametric family of solvers step θ is defined via a base solver step and a transformation (t r , φ r ) as defined in equation 12. We consider the RK2 (Midpoint, equation 5) method as the base solver with n steps and (t r , φ r ) the scale-time transformation (equation 15). That is, φ r (x) = s r x, where s : [0, 1] → R >0 , as in equation 14, which is our primary use case.Parameterization of t i . Remember that t r is a strictly monotonic, differentiable, increasing function t : [0, 1] → [0, 1]. Hence, t i must satisfy the constraints as in equation 21, i.e.,0 = t 0 < t 1 2 < • • • < t n = 1 (71) ṫ0 , ṫ 1 2 , . . . , ṫn-1 , ṫn-1 2 > 0. (72)To satisfy these constrains, we model t i and ṫi viat i = i j=0 |θ t j | n k=0 |θ t k | , ṫi = |θ ṫ i |, (73)where θ t i and θ ṫ i , i = 0, 1 2 , ..., n are free learnable parameters. Parameterization of s i . Since s r is a strictly positive, differentiable function satisfying a boundary condition at r = 0, the sequence s i should satisfy the constraints as in equation 21, i.e.,s 1 2 , s 1 , . . . , s n > 0 , s 0 = 1,(74)and ṡi are unconstrained. Similar to the above, we model s i and ṡi bys i = 0 i = 0 exp θ s i otherwise , ṡi = θ ṡ i ,(75)where θ s i and θ ṡ i , i = 0, 1 2 , ..., n are free learnable parameters. Bespoke training. The pseudo-code for training a Bespoke solver is provided in Algorithm 3. Here we add some more details on different steps of the training algorithm. We initialize the parameters θ such that the scale-transformation is the Identity transformation. That is, for every i = 0, 1 2 , ..., n,t i = i n , ṫi = 1,(76)s i = 1, ṡi = 0.(77)Explicitly, in terms of the learnable parameters, for every i = 0, 1 2 , ..., n,θ t i = 1, θ ṫ i = 1(78)θ s i = 0, θ ṡ i = 0.(79)To compute the GT path x(t), we solve the ODE in equation 1 with the pre-trained model u t and DOPRI5 method, then use linear interpolation to extract x(t i ), i = 0, 1, ..., n (Chen, 2018). Then, apply x aux i (t) (equation 27) to correctly handle the gradients w.r.t. to θ t i . See Table 3 for number of trajectories used during training. To compute the loss L RMSE-B (equation 26) we compute x i+1 = step θx (x aux i (t i ), t i ; u t ) with equations 19,20, and compute M i via lemma D.3 with L τ = 1. Finally, we use Adam optimizer Kingma & Ba (2017) with a learning rate of 2e -3 . Efficient sampling. When sampling using a Bespoke solver (Algorithm 2) each step involves applying φ -1 ri and φ ri consecutively. In case we use scale transformation, equation 14 (as is done in all examples in this paper), this does not introduce any difficulty, however if a more compute intensive φ is used the following sampling pseudo-code (Algorithm 4) provides an equivalent sampling while avoiding this unnecessary step.  Algorithm 4 Bespoke sampling (efficient).   Require: pre-trained u t , trained θ x 0 ∼ p(x 0 ) ▷ sample noise r 0 ← 0, x0 ← x 0 ▷ initial conditions for i = 0, 1, . . . , n -1 do (r i+1 , xi+1 ) ← step(r i , xi ; ūθ r ) end for return φ -1 1 (x n ) G BESPOKE RK1 VERSUS RK2
K ABLATIONS K.1 LOSS ABLATIONWe consider here three losses for optimizing the Bespoke solvers: RMSE-Bound (the parallel loss we advocate in the paper), RMSE (optimizing directly equation 6), and a simplified version of the RMSE-Bound: sum of Local Truncation Errors (LTE-parallel). That is, LTE is defined as in equation 26 but taking M θ i = 1 for all i. Algorithm 5 provides the pseudo-codes for all three losses. We have run all three algorithms on the ImageNet 64 dataset and compared their FID, and RMSE, where RMSE is computed w.r.t. GT samples (see Section 4 for details). For the non-parallel RMSE loss, we needed to use Activate Checkpointing to reduce memory consumption in order to be able to run this loss. Figure 15 shows the results. As can be seen in the graphs, RMSE loss, as expected, reaches lowest RMSE values per NFE, the second best is the RMSE-Bound loss and worst in terms of RMSE is the LTE. As for FID, RMSE performs worst, while for FM-OT model RMSE-Bound and LTE perform equivalently for NFE>10, and LTE has advantage as far as FID goes otherwise. Since our goal is to reduce RMSE and provide memory-scalable training algorithm we opted to use the memory efficient RMSE-Bound in the paper.
Algorithm 5 Bespoke training (parallel).Require: pre-trained u t , number of steps n initialize θ ∈ R p while not converged dox 0 ∼ p(x 0 ) ▷ sample noise x(t) ← solve ODE 1 ▷ GT path if RMSE loss then x θ n ← Bespoke sampling ▷ Alg. 2 L ← x(1) -x θ n else if RMSE-parallel loss then L ← 0 ▷ init loss parallel for i = 0, ..., n -1 do x θ i+1 ← step θ x (x aux i (t i ), t i ; u t ) L += M θ i+1 x aux i+1 (t i+1 ) -x θ i+1end for else if LTE-parallel loss then L ← 0 ▷ init loss parallel for i = 0, ..., n -1 dox θ i+1 ← step θ x (x aux i (t i ), t i ; u t ) L += x aux i+1 (t i+1 ) -x θ i+1 end for end if θ ← θ -γ∇ θ L ▷ optimization step end while return θ K.2 SCALE-TIME ABLATIONSThis section presents an ablation experiment on the effect of each component in the scale-time transformation. We train Bespoke-RK2 solvers with three choices of transformation: (i) time-only: train t r , ṫr and freeze s r ≡ 1, ṡr ≡ 0, (ii) scale-only: freeze t r ≡ r, ṫr ≡ 1 and train s r , ṡr , and (iii) scale-time: train both t r , ṫr and s r , ṡr . All experiments are performed on ImageNet 64 FM-OT model. Figure 16 shows the FID, and RMSE of Bespoke-RK2 time-only/scale-only/scale-time solvers and the base RK2 solver. First, all three Bespoke-RK2 solvers improve upon the base RK2 solver. Second, the time component seems more significant, but the scale component improves FID for all NFEs and RMSE for NFE < 20. Third, in RMSE, the significance of the time component increases as NFE increases. In addition, Figure 17 shows the trained time-only (top) and scale-only (bottom) transformations. Interestingly, we see that even seemingly small changes (e.g., scale-only with NFE ∈ {16, 20}) can affect dramatically the FID.  
K.3 TRANSFERRING BESPOKE SOLVERSThis section presents an ablation experiment demonstrating trained Bespoke solvers' generalization to different models. We train a Bespoke-RK2 solver on an ImageNet-64 FM-OT model and evaluate it on an ImageNet-128 FM-OT model. We compare its FID, and RMSE vs. NFE against the base RK2 solver evaluated on ImageNet-128 FM-OT and a Bespoke-RK2 solver trained and evaluated on ImageNet-128 FM-OT. The results is shown in Figure 18.
K.4 DISTILLATION-TYPE PARAMETRIZATIONThis section presents a distillation-type experiment in our framework. Our parametric family of solvers is defined by a composition of a scale-time transformation and the RK2 solver, resulting in step θ as in equations 19 and 20, where the weights of the pre-trained model u t are frozen. A natural comparison to a distillation-like approach is to let the weights of u t = u θ t change during optimization instead of using the scale-time transformation, that isL dis (θ) = E x0∼p(x0) n-1 i=0 x i+1 (t i+1 ) -step x (x i , t i ; u θ t )) ,(80)where t i = ih is fixed. We perform this experiment on ImageNet 64 FMv-CS. For a fair comparison, we use the same compute budget as used to train our Bespoke-RK2 solvers on these models: a total of 48K generated trajectories, 6k iterations, and we report at best FID. Figure 19 shows the RK2 base solver, Bespoke-RK2 solver, and Distillation-RK2 on ImageNet 64 FMv-CS: FID vs. NFE (left), and RMSE vs. NFE (right). Note that while distillation is able to improve from the baseline solver (RK2) it does not match the performance of the Bespoke solver. Two potential explanations why distillation is not as performant as Bespoke in this experiment are: First, the amount of trajectories/compute budget we use to optimize Bespoke is not sufficient for effective distillation; and second, successful distillation methods require access to training data. Training only on generated data distillation is less effective.
K.5 TRAINING STOPPING CRITERIAIn this ablation experiment, we qualitatively compare samples when changing the stopping criteria of the bespoke solver training. In Figure 20, we compare samples with bespoke-RK2 solvers where the training stopping criteria is best FID versus best RMSE on four models, ImageNet 64 ϵ-VP/FMv-CS/FM-OT and ImageNet 128 FM-OT, and NFE ∈ {8, 10, 20}. In all of the cases the differences are practically indistinguishable.   and23). This phenomenon suggests there may be a well-defined scale-time transformation in the limit of NFE → ∞. Furthermore, for ṫi and ṡi , even and odd parity points on the grid seem to converge to different curves, possibly due to their different role in the RK2 solvers. 
M PRE-TRAINED MODELSAll our FM-OT and FM/v-CS models were trained with Conditional Flow Matching (CFM) loss derived in Lipman et al. (2022),L CFM (θ) = E t,p0(x0),q(x1) ∥v t (x t ; θ) -( σtx 0 + αt x 1 )∥ 2 , (81)where t ∼ U([0, 1]), p 0 (x 0 ) = N (x 0 |0, I), q(x 1 ) is the data distribution, v t (x t ; θ) is the network, (α t , σ t ) is the scheduler as defined in equation 22, and x t = σ t x 0 + α t x 1 . For FM-OT the scheduler isα t = t, σ t = 1 -t,(82)and for FM/v-CS the scheduler isα t = sin π 2 t, σ t = cos π 2 t.(83)All our ϵ-VP models were trained with noise prediction loss as derived in Ho et al. (2020) and Song et al. (2020b), L noise (θ) = E t,p0(x0),q(x1) ∥ϵ t (x t ; θ) -x 0 ∥ 2 , (84)where the VP scheduler isα t = ξ 1-t , σ t = 1 -ξ 2 1-t , ξ s = e -1 4 s 2 (B-b)-1 2 sb ,(85)and B = 20, b = 0.1. All models use U-Net architecture as in Dhariwal & Nichol (2021), and the hyper-parameters are listed in Table 5.  Figure 1 :1Figure 1: Using 10 NFE to sample using our Bespoke solver improves fidelity w.r.t. the baseline (RK2) solver. Visualization of paths was done with the 2D PCA plane approximating the noise and end sample points.
Figure 2 :2Figure 2: Transformed paths.
Distillation.Distillation techniques aim to simplify sampling from a trained model by fine-tuning or training a new model to produce samples with fewer function evaluations. Luhman & Luhman (2021) directly regressed the trained model's samples, while Salimans & Ho (2022); Meng et al. (2023) built a sequence of models each reducing the sampling complexity by a factor of 2. Song et al. (2023) distilled a consistency map that enables large time steps in the probability flow; Liu et al. (2022) retrained a flow-based method based on samples from a previously trained flow. Yang et al. (2023) used distillation to reduce model size while maintaining the quality of the generated images.
Figure 4 :4Figure 3: Bespoke RK1/2, ImageNet-64 FM-OT.
Figure 6 :Figure 7 :67Figure 6: Comparison of FM-OT and FM/v-CS ImageNet-64 samples with RK2 and bespoke-RK2 solvers. Comparison to DPM-2 samples are in Figure 30. More examples are in Figures 27, 28, and 29. The similarity of generated images across models can be explained by their identical noise-to-data coupling (Theorem 2.3). GT NFE=20 NFE=10 NFE=8 GT NFE=20 NFE=10 NFE=8 GT NFE=20 NFE=10 NFE=8
)where x, x 1 ∈ R d and ᾱr , σr , αr , σr ∈ R as in vector cross product. Differentiating ᾱr , σr w.r.t. r gives αr = ṡr α tr + s r αtr ṫr , σr = ṡr σ tr + s r σtr ṫr . tr s r α tr 1 ṡr σ tr + s r σtr ṫr ṡr α tr + s r αtr ṫr 0 r σ tr s r α tr 1 ṡr σ tr ṡr α tr 0
Figure 11 :Figure 12 :Figure 13 :111213Figure 11: CIFAR10 sampling with Bespoke RK2 solvers vs. RK1,RK2,RK4: FID vs. NFE (top row), RMSE vs. NFE (middle row), and PSNR vs. NFE (bottom row).
Figure 17 :Figure 18 :1718Figure 17: Trained θ of scale-time ablation: Bespoke-RK2 time-only optimization (top), Bespoke-RK2 scaleonly optimization (bottom), on ImageNet-64 FM-OT for NFE 8/10/16/20.
Figure 19 :Figure 20 :1920Figure 19: Distillation-type experiment: RK2 solver, Bespoke-R2 solver, and Distillation using same number of trajectories and compute as Bespoke, on ImageNet 64 FM/v-CS: FID vs. NFE (left), and RMSE vs. NFE (right).
Figure 21 :Figure 22 :2122Figure 21: Trained θ of Bespoke-RK2 solvers on ImageNet-128 FM-OT for NFE 8/10/16/20.
Figure 23 :23Figure 23: Trained θ of Bespoke-RK2 solvers on CIFAR10 for NFE 8/10/16/20; ϵ-pred (top), FM/v-CS (middle), and FM-OT (bottom).
Figure 25 :25Figure 25: Comparison of FM-OT ImageNet-128 GT samples with RK2 and Bespoke-RK2 solvers.
Figure 26 :Figure 27 :Figure 28 :Figure 29 :Figure 30 :2627282930Figure 26: Comparison of FM-OT ImageNet-128 GT samples with RK2 and Bespoke-RK2 solvers.
Table 1 :1CIFAR10 sampling.MethodNFE FIDDistillationZheng et al. (2023) Luhman & Luhman (2021) Salimans & Ho (2022)1 1 1 23.78 9.36 9.12 4.5182.57DDIM(Song et al., 2020a)1013.36206.84DPM (Lu et al., 2022a)104.7203.99Dedicated solversDEIS (Zhang & Chen, 2022) GENIE (Dockhorn et al., 2022) 10 10 20 20 DDSS (Watson et al., 2021) 10 20 RK2-BES ϵ-VP 104.17 2.86 5.28 3.94 7.86 4.72 3.31ϵ-VP202.75RK2-BESFM/v-CS102.89FM/v-CS202.64RK2-BESFM-OT102.73FM-OT202.59
Figure 12 depicts an example of RMSE vs. training iterations for different n values. Unless otherwise stated, below we report results on best FID iteration and show samples on best RMSE validation iteration. Figures 21, 22, 23 depict the learned Bespoke solvers' parameters θ for the experiments presented below; note the differences across the learned schemes for different models and datasets.and validation RMSE (equation 6) is computed on a set of 10K fresh noise samples x 0 ∼ p(x 0 );
Table 2 :2ImageNet Bespoke solvers.
Table 44, we report best FID per NFEfor the Bespoke solvers we trained, the GT FID ofthe model, the % from GT achieved by the Bespokesolver, and the fraction of GPU time (in %) it tookto train this Bespoke solver compared to training theoriginal pre-trained model. Lastly, Figures 6, 7, 27,28, 29, 25, 26 depict qualitative sampling examplesfor RK2-Bespoke and RK2 solvers. Note the signifi-cant improvement of fidelity in the Bespoke samples to the ground truth.
This paper develops an algorithm for finding low-NFE ODE solvers custom-tailored to general pretrained flow models. Through extensive experiments we found that different models can benefit greatly from their own optimized solvers in terms of global truncation error (RMSE) and generation quality (FID). Currently, training a Bespoke solver requires roughly 1% of the original model's Qinsheng Zhang and Yongxin Chen. Fast sampling of diffusion models with exponential integrator. arXiv preprint arXiv:2204.13902, 2022.Qinsheng Zhang, Jiaming Song, and Yongxin Chen. Improved order analysis and design of exponential integrator for diffusion models sampling. arXiv preprint arXiv:2308.02157, 2023.Hongkai Zheng, Weili Nie, Arash Vahdat, Kamyar Azizzadenesheli, and Anima Anandkumar. Fast sampling of diffusion models via operator learning. In International Conference on Machine Learning, pp. 42390-42402. PMLR, 2023.training time, which can probably be still be made more efficient, e.g., by using training data or pre-processing sampling paths. A limitation of our framework is that it requires separate training for each target NFE and/or choice of guidance weight. For general NFE solvers one may consider a combined loss and/or continuous representation of φ r , t r , while guidance weight or even more general conditions can be used to directly condition φ r , t r . More general/expressive models for φ r , t r have the potential to further improve fast sampling of pre-trained models.
Table 3 :3Hyper-parameters of Bespoke solvers training on CIFAR10/ImageNet-64/ImageNet-128/AFHQ 256.
Table 4 :4CIFAR10 Bespoke solvers. We report best FID vs. NFE, the ground truth FID (GT-FID) for the model and FID/GT-FID in %, and the fraction of GPU time (in %) required to train the bespoke solver w.r.t. training the original model.ImageNet 64: FM/v-CSImageNet 64: FM-OT50RK1 RK2BES Base50RK1 RK2BES Base4040RMSE30RMSE30202010108101214 NFE1618208101214 NFE16182035353030PSNR20 25PSNR20 2515158101214 NFE1618208101214 NFE161820Figure 9: Bespoke RK1, Bespoke RK2, RK1, and RK2 solvers on ImageNet-64 models: RMSE vs. NFE (toprow), and PSNR vs. NFE (bottom row).
Different Bespoke losses for ImageNet 64. We compare RMSE-Bound (the parallel loss advocated in the paper), direct RMSE loss, and Local Truncation Error (LTE) which is a slightly simplified version of RMSE-Bound loss. All three variations are provided in Algorithm 5. In terms of RMSE the direct RMSE loss is as expected best however has large memory footprint, while RMSE-Bound is the runner-up and parallelizable. FID is not perfectly correlated with RMSE and shows a somewhat opposite trend (partially excluding the FM-OT model where RMSE-Bound and LTE are almost FID equivalent). We opted for RMSE-Bound loss in the paper since it is memory-scalable and provides best RMSE among the parallel loss options considered. Bespoke ablation I: RK2, Bespoke RK2 with full scale-time optimization, time-only optimization (keeping sr ≡ 1 fixed), and scale-only optimization (keeping tr = r fixed) on FM-OT ImageNet-64: FID vs. NFE (left), and RMSE vs. NFE (right). Note that most improvement provided by time optimization where scale improves FID for all NFEs, and RMSE for < 20 NFEs.LTE RMSE RMSE-Bound141414121212101010RMSE6 8RMSE6 8RMSE6 844422208101214 NFE16182008101214 NFE16182008101214 NFE1618201.75 2.00 2.50 Figure 15: 8 3.00 4.00 5.00 10.00 FID1016 RK2-BES: Scale-Time 20 NFE RK2-BES: Time Only RK2-BES: Scale Only RK2RMSE5 10 30 25 15 208101214 NFE161820Figure 16:
degree but are still different from one another, see Figure21and Figures 22, 23 bottom rows, for FM-OT trained on and CIFAR10 (resp.). These two observations showcase the advantage of a custom-made solver for each model. We also tested the latter point empirically in the ablation experiment in Section K.3, where we tested a Bespoke-RK2 solver trained on an ImageNet 64 FM-OT model to an ImageNet 128 FM-OT model and noticed a drop in performance compared to a Bespoke solver trained directly on the ImageNet 128 FM-OT model. In addition, we note the resemblance in the form of scale-time transformations trained on the same model type and same dataset across differentNFE (i.e., a row in Figures 21, 22,  ). Second, we note that the scale-time transformations trained on the same model type but on different datasets seem to have similarities to some
			A diffeomorphism is a C 1 continuously differentiable function with a C 1 continuous differentiable inverse.
			We use the convention of noise at time t = 0 and data at time t = 1.