<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Flow Straight and Fast:Learning to Generate and Transfer Data with Rectified Flow</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10440561</idno>
					<idno type="doi"></idno>
					<title level='j'>International conference on learning representations (ICLR)</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Xingchao Liu</author><author>Chengyue Gong</author><author>Qiang Liu</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[We present rectified flow, a surprisingly simple approach to learning (neural) ordinary differentialequation (ODE) models to transport between two empirically observed distributions π0 and π1, henceproviding a unified solution to generative modeling and domain transfer, among various other tasksinvolving distribution transport. The idea of rectified flow is to learn the ODE to follow the straightpaths connecting the points drawn from π0 and π1 as much as possible. This is achieved by solving astraightforward nonlinear least squares optimization problem, which can be easily scaled to large modelswithout introducing extra parameters beyond standard supervised learning. The straight paths are specialand preferred because they are the shortest paths between two points, and can be simulated exactly without time discretization and hence yield computationally efficient models. We show that the procedureof learning a rectified flow from data, called rectification, turns an arbitrary coupling of π0 and π1 to anew deterministic coupling with provably non-increasing convex transport costs. In addition, recursivelyapplying rectification allows us to obtain a sequence of flows with increasingly straight paths, which canbe simulated accurately with coarse time discretization in the inference phase. In empirical studies, weshow that rectified flow performs superbly on image generation, image-to-image translation, and domainadaptation. In particular, on image generation and translation, our method yields nearly straight flowsthat give high quality results even with a single Euler discretization step.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>Compared with supervised learning, the shared difficulty of various forms of unsupervised learning is the lack of paired input/output data with which standard regression or classification tasks can be invoked. The gist of most unsupervised methods is to find, in one way or another, meaningful correspondences between points from two distributions. For example, generative models such as generative adversarial networks (GAN) and variational autoencoders (VAE) [e.g., <ref type="bibr">19,</ref><ref type="bibr">32,</ref><ref type="bibr">14]</ref> seek to map data points to latent codes following a simple elementary (Gaussian) distribution with which the data can be generated and manipulated. Representation learning rests on the idea that if a sufficiently smooth function can map a structured data distribution to an elementary distribution, it can (likely) be endowed with certain semantically meaningful interpretation and useful for various downstream learning tasks. On the other hand, domain transfer methods find mappings to transfer points from two different data distributions, both observed empirically, for the purpose of image-to-image translation, style transfer, and domain adaption [e.g., <ref type="bibr">100,</ref><ref type="bibr">16,</ref><ref type="bibr">79,</ref><ref type="bibr">59]</ref>. All these tasks can be framed unifiedly as finding a transport map between two distributions:</p><p>The Transport Mapping Problem Given empirical observations of two distributions X 0 &#8764; &#960; 0 , X 1 &#8764; &#960; 1 on R d , find a transport map T : R d &#8594; R d (hopefully nice or optimal in certain sense), such that Z 1 := T (Z 0 ) &#8764; &#960; 1 when Z 0 &#8764; &#960; 0 , that is, (Z 0 , Z 1 ) is a coupling (a.k.a transport plan) of &#960; 0 and &#960; 1 .</p><p>Several lines of techniques have been developed depending on how to represent and train the map T . In traditional generative models, T is parameterized as a neural network, and trained with either GAN-type minimax algorithms or (approximate) maximum likelihood estimation (MLE). However, GANs are known to suffer from numerically instability and mode collapse issues, and require substantial engineering efforts and human tuning, which often do not transfer well across different model architecture and datasets. On the other hand, MLE tends to be intractable for complex models, and hence requires approximate variational or Monte Carlo inference techniques such as those used in variational auto-encoders (VAE), or special model structures such as normalizing flow and auto-regressive models, to yield tractable likelihood, causing difficult trade-offs between expressive power and computational cost.</p><p>Recently, advances have been made by representing the transport plan implicitly as a continuous time process, such as flow models with neural ordinary differential equations (ODEs) [e.g., <ref type="bibr">6,</ref><ref type="bibr">56]</ref> and diffusion models by stochastic differential equations (SDEs) [e.g., <ref type="bibr">73,</ref><ref type="bibr">23,</ref><ref type="bibr">80,</ref><ref type="bibr">11,</ref><ref type="bibr">82]</ref>; in these models, a neural network is trained to represent the drift force of the processes and a numerical ODE/SDE solver is used to simulate the process during inference. The key idea is that, by leveraging the mathematical structures of ODEs/SDEs, the continuous-time models can be trained efficiently without resorting to minimax or traditional approximate inference techniques. The most notable examples are the recent score-based generative models <ref type="bibr">[71]</ref><ref type="bibr">[72]</ref><ref type="bibr">[73]</ref> and denoising diffusion probabilistic models (DDPM) <ref type="bibr">[23]</ref>, which we call denoising diffusion methods collectively. These methods allow us to train large-scale diffusion/SDE-based generative models that surpass GANs on image generation in both image quality and diversity, without the instability and mode collapse issues [e.g., <ref type="bibr">12,</ref><ref type="bibr">53,</ref><ref type="bibr">61,</ref><ref type="bibr">64]</ref>. The learned SDEs can be converted into deterministic ODE models for faster inference with the method of probability flow ODEs <ref type="bibr">[73]</ref> and DDIM <ref type="bibr">[70]</ref>.</p><p>However, compared with the traditional one-step models like GAN and VAE, a key drawback of continuoustimes models is the high computational cost in inference time: drawing a single point (e.g., image) requires to solve the ODE/SDE with a numerical solver that needs to repeatedly call the expensive neural drift function. In addition, the existing denoising diffusion techniques require substantial hyper-parameter search in an involved design space and are still poorly understood both empirically and theoretically <ref type="bibr">[29]</ref>.</p><p>In existing approaches, generative modeling and domain transfer are typically treated separately. It often requires to extend or customize a generative learning techniques to solve domain transfer problems; see e.g., Cycle GAN <ref type="bibr">[100]</ref> and diffusion-based image-to-image translation [e.g., <ref type="bibr">75,</ref><ref type="bibr">97]</ref>. One framework that naturally unifies both domains is optimal transport (OT) [e.g., <ref type="bibr">85,</ref><ref type="bibr">2,</ref><ref type="bibr">15,</ref><ref type="bibr">59]</ref>, which endows a collection of techniques for finding optimal couplings with minimum transport costs of form E[c(Z 1 -Z 0 )] w.r.t. a cost function c : R d &#8594; R, yielding natural applications to both generative and transfer learning. However, the existing OT techniques are slow for problems with high dimensional and large volumes of data <ref type="bibr">[59]</ref>. Furthermore, as the transport costs do not perfectly align with the actual learning performance, methods that faithfully find the optimal transport maps do not necessarily have better learning performance <ref type="bibr">[34]</ref>.</p><p>Figure <ref type="figure">1</ref>: The trajectories of rectified flows for image generation (&#960; 0 : standard Gaussian noise, &#960; 1 : cat faces, top two rows), and image transfer between human and cat faces (&#960; 0 : human faces, &#960; 1 : cat faces, bottom two rows), when simulated using Euler method with step size 1/N for N steps. The first rectified flow induced from the training data (1-rectified flow) yields good results with a very small number (e.g., &#8805; 2) of steps; the straightened reflow induced from 1-rectified flow (denoted as 2-rectified flow) has nearly straight line trajectories and yield good results even with one discretization step.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Contribution</head><p>We introduce rectified flow, a surprisingly simple approach to the transport mapping problem, which unifiedly solves both generative modeling and domain transfer. The rectified flow is an ODE model that transport distribution &#960; 0 to &#960; 1 by following straight line paths as much as possible. The straight paths are preferred both theoretically because it is the shortest path between two end points, and computationally because it can be exactly simulated without time discretization. Hence, flows with straight paths bridge the gap between one-step and continuous-time models.</p><p>Algorithmically, the rectified flow is trained with a simple and scalable unconstrained least squares optimization procedure, which avoids the instability issues of GANs, the intractable likelihood of MLE methods, and the subtle hyper-parameter decisions of denoising diffusion models. The procedure of obtaining the rectified flow from the training data has the attractive theoretical property of 1) yielding a coupling with non-increasing transport cost jointly for all convex cost c, and 2) making the paths of flow increasingly straight and hence incurring lower error with numerical solvers. Therefore, with a reflow procedure that iteratively trains new rectified flows with the data simulated from the previously obtained rectified flow, we obtain nearly straight flows that yield good results even with the coarsest time discretization, i.e., one Euler step. Our method is purely ODE-based, and is both conceptually simpler and practically faster in inference time than the SDE-based approaches of <ref type="bibr">[23,</ref><ref type="bibr">73,</ref><ref type="bibr">70]</ref>. Empirically, rectified flow can yield high-quality results for image generation when simulated with a very few number of Euler steps (see Figure <ref type="figure">1</ref>, top row). Moreover, with just one step of reflow, the flow becomes nearly straight and hence yield good results with a single Euler discretization step (Figure <ref type="figure">1</ref>, the second row). This substantially improves over the standard denoising diffusion methods. Quantitatively, we claim a state-of-the-art result of FID (4.85) and recall (0.51) on CIFAR10 for one-step fast diffusion/flow models <ref type="bibr">[5,</ref><ref type="bibr">48,</ref><ref type="bibr">91,</ref><ref type="bibr">99,</ref><ref type="bibr">47]</ref>. The same algorithm also achieves superb result on domain transfer tasks such as image-toimage translation (see the bottom two rows of Figure <ref type="figure">1</ref>) and transfer learning.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Method</head><p>We provide a quick overview of the method in Section 2.1, followed with some discussion and remarks in Section 2.2. We introduce a nonlinear extension of our method in Section 2.3, with which we clarify the connection and advantages of our method with the method of probability flow ODEs <ref type="bibr">[73]</ref> and DDIM <ref type="bibr">[70]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1">Overview</head><p>Rectified flow Given empirical observations of X 0 &#8764; &#960; 0 , X 1 &#8764; &#960; 1 , the rectified flow induced from (X 0 , X 1 ) is an ordinary differentiable model (ODE) on time t &#8712; [0, 1],</p><p>which converts Z 0 from &#960; 0 to a Z 1 following &#960; 1 . The drift force v : R d &#8594; R d is set to drive the flow to follow the direction (X 1 -X 0 ) of the linear path pointing from X 0 to X 1 as much as possible, by solving a simple least squares regression problem:</p><p>where X t is the linear interpolation of X 0 and X 1 . Naviely, X t follows the ODE of dX t = (X 1 -X 0 )dt, which is non-causal (or anticipating) as the update of X t requires the information of the final point X 1 . By fitting the drift v with X 1 -X 0 , the rectified flow causalizes the paths of linear interpolation X t , yielding an ODE flow that can be simulated without seeing the future.</p><p>In practice, we parameterize v with a neural network or other nonlinear models and solve <ref type="bibr">(1)</ref> with any offthe-shelf stochastic optimizer, such as stochastic gradient descent, with empirical draws of (X 0 , X 1 ). See Algorithm 1. After we get v, we solve the ODE starting from Z 0 &#8764; &#960; 0 to transfer &#960; 0 to &#960; 1 , backwardly starting from Z 1 &#8764; &#960; 1 to transfer &#960; 1 to &#960; 0 . Specifically, for backward sampling, we simply solve d Xt = -v( Xt , t)dt initialized from X0 &#8764; &#960; 1 and set X t = X1-t . The forward and backward sampling are equally favored by the training algorithm, because the objective in ( <ref type="formula">1</ref>) is time-symmetric in that it yields the equivalent problem if we exchange X 0 and X 1 and flip the sign of v.</p><p>Flows avoid crossing A key to understanding the method is the non-crossing property of flows: the different paths following a well defined ODE dZ t = v(Z t , t)dt, whose solution exists and is unique, cannot cross each other at any time t &#8712; [0, 1). Specifically, there exists no location z &#8712; R d and time t &#8712; [0, 1), such that two paths go across z at time t along different directions, because otherwise the solution of the ODE would be non-unique. On the other hand, the paths of the interpolation process X t may intersect with each other (Figure <ref type="figure">2a</ref>), which makes it non-causal. Hence, as shown in Figure <ref type="figure">2b</ref>, the rectified flow rewires the individual trajectories passing through the intersection points to avoid crossing, while tracing out the same density map as the linear interpolation paths due to the optimization of (1). We can view the linear interpolation X t as building roads (or tunnels) to connect &#960; 0 and &#960; 1 , and the rectified flow as traffics of particles passing through the roads in a myopic, memoryless, non-crossing way, which allows them to ignore the global path information of how X 0 and X 1 are paired, and rebuild a more deterministic pairing of (Z 0 , Z 1 ).</p><p>Rectified flows reduce transport costs If (1) is solved exactly, the pair (Z 0 , Z 1 ) of the rectified flow is guaranteed to be a valid coupling of &#960; 0 , &#960; 1 (Theorem 3.3), that is, Z 1 follows &#960; 1 if Z 0 &#8764; &#960; 0 . Moreover, (Z 0 , Z 1 ) guarantees to yield no larger transport cost than the data pair (X 0 , X 1 ) simultaneously for all convex cost functions c (Theorem 3.5). The data pair (X 0 , X 1 ) can be an arbitrary coupling of &#960; 0 , &#960; 1 , typically independent (i.e., (X 0 , X 1 ) &#8764; &#960; 0 &#215; &#960; 1 ) as dictated by the lack of meaningfully paired observations in practical problems. In comparison, the rectified coupling (Z 0 , Z 1 ) has a deterministic dependency as it is constructed from an ODE model. Denote by (Z 0 , Z 1 ) = Rectify((X 0 , X 1 )) the mapping from (X 0 , X 1 ) to (Z 0 , Z 1 ). Hence, Rectify(&#8226;) converts an arbitrary coupling into a deterministic coupling with lower convex transport costs.</p><p>Straight line flows yield fast simulation Following Algorithm 1, denote by Z = RectFlow((X 0 , X 1 )) the rectified flow induced from (X 0 , X 1 ). Applying this operator recursively yields a sequence of rectified flows</p><p>, where Z k is the k-th rectified flow, or simply k-rectified flow, induced from (X 0 , X 1 ). This reflow procedure not only decreases transport cost, but also has the important effect of straightening paths of rectified flows, that is, making the paths of the flow more straight. This is highly attractive computationally as flows with nearly straight paths incur small time-discretization error in numerical simulation. Indeed, perfectly straight paths can be simulated exactly with a single Euler step and is effectively a onestep model. This addresses the very bottleneck of high inference cost in existing continuous-time ODE/SDE models.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2">Main Results and Properties</head><p>We provide more in-depth discussions on the main properties of rectified flow. We keep the discussion informal to highlight the intuitions in this section and defer the full course theoretical analysis to Section 3.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Algorithm 1 Rectified Flow: Main Algorithm</head><p>Procedure: Z = RectFlow((X 0 , X 1 )):</p><p>Inputs: Draws from a coupling (X 0 , X 1 ) of &#960; 0 and &#960; 1 ; velocity model v &#952; : R d &#8594; R d with parameter &#952;.</p><p>First, for a given input coupling (X 0 , X 1 ), it is easy to see that the exact minimum of (1) is achieved if</p><p>which is the expectation of the line directions X 1 -X 0 that pass through x at time t. We discuss below the property of rectified flow dZ t = v X (Z t , t)dt with Z 0 &#8764; &#960; 0 , assuming that the ODE has an unique solution.</p><p>Marginal preserving property [Theorem 3.3] The pair (Z 0 , Z 1 ) is a coupling of &#960; 0 and &#960; 1 . In fact, the marginal law of Z t equals that of X t at every time t, that is,</p><p>Intuitively, this is because, by the definition of v X in (2), the expected amount of mass that passes through every infinitesmal volume at all location and time are equal under the dynamics of X t and Z t , which ensures that they trace out the same marginal distributions:</p><p>On the other hand, the joint distributions of the whole trajectory of Z t and that of X t are different in general.</p><p>In particular, X t is in general a non-causal, non-Markov process, with (X 0 , X 1 ) a stochastic coupling, and Z t causalizes, Markovianizes and derandomizes X t , while preserving the marginal distributions at all time.</p><p>Reducing transport costs [Theorem 3.5] The coupling (Z 0 , Z 1 ) yields lower or equal convex transport costs than the input (X 0 , X 1 )</p><p>The transport costs measure the expense of transporting the mass of one distribution to another following the assignment relation specified by the coupling and is a central topic in optimal transport [e.g., <ref type="bibr">84,</ref><ref type="bibr">85,</ref><ref type="bibr">65,</ref><ref type="bibr">59,</ref><ref type="bibr">15]</ref>. Typical examples are c(&#8226;) = &#8226; &#945; with &#945; &#8805; 1. Hence, Rectify(&#8226;) yields a Pareto descent on the collection of all convex transport costs, without targeting any specific c. This distinguishes it from the typical optimal transport optimization methods, which are explicitly framed to optimize a given c. As a result, recursive application of Rectify(&#8226;) does not guarantee to attain the c-optimal coupling for any given c, with the exception in the one-dimensional case when the fixed point of Rectify(&#8226;) coincides with the unique monotonic coupling that simultaneously minimizes all non-negative convex costs c; see Section 3.4.</p><p>Intuitively, the convex transport costs are guaranteed to decrease because the paths of the rectified flow Z t is a rewiring of the straight paths connecting (X 0 , X 1 ). To give an illustration, consider the simple case of</p><p>are the expected length of the straight lines connecting the end points. The inequality can be proved graphically as follows:</p><p>where</p><p>&#8804; uses the triangle inequality, and</p><p>= holds because the paths of Z t is a rewiring of the straight paths of X t , following the construction of v X in (2). For general convex c, a similar proof using Jensen's inequality is shown in Section 3.2.</p><p>Reflow, straightening, fast simulation As shown in Figure <ref type="figure">3</ref>, when we recursively apply the procedure</p><p>), the paths of the k-rectified flow Z k are increasingly straight, and hence easier to simulate numerically, as k increases. This straightening tendency can be guaranteed theoretically.   Specifically, we say that a flow dZ t = v(Z t , t)dt is straight if we have almost surely that Z t = tZ 1 + (1 -t)Z 0 for &#8704;t &#8712; [0, 1], or equivalently v(Z t , t) = Z 1 -Z 0 = const following each path. (More precisely, "straight" here refers to straight with a constant speed.) Such straight flows are highly attractive computationally as it is effective a one-step model: a single Euler step update Z 1 = Z 0 + v(Z 0 , 0) calculates the exact Z 1 from Z 0 . Note that the linear interpolation X = {X t } is straight by this definition but it is not a (causal) flow and hence can not be simulated without an oracle assess to draws of both &#960; 0 and &#960; 1 .</p><p>In comparison, it is non-trivial to make a flow dZ t = v(Z t , t)dt straight, because if so v must satisfy the inviscid Burgers' equation</p><p>More generally, we can measure the straightness of any continuously differentiable process Z = {Z t } by</p><p>S(Z) = 0 means exact straightness. A flow whose S(Z) is small has nearly straight paths and hence can be simulated accurately using numerical solvers with a small number of discretization steps. Section 3.3 shows that applying rectification recursively provably decreases S(Z) towards zero.</p><p>[Theorem 3.7] Let Z k be the k-th rectified flow induced from (X 0 , X 1 ). Then</p><p>As shown Figure <ref type="figure">1</ref>, applying one step of reflow can already provide nearly straight flows that yield good performance when simulated with a single Euler step. It is not recommended to apply too many reflow steps as it may accumulate estimation error on v X .</p><p>Distillation After obtaining the k-th rectified flow Z k , we can further improve the inference speed by distilling the relation of (Z k 0 , Z k 1 ) into a neural network T to directly predict Z k 1 from Z k 0 without simulating the flow. Given that the flow is already nearly straight (and hence well approximated by the one-step update), and the distillation can be done efficiently. In particular, if we take T (z 0 ) = z 0 + v(z 0 , 0), then the loss function for distilling</p><p>2 , which is the term in (1) when t = 0.</p><p>We should highlight the difference between distillation and rectification: distillation attempts to faithfully approximate the coupling (Z k 0 , Z k 1 ) while rectification yields a different coupling</p><p>) with lower transport cost and more straight flow. Hence, distillation should be applied only in the final stage when we want to fine-tune the model for fast one-step inference.</p><p>On the velocity field v X If X 0 yields a conditional density function &#961;(x 0 | x 1 ) when conditioned on</p><p>where the expectation E [&#8226;] is taken w.r.t. X 1 &#8764; &#960; 1 . This can be seen by noting that X 0 = z-tX 1 1-t and X 1 -X 0 = X 1 -z 1-t , when conditioned on X t = z. Hence, if &#961; is positive and continuous everywhere, then v X is well defined and continuous on R d &#215; [0, 1). Further, if log &#951; t is continuously differentiable w.r.t. z, we can show that</p><p>If X 0 |X 1 = x 1 does not yield a conditional density function, v X (z, t) may be undefined or discontinuous, making the ODE dZ t = v X (Z t , t)dt ill-behaved. A simple fix is to add X 0 with a Gaussian noise &#958; &#8764; N (0, &#963; 2 I) independent of (X 0 , X 1 ) to yield a smoothed variable X0 = X 0 + &#958;, and transfer X0 to X 1 using rectified flow. This would effectively give a randomized mapping of form T (X 0 + &#958;) transporting &#960; 0 to &#960; 1 .</p><p>Smooth function approximation Following (4), we can exactly calculate v X if the conditional density function &#961;(&#8226;|x 1 ) exists and is known, and &#960; 1 is the empirical measure of a finite number of points (whose expectation can be evaluated exactly). In this case, running the rectified flow forwardly would precisely recover the points in &#960; 1 . This, however, is not practically useful in most cases as it completely overfits the data. Hence, it is both necessary and beneficial to fit v X with a smooth function approximator such as neural network or non-parametric models, to obtain smoothed distributions with novel samples that are practically useful.</p><p>Deep neural networks are no doubt the best function approximators for large scale problems. For low dimensional problems, the following simple Nadaraya-Watson style non-parametric estimator of v X can yield a good approximation to the exact rectified flow without knowing the conditional density &#961;:</p><p>where</p><p>, and &#954; h (x, z) is a smoothing kernel with a bandwith parameter h &gt; 0 that measures the similarity between z and x. Taking the Gaussian RBF kernel</p><p>). On points z that X t can not attain, v X,h (z, t) extrapolates the value by finding the X t that is close to z. In practice, we replace the expectations in ( <ref type="formula">5</ref>) with empirical averaging. We find that v X,h performs well in practice because it is a mixture of linear functions that always point to a point in the support of &#960; 1 .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.3">A Nonlinear Extension</head><p>We present a nonlinear extension of rectified flow in which the linear interpolation X t is replaced by any time-differentiable curve connecting X 0 and X 1 . Such generalized rectified flows can still transport &#960; 0 to &#960; 1 (Theorem 3.3), but no longer guarantee to decrease convex transport costs, or have the straightening effect. Importantly, the method of probability flows <ref type="bibr">[73]</ref> and DDIM <ref type="bibr">[70]</ref> can be viewed (approximately) as special cases of this framework, allows us to clarify the connection with and the advantages over these methods.</p><p>Let X = {X t : t &#8712; [0, 1]} be any time-differentiable random process that connects X 0 and X 1 . Let &#7818;t be the time derivative of X t . The (nonlinear) rectified flow induced from X is defined as</p><p>We can estimate v X by solving</p><p>where w t : (0, 1) &#8594; (0, +&#8734;) is a positive weighting sequence (w t = 1 by default). When using the linear interpolation X t = tX 1 + (1 -t)X 0 , we have &#7818;t = X 1 -X 0 and ( <ref type="formula">6</ref>) with w t = 1 reduces to (1). As we show in Theorem 3.3, the flow Z given by this method still preserves the marginal laws of X, that is,</p><p>and hence (Z 0 , Z 1 ) remains to be a coupling of &#960; 0 , &#960; 1 . However, if X is not straight, (Z 0 , Z 1 ) no longer guarantees to decrease the convex transport costs over (X 0 , X 1 ). More importantly, the reflow procedure no longer straightens the paths of Z t .</p><p>A simple class of interpolation processes is X t = &#945; t X 1 + &#946; t X 0 where &#945; t and &#946; t are two differentiable sequences that satisfy &#945; 1 = &#946; 0 = 1 and &#945; 0 = &#946; 1 = 0 to ensure that the process equals X 0 , X 1 at the starting and end points. In this case, we have &#7818;t = &#945;t X 1 + &#946;t X 0 in <ref type="bibr">(6)</ref> where &#945;t and &#946;t are the time derivatives of &#945; t and &#946; t . The shape of the curve is controlled by the relation of &#945; t and &#946; t . If we take &#946; t = 1 -&#945; t for all t, then X t have straight paths but does not travel at a constant speed; it can be viewed as a time-changed variant of the canonical case X t = tX 1 + (1 -t)X 0 when t is reparameterized to &#945; t . When &#946; t = 1 -&#945; t , the paths of X t are not straight lines except some special cases (e.g., &#945;t X 1 = 0 or &#946;t X 0 = 0, or X 1 = aX 1 for some a &#8712; R).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.3.1">Probability Flow ODEs and DDIM</head><p>The probability flow ODEs (PF-ODEs) <ref type="bibr">[73]</ref> and denoising diffusion implicit models (DDIM) <ref type="bibr">[70]</ref> are methods for learning ODE-based generative models of &#960; 1 from a spherical Gaussian initial distribution &#960; 0 , derived by converting a SDE learned by denoising diffusion methods to an ODE with equivalent marginal laws. In <ref type="bibr">[73]</ref>, three types of PF-ODEs are derived from three types of SDEs learned as score-based generative models, including variance-exploding (VE) SDE, variance-preserving (VP) SDE, and sub-VP SDE, which we denote by VE ODE, VP ODE, and sub-VP ODE, respectively. VP ODE is equivalent to the continuous time limit of DDIM, which is derived from the denoising diffusion probability model (DDPM) <ref type="bibr">[23]</ref>. As the derivations of PF-ODEs and DDIM require advanced tools in stochastic calculus, we limit our discussion on the final algorithmic procedures suggested in <ref type="bibr">[73,</ref><ref type="bibr">23]</ref>, which we summarize in Section 3.5.</p><p>The readers are referred to <ref type="bibr">[73,</ref><ref type="bibr">70]</ref> for the details.</p><p>[Proposition 3.11] All variants of PF-ODEs can be viewed as instances of (6) when using X t = &#945; t X 1 + &#946; t &#958; for some &#945; t , &#946; t with &#945; 1 = 1, &#946; 1 = 0, where &#958; &#8764; N (0, I) is a standard Gaussian random variable.</p><p>Here we need to use introduce &#958; to replace X 0 because the choices of &#945; t and &#946; t suggested in <ref type="bibr">[73,</ref><ref type="bibr">70,</ref><ref type="bibr">23]</ref> do not satisfy the boundary condition of &#945; 0 = 0 and &#946; 0 = 1 at t = 0, and hence X 0 = &#958;. Instead, in these methods, the initial distribution X 0 &#8764; &#960; 0 is implicitly defined as X 0 = &#945; 0 X 1 + &#946; 0 &#958;, which is approximated by X 0 &#8776; &#946; 0 &#958; by making &#945; 0 X 1 &#946; 0 &#958;. Hence, &#960; 0 is set to be N (0, &#946; 2 0 I) in these methods. Viewed through our framework, there is no reason to restrict &#958; to be N (0, &#946; 2 0 I), or not set &#945; 0 = 0, &#946; 0 = 1 to avoid the approximation. VP ODE and sub-VP ODE The VP ODE and sub-VP ODE of <ref type="bibr">[73]</ref> use the following shared &#945; t :</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Rectified flow VP ODE sub-VP ODE (&#945;</head><p>(sub-)VP ODE: where the default values of a, b are chosen to match the continuous time limit of the shared training procedure of DDIM and DDPM. The difference of VP ODE and sub-VP ODE is on the choice of &#946; t , given as follows:</p><p>VP ODE:</p><p>As &#946; 0 &#8776; 1 in both VP and sub-VP ODE, the &#960; 0 in both cases are taken as N (0, I).</p><p>The choices of &#945; t , &#946; t above are the consequence of the SDE-based derivation in <ref type="bibr">[73]</ref>. However, they are not well-motivated when we exam the path properties of the induced ODEs:</p><p>&#8226; Non-straight paths: Due to choices of &#946; t in (8), the trajectories of VP ODE and sub-VP ODE are curved in general, and can not be straightened by the reflow procedure. We should choose &#946; t = 1 -&#945; t to induce straight paths. &#8226; Non-uniform speed: The exponential form of &#945; t in ( <ref type="formula">7</ref>) is a consequence of using Ornstein-Uhlenbeck processes in the derivation of SDE models <ref type="bibr">[73,</ref><ref type="bibr">23]</ref>. However, there is no clear advantage of using <ref type="bibr">(7)</ref> for ODEs. As shown in Figure <ref type="figure">5</ref>, the &#945; t and &#946; t of VP and sub-VP ODE change slowly in the early phase (t 0.5). As a result, the flow also moves slowly in beginning and hence most of the updates are concentrated in the later phase. Such non-uniform update speed, in addition to the non-straight paths, make VP ODE and sub-VP ODE perform sub-optimally when using large step sizes, even for transport between simple spherical Gaussian distributions (see Figure <ref type="figure">5</ref>). As we show in the last column of Figure <ref type="figure">5</ref>, changing the exponential &#945; t to the linear function &#945; t = t in VP ODE allows us to get a uniform update speed while preserving the same continuoustime trajectories.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VE ODE</head><p>The VE ODE of <ref type="bibr">[73]</ref> uses &#945; t = 1 and &#946; t = &#963; min r 2(1-t) -1 where &#963; min = 0.01 by default r is set such that &#963; max := r&#963; min is as large as the maximum Euclidean distance between all pairs of training data points from &#960; 1 (Technique 1 of <ref type="bibr">[72]</ref>). Assume that &#963; 2 max is much larger than both &#963; 2 min and the variance of X 1 , then X 0 = X 1 + &#946; 0 &#958; &#8776; &#963; max &#958;, and we can set the initial distribution to be &#960; 0 &#8764; N (0, &#963; 2 max I), which has much larger variance than &#960; 1 . Hence, VE ODE can not be applied to (and not shown in) the toys in Figure <ref type="figure">4</ref> and Figure <ref type="figure">5</ref>. As the case of (sub-)VP ODE, the restriction on &#958; is in fact unnecessary and requirement that &#963; max is unnatural viewed from our framework. On the other hand, the trajectories of X t in VE ODE are indeed straight lines, because the direction of &#7818;t = &#946;t &#958; is always the same as &#958;. However, the choice of &#946; t causes a non-uniform speed issue similar to that of (sub-)VP ODE.</p><p>Following <ref type="bibr">[73,</ref><ref type="bibr">23]</ref>, a line of works have been proposed to improve the choices of &#945; t , &#946; t , but remain to be constrained by the basic design space from the SDE-to-ODE derivation; see for example <ref type="bibr">[54,</ref><ref type="bibr">29,</ref><ref type="bibr">95]</ref>.</p><p>To summarize, the simple nonlinear rectified flow framework in (6) both simplifies and extends the existing framework, and sheds a number of importance insights:</p><p>&#8226; Learning ODEs can be considered directly and independently without resorting to diffusion/SDE methods;</p><p>&#8226; The paths of the learned ODEs can be specified by any smooth interpolation curve X t of X 0 and X 1 ;</p><p>&#8226; The initial distribution &#960; 0 can be chosen arbitrarily, independent with the choice of the interpolation X t .</p><p>&#8226; The canonical linear interpolation X t = tX 1 + (1 -t)X 0 should be recommended as a default choice.</p><p>On the other hand, non-linear choices of X t can be useful when we want to incorporate certain non-Euclidan geometry structure of the variable, or want to place certain constraints on the trajectories of the ODEs. We leave this for future works.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Theoretical Analysis</head><p>We present the theoretical analysis for rectified flow. The results are summarized as follows.</p><p>&#8226; [Section 3.1] All nonlinear rectified flows with any interpolation X t preserve the marginal laws.</p><p>&#8226; [Section 3.2] The rectified flow (with the canonical linear interpolation) reduces convex transport costs.</p><p>&#8226; [Section 3.3] Reflow guarantees to straighten the (linear) rectified flows.</p><p>&#8226; [ <ref type="bibr">Section 3.4]</ref> We clarify the relation between straight couplings and c-optimal couplings.</p><p>&#8226; [Section 3.5] We establish PF-ODEs as instances of nonlinear rectified flows.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1">The Marginal Preserving Property</head><p>The marginal preserving property that Law(Z t ) = Law(X t ) for &#8704;t is a general property of the nonlinear rectified flows in <ref type="bibr">(6)</ref>, regardless whether the interpolation X t is straight or not. Definition 3.1. For a path-wise continuously differentiable random process X = {X t : t &#8712; [0, 1]}, its expected velocity v X is defined as</p><p>For x &#8712; supp(X t ), the conditional expectation is not defined and we set v X arbitrarily, say v X (x, t) = 0. Definition 3.2. We call that X is rectifiable if v X is locally bounded and the solution of the integral equation below exists and is unique:</p><p>In this case, Z = {Z t : t &#8712; [0, 1]} is called the rectified flow induced from X.</p><p>Theorem 3.3. Assume X is rectifiable and Z is its rectified flow. Then Law(Z t ) = Law(X t ) for &#8704;t &#8712; [0, 1].</p><p>Proof. For any compactly supported continuously differentiable test function h : R d &#8594; R, we have</p><p>where we used v X (X</p><p>By definition, this is equivalent to that &#960; t := Law(X t ) solves in the sense of distributions the continuity equation with drift v X t := v X (&#8226;, t):</p><p>To see the equivalence of ( <ref type="formula">10</ref>) and ( <ref type="formula">11</ref>), we can multiply <ref type="bibr">(11)</ref> with h and integrate both sides:</p><p>where we use integration by parts that h&#8711;</p><p>. Because Z t is driven by the same velocity field v X , its marginal law Law(Z t ) solves the very same equation with the same initial condition (Z 0 = X 0 ). Hence, the equivalence of Law(Z t ) and Law(X t ) follows if the solution of ( <ref type="formula">11</ref>) is unique, which is equivalent to the uniqueness of the solution of dZ t = v X (Z t , t) following Corollary 1.3 of Kurtz <ref type="bibr">[37]</ref> (see also Theorem 4.1 of Ambrosio and Crippa <ref type="bibr">[1]</ref>).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2">Reducing Convex Transport Costs</head><p>The fact that (Z 0 , Z 1 ) yields no larger convex transport costs than (X 0 , X 1 ) is a consequence of using the special linear interpolation X t = tX 1 + (1 -t)X 0 as the geodesic of Euclidean space. Definition 3.4. A coupling (X 0 , X 1 ) is called rectifiable if its linear interpolation process <ref type="formula">9</ref>) is called the rectified flow of coupling (X 0 , X 1 ), denoted as Z = RectFlow((X 0 , X 1 )), and (Z 0 , Z 1 ) is called the rectified coupling of (X 0 , X 1 ), denoted as (Z 0 , Z 1 ) = Rectify((X 0 , X 1 )).</p><p>Theorem 3.5. Assume (X 0 , X 1 ) is rectifiable and (Z 0 , Z 1 ) = Rectify((X 0 , X 1 )). Then for any convex function c : R d &#8594; R, we have</p><p>Proof. The proof is based on elementary applications of Jensen's inequality.</p><p>//X t and Z t shares the same marginals</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3">The Straightening Effect</head><p>A coupling (X 0 , X 1 ) is said to be straight (or fully rectified) if it is a fixed point of the Rectify(&#8226;) mapping.</p><p>It is desirable to obtain a straight coupling because its rectified flow is straight and hence can be simulated exactly with one step using numerical solvers. In this section, we first characterize the basic properties of straight couplings, showing that a coupling is straight iff its linear interpolation paths do not intersect with each other. Then, we prove that recursive rectification straightens the coupling and its related flow with a O(1/k) rate, where k is the number of rectification steps.</p><p>Theorem 3.6. Assume (X 0 , X 1 ) is rectifiable. Let X t = tX 1 + (1 -t)X 0 and Z = RectFlow((X 0 , X 1 )).</p><p>Then (X 0 , X 1 ) is a straight coupling iff the following equivalent statements hold.</p><p>1. There exists a strictly convex function c :</p><p>3. The rectified flow coincides with the linear interpolation process: X = Z.</p><p>4. The paths of the linear interpolation X do not intersect:</p><p>where V ((X 0 , X</p><p>), meaning that the lines passing through each X t is unique, and hence no linear interpolation paths intersect.</p><p>Proof. 3 &#8594; 2 &#8594; 1: Obvious.</p><p>the two applications of Jensen's inequality in the proof of Theorem 3.5 are tight. Because c is strictly convex, the second Jensen's inequality in the proof implies that</p><p>Because Z satisfies the same equation ( <ref type="formula">9</ref>), we have X = Z by the uniqueness of the solution.</p><p>O(1/K) convergence rate We now show that as we apply rectification recursively, the rectified flows become increasingly straight and the linear interpolation of the couplings becomes increasingly non-intersecting.</p><p>Proof. Taking c(x) = x 2 in the proof of Theorem 3.5, we can obtain that</p><p>Applying it to each rectification step yields</p><p>A telescoping sum on k = 0, . . . , K gives the result.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.4">Straight vs. Optimal Couplings</head><p>A coupling (X 0 , X 1 ) is called c-optimal if it achieves the minimum of E[c(X 1 -X 0 )] among all couplings that share the same marginals. Understanding and computing the optimal couplings have been the main focus of optimal transport [e.g., <ref type="bibr">84,</ref><ref type="bibr">2,</ref><ref type="bibr">15,</ref><ref type="bibr">59]</ref>. Straight couplings is a different desirable property. In the following, we show that straightness is a necessary but not sufficient condition of being c-optimal for a strictly convex function c, except in the one dimensional case when the two concepts coincides. Hence, it is "easier" to find a straight coupling than a c-optimal couplings. Theorem 3.8. If a rectifiable coupling (X 0 , X 1 ) is c-optimal for some strictly convex cost function c, then (X 0 , X 1 ) is a straight coupling.</p><p>Proof. Let (Z 0 , Z 1 ) = Rectify((X 0 , X 1 )). If (X 0 , X 1 ) is c-optimal, we must have</p><p>]. This implies Statement 1 in Theorem 3.6 and hence that (X 0 , X 1 ) is straight.</p><p>1D Case For any &#960; 0 , &#960; 1 on R, there exists an unique coupling (X * 0 , X * 1 ) that is simultaneously optimal for all non-negative convex cost functions c. This coupling is uniquely characterized by a monotonic property: for every (x 0 , x 1 ) and (x 0 , x 1 ) in the support of (X * 0 , X * 1 ), if x 0 &lt; x 0 , then x 1 &#8804; x 1 . Furthermore, if &#960; 0 is absolutely continuously w.r.t. the Lebesgue measure, then (X * 0 , X * 1 ) must be deterministic in that there exists a mapping T : R &#8594; R such that X * 1 = T (X * 0 ). See <ref type="bibr">[65]</ref>. In the following, we show that straight couplings on R coincides with the deterministic monotonic coupling (X * 0 , X * 1 ) and hence is unique and simultaneously optimal for all convex c when &#960; 0 is absolutely continuous. The idea is that, in R, a coupling is monotonic iff its linear interpolation paths do not intersect, a characteristic feature of straight couplings. Lemma 3.9. A coupling on R is straight iff it is deterministic and monotonic. Theorem 3.10. For any &#960; 0 , &#960; 1 on R, there exists either no straight coupling, or a unique straight coupling. Further, if exists, the unique straight coupling is deterministic and monotonic, and jointly optimal w.r.t. all convex cost functions c : R d &#8594; [0, +&#8734;) for which the minimum value of E [c(X 1 -X 0 )] exists and is finite.</p><p>Proof of Lemma 3.9. If (X 0 , X 1 ) on R is straight, then it coincides with its rectified coupling (Z 0 , Z 1 ) = Rectify((X 0 , X 1 )). But because (Z 0 , Z 1 ) is induced from the rectified flow dZ t = v X (Z t , t)dt, it is obviously deterministic. It is also monotonic due to the non-crossing property of flows. Specifically, if (Z 0 , Z 1 ) is not monotonic, there exists (z 0 , z 1 ) and (z 0 , z 1 ) in the support of (Z 0 , Z 1 ) such that z 0 &lt; z 0 and z 1 &gt; z 1 . If this happens, there must exists t 0 &#8712; (0, 1), such that z t 0 = z t 0 . But by the uniqueness of the solution, we have z t = z t for t &#8805; t 0 , which is conflicting with z 1 &gt; z 1 .</p><p>Assume (X 0 , X 1 ) is deterministic and monotonic. Due to the monotonicity, there exists no x 0 and x 0 in the support of &#960; 0 , such that x 0 = x 0 and x t 0 = x t 0 for some t 0 &lt; 1. This suggests that X 1 -X 0 = E[X 1 -X 0 | X t ] = v X (X t , t) for t &#8712; (0, 1), and hence dX t = (X 1 -X 0 )dt = v X (X t )dt, which is the ODE of the rectified flow. In addition, X t is obviously the unique solution of this ODE. Hence (X 0 , X 1 ) is rectifiable and straight following Statement 3 of Theorem 3.6.</p><p>Proof of Theorem 3.10. This is the result of Lemma 3.9 combined with the fact that the monotonic coupling is unique and jointly optimal for all convex c for which the optimal coupling exists, following Lemma 2.8 and Theorem 2.9 of <ref type="bibr">[65]</ref>.</p><p>Multi-dimensional cases On the other hand, on R d with d &#8805; 2, the different cost functions c do not share a common optimal coupling in general, and a straight coupling is not guaranteed to optimize a specific c; this is expected because the Rectify(&#8226;) procedure does not depend on a particular choice of c. Hence, one must modify the Rectify(&#8226;) procedure to tailor it to a specific c of interest.</p><p>In a recent work <ref type="bibr">[30]</ref>, it was conjectured that the couplings (Z 0 , Z 1 ) induced from VP ODE (equivalently DDIM) yields an optimal coupling w.r.t. the quadratic loss, which was proved to be false in <ref type="bibr">[39,</ref><ref type="bibr">78]</ref>. Here we show that even straight couplings are not guaranteed to be optimal, not to mention that VP ODE does not follow straight paths by design.</p><p>We explore this in a separate work <ref type="bibr">[42]</ref> that is devoted to modifying rectified flow to find c-optimal couplings; a result from <ref type="bibr">[42]</ref> that can be easily stated is that the optimal coupling w.r.t. the quadratic cost c(&#8226;) = &#8226; 2 can be achieved as the fixed point of Rectify(&#8226;) if v is restricted to be a gradient field of form v(x, t) = &#8711;f (x, t) when solving <ref type="bibr">(1)</ref>. Restricting v to be a gradient field removes the rotational component of the velocity field v X that causes sub-optimal transport cost.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.5">Denoising Diffusion Models and Probability Flow ODEs</head><p>We prove that the probability flow ODEs (PF-ODEs) of <ref type="bibr">[73]</ref> can be viewed as nonlinear rectified flows in <ref type="bibr">(6)</ref> with X t = &#945; t X 1 + &#946; t &#958;. We start with introducing the algorithmic procedures of the denoising diffusion models and PF-ODEs, and refer the readers to the original works <ref type="bibr">[73,</ref><ref type="bibr">23,</ref><ref type="bibr">70]</ref> for the theoretical derivations.</p><p>The denoising diffusion methods learn to generative models by constructing an SDE model driven by a standard Brownian motion W t :</p><p>where &#963; t : [0, 1] &#8594; [0, +&#8734;) is a (typically) fixed diffusion coefficient, b is a trainable neural network, and the initial distribution &#960; 0 is restricted to a spherical Gaussian distribution determined by hyper-parameter setting of the algorithm. The idea is to first collapse the data into an (approximate) Gaussian distribution using a diffusion process, mostly an Ornstein-Uhlenbeck (OU) process, and then estimate the generative diffusion process ( <ref type="formula">14</ref>) as the time reversal [e.g., 3] of the collapsing process.</p><p>Without diving into the derivations, the training loss of the VE, VP, sub-VP SDEs for b in <ref type="bibr">[73]</ref> can be summarized as follows:</p><p>where &#958; t is a diffusion process satisfying &#958; t &#8764; N (0, I), and &#951; t , &#963; t are the hyper-parameter sequences of the algorithm, and &#945; t , &#946; t are determined by &#951; t , &#963; t via</p><p>The relation in ( <ref type="formula">16</ref>) is derived to make</p><p>VE SDE, which is equivalent to SMLD in <ref type="bibr">[71,</ref><ref type="bibr">72]</ref>, takes &#951; t = 0 and hence has &#945; t = 1. (sub-)VP SDE takes &#951; s to be a linear function of s, yielding the exponential &#945; t in <ref type="bibr">(7)</ref>. VP SDE (which is equivalent to DDPM <ref type="bibr">[23]</ref>) takes &#951; t = -1 2 &#963; 2 t which yields that &#945; 2 t + &#946; 2 t = 1 as shown in <ref type="bibr">(8)</ref>. In DDPM, it was suggested to write b(x, t) = -&#951; t x -&#963; 2 t &#946;t (x, t) , and estimate as a neural network that predicts &#958; t from (V t , t). Theoretically, the SDE in ( <ref type="formula">14</ref>) with b solving (15) is ensured to yield Law(U 1 ) = Law(X 1 ) = &#960; 1 when initialized from U 0 = &#945; 0 X 1 + &#946; 0 &#958; 0 , which can be approximated by U 0 &#8776; &#946;&#958; 0 when &#945; 0 X 1 &#946; 0 &#958; 0 .</p><p>By using the properties of Fokker-Planck equations, it was observed in <ref type="bibr">[73,</ref><ref type="bibr">70]</ref> that the SDE in ( <ref type="formula">14</ref>) with b trained in <ref type="bibr">(15)</ref> can be converted into an ODE that share the same marginal laws:</p><p>Equivalently, we can regard b as the solution of</p><p>which defers from ( <ref type="formula">14</ref>) only by a factor of 1/2 in the second term of Y t . This simple equivalence holds only when ( <ref type="formula">14</ref>) and ( <ref type="formula">17</ref>) use the special initialization of</p><p>In the following, we are ready to prove that ( <ref type="formula">18</ref>) is can be viewed as the nonlinear rectified flow objective in (6) using X t = &#945; t X 1 + &#946; t &#958; with &#958; &#8764; N (0, I). We mainly need to show that &#7928;t is equivalent to &#7818;t by eliminating &#951; t and &#963; t using the relation in <ref type="bibr">(16)</ref>.</p><p>Proposition 3.11. Assume (16) hold. Then (18) is equivalent to (6) with X t = &#945; t X 1 + &#946; t &#958;.</p><p>Proof. First, note that we can take &#958; t = &#958; for all time t, as the correlation structure of &#958; t does not impact the result. Hence, we have V t = X t = &#945; t X 1 + &#946; t &#958;. To show the equivalence of ( <ref type="formula">18</ref>) and ( <ref type="formula">6</ref>), we just need to verify that &#7818;t = &#7928;t .</p><p>where in</p><p>= we used that &#951; t = -&#945;t &#945;t and &#963; 2 t = 2&#946; 2 t &#945;t &#945;t -&#946;t &#946;t which can be derived from ( <ref type="formula">16</ref>).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">Related Works and Discussion</head><p>Learning one-step models GANs <ref type="bibr">[19,</ref><ref type="bibr">4,</ref><ref type="bibr">43]</ref>, VAEs <ref type="bibr">[32]</ref>, and (discrete-time) normalizing flows <ref type="bibr">[62,</ref><ref type="bibr">13,</ref><ref type="bibr">14]</ref> have been three classical approaches for learning deep generative models. GANs have been most successful in terms of generation qualities (for images in particular), but suffer from the notorious training instability and mode collapse issues due to use of minimax updates. VAEs and normalizing flows are both trained based on the principle of maximum likelihood estimation (MLE) and need to introduce constraints on the model architecture and/or special approximation techniques to ensure tractable likelihood computation: VAEs typically use a conditional Gaussian distribution in addition to the variational approximation of the likelihood; normalizing flows require to use specially designed invertible architectures and need to copy with calculating expensive Jacobian matrices.</p><p>The reflow+distillation approach in this work provides another promising approach to training one-step models, avoiding the minimax issues of GANs and the intractability issues of the likelihood-based methods.</p><p>Learning ODEs: MLE and PF-ODEs There are two major approaches for learning neural ODEs: the PF-ODEs/DDIM approach discussed in Section 2.3, and the more classical MLE based approach of <ref type="bibr">[6]</ref>.</p><p>&#8226; The MLE approach. In <ref type="bibr">[6]</ref>, neural ODEs are trained for learning generative models by maximizing the likelihood of the distribution of the ODE outcome Z 1 at time t = 1 under the data distribution &#960; 1 . Specifically, with observations from &#960; 1 , it estimates a neural drift v of an ODE dZ t = v(Z t , t)dt by</p><p>where D(&#8226;; &#8226;) denotes KL divergence (or other discrepancy measures), and &#961; v,&#960; 0 is the density of Z 1 following dZ t = v(Z t , t)dt from Z 0 &#8764; &#960; 0 ; the density of &#960; 0 should be known and tractable to calculate.</p><p>By using an instantaneous change of variables formula, it was observed in <ref type="bibr">[6]</ref> that the likelihood of neural ODEs are easier to compute than the discrete-time normalizing flow without constraints on the model structures. However, this MLE approach is still computationally expensive for large scale models as it requires repeated simulation of the ODE during each training step. In addition, as the optimization procedure of MLE requires to backpropagate through time, it can easily suffer the gradient vanishing/exploding problem unless proper regularization is added.</p><p>Another fundamental problem is that the MLE ( <ref type="formula">19</ref>) of neural ODEs is theoretically under-specified, because MLE only concerns matching the law of the final outcome Z 1 with the data distribution &#960; 1 , and there are infinitely many ODEs to achieve the same output law of Z 1 while traveling through different paths. A number of works have been proposed to remedy this by adding regularization terms, such as these based on transport costs, to favor shorter paths; see <ref type="bibr">[54,</ref><ref type="bibr">55]</ref>. With a regularization term, the ODE learned by MLE would be implicitly determined by the initialization and other hyper-parameters of the optimizer used to solve <ref type="bibr">(19)</ref>.</p><p>&#8226; Probability Flow ODEs. The method of PF-ODEs <ref type="bibr">[73]</ref> and DDIM <ref type="bibr">[70]</ref> provides a different approach to learning ODEs that avoids the main disadvantages of the MLE approach, including the expensive likelihood calculation, training-time simulation of the ODE models, and the need of backpropagation through time. However, because PF-ODEs and DDIM were derived as the side product of learning the mathematically more involved diffusion/SDE models, their theories and algorithm forms were made unnecessarily restrictive and complicated. The nonlinear rectified flow framework shows that the learning of ODEs can be approached directly in a very simple way, allowing us to identify the canonical case of linear rectified flow and open the door of further improvements with flexible and decoupled choices of the interpolation curves X t and initial distributions &#960; 0 .</p><p>Viewed through the general non-linear rectified flow framework, the computational and theoretical drawbacks of MLE can be avoided because we can simply pre-determines the "roads" that the ODEs should travel through by specifying the interpolation curve X t , rather than leaving it for the algorithm to figure out implicitly. It is theoretically valid to pre-specify any interpolation X t because the neural ODE is highly over-parameterized as a generative model: when v is a universal approximator and &#960; 0 is absolutely continuous, the distribution of Z 1 can approximate any distribution given any fixed interpolation curve X t . The idea of rectified flow is to the simplest geodesic paths for X t .</p><p>Learning SDEs with denoising diffusion Although the scope of this work is limited to learning ODEs, the score-based generative models <ref type="bibr">[71]</ref><ref type="bibr">[72]</ref><ref type="bibr">[73]</ref><ref type="bibr">[74]</ref> and denoising diffusion probability models (DDPM) <ref type="bibr">[23]</ref> are of high relevance as the basis of PF-ODEs and DDIM. The diffusion/SDE models trained with these methods have been found outperforming GANs in image synthesis in both quality and diversity <ref type="bibr">[12]</ref>. Notably, thanks to the stable and scalable optimization-based training procedure, the diffusion models have successfully used in huge text-to-image generation models with astonishing results [e.g., <ref type="bibr">53,</ref><ref type="bibr">61,</ref><ref type="bibr">64]</ref>. It has been quickly popularized in other domains, such as video [e.g., <ref type="bibr">24,</ref><ref type="bibr">92,</ref><ref type="bibr">21]</ref>, music <ref type="bibr">[51]</ref>, audio [e.g., <ref type="bibr">33,</ref><ref type="bibr">40,</ref><ref type="bibr">60]</ref>, and text <ref type="bibr">[41,</ref><ref type="bibr">88]</ref>, and more tasks such as image editing <ref type="bibr">[97,</ref><ref type="bibr">50]</ref>. A growing literature has been developed for improving the inference speed of denoising diffusion models, an example of which is the PF-ODEs/DDIM approach which gains speedup by turning SDEs into ODEs. We provide below some examples of recent works, which is by no mean exhaustive.</p><p>&#8226; Improved training and inference. A line of works focus on improving the inference and sampling procedure of denoising diffusion models. For example, <ref type="bibr">[54]</ref> presents a few simple modifications of DDPM to improve the likelihood, sampling speed, and generation quality. <ref type="bibr">[29]</ref> systematic exams the design space of diffusion generative models with empirical studies and identifies a number of training and inference recipes for better generative quality with fewer sampling steps. <ref type="bibr">[94]</ref> proposes a diffusion exponential integrator sampler for fast sampling of diffusion models. <ref type="bibr">[46]</ref> provides a customized high order solver for PF-ODEs.</p><p>[5] provides an analytic estimate of the optimal diffusion coefficient.</p><p>&#8226; Combination with other methods. Another direction is to speed up diffusion models by combining them with GANs and other generative models. DDPM Distillation <ref type="bibr">[47]</ref> accelerates the inference speed by distilling the trajectories of a diffusion model into a series of conditional GANs. The truncated diffusion probabilistic model (TDPM) of <ref type="bibr">[99]</ref> trains a GAN model as &#960; 0 so that the diffusion process can be truncated to improve the speed; the similar idea was explored in <ref type="bibr">[48,</ref><ref type="bibr">18]</ref>, and <ref type="bibr">[18]</ref> provides an analysis on the optimal truncation time. <ref type="bibr">[68,</ref><ref type="bibr">89,</ref><ref type="bibr">81]</ref> learns a denoising diffusion model in the latent spaces and combines it with variational auto-encoders. These methods can be potentially applied to rectified flow to gain similar speedups for learning neural ODEs.</p><p>&#8226; Unpaired Image-to-Image translation. The standard denoising diffusion and PF-ODEs methods focus on the generative task of transferring a Gaussian noise (&#960; 0 ) to the data (&#960; 1 ). A number of works have been proposed to adapt it to transferring data between arbitrary pairs of source-target domains. For example, SDEdit <ref type="bibr">[50]</ref> synthesizes realistic images guided by an input image by first adding noising to the input and then denoising the resulting image through a pre-trained SDE model. <ref type="bibr">[8]</ref> proposes a method to guide the generative process of DDPM to generate realistic images based on a given reference image. <ref type="bibr">[75]</ref> leverages two two PF-ODEs for image translation, one translating source images to a latent variable, and the other constructing the target images from the latent variable. <ref type="bibr">[97]</ref> proposes an energy-guided approach that employs an energy function pre-trained on the source and target domains to guide the inference process of a pretrained SDE for better image translation. In comparison, our framework shows that domain transfer can be achieved by essentially the same algorithm as generative modeling, by simply setting &#960; 0 to be the source domain.</p><p>&#8226; Diffusion bridges. Some recent works <ref type="bibr">[57,</ref><ref type="bibr">44]</ref> show that the design space of denoising diffusion models can be made highly flexible with the assistant of diffusion bridge processes that are pinned to a fixed data point at the end time. This reduces the design of denoising diffusion methods to constructing a proper bridge processes. The bridges in Song et al. <ref type="bibr">[73]</ref> are constructed by a time-reversal technique, which can be equivalently achieved by Doob's h-transform as shown in <ref type="bibr">[57,</ref><ref type="bibr">44]</ref>, and more general construction techniques are discussed in <ref type="bibr">[44,</ref><ref type="bibr">90]</ref>. Despite the significantly extended design spaces, an unanswered question is what type of diffusion bridge processes should be preferred. This question is made challenging because the presence of diffusion noise and the need of advanced stochastic calculus tools make it hard to intuit how the methods work. By removing the diffusion noise, our work makes it clear that straight paths should be preferred. We expect that the idea can be extended to provide guidance on designing optimal bridge processes for learning SDEs.</p><p>&#8226; Schrodinger bridges. Another body of works <ref type="bibr">[87,</ref><ref type="bibr">11,</ref><ref type="bibr">7,</ref><ref type="bibr">82]</ref> leverages Schrodinger bridges (SB) as an alternative approach to learning diffusion generative models. These approaches are attractive theoretically, but casts significant computational challenges for solving the Schrodinger bridge problem.</p><p>Re-thinking the role of diffusion noise The introduction of diffusion noise was consider essential due to the key role it plays in the derivations of the successful methods <ref type="bibr">[73,</ref><ref type="bibr">23]</ref>. However, as rectified flow can achieve better or comparable results with a ODE-only framework, the role of diffusion mechanisms should be re-examed and clearly decoupled from the other merits of denoising diffusion models. The success of the denoising diffusion models may be mainly attributed to the simple and stable optimization-based training procedure that allows us to avoid the instability issues and the need of case-by-case tuning of GANs, rather than the presence of diffusion noises.</p><p>Because our work shows that there is no need to invoke SDE tools if the goal is to learn ODEs, the remaining question is whether we should learn an ODE or an SDE for a given problem. As already argued by a number of works <ref type="bibr">[73,</ref><ref type="bibr">70,</ref><ref type="bibr">29]</ref>, ODEs should be preferred over SDEs in general. Below is a detailed comparison between ODEs and SDEs.</p><p>&#8226; Conceptual simplicity and numerical speed. SDEs are more mathematically involved and are more difficult to understand. Numerical simulation of ODEs are simpler and faster than SDEs.</p><p>&#8226; Time reversibility. It is equally easy to solve the ODEs forwardly and backwardly. In comparison, the time reversal of SDEs [e.g., <ref type="bibr">3,</ref><ref type="bibr">22,</ref><ref type="bibr">17]</ref> is more involved theoretically and may not be computationally tractable.</p><p>&#8226; Latent spaces. The couplings (Z 0 , Z 1 ) of ODEs are deterministic and yield low transport cost in the case of rectified flows, hence providing a good latent space for representing and manipulating outputs. Introducing diffusion noises make (Z 0 , Z 1 ) more stochastic and hence less useful. In fact, the (Z 0 , Z 1 ) given by DDPM <ref type="bibr">[23]</ref> and the SDEs of <ref type="bibr">[73]</ref> and hence useless for latent presentation.</p><p>&#8226; Training difficulty. There is no reason to believe that training an ODE is harder, if not easier, than training an SDE sharing the same marginal laws: the training loss of both cases would share the distributions of covariant and differ only on the targets. In the setting of <ref type="bibr">[73]</ref>, the two loss functions ( <ref type="formula">15</ref>) and ( <ref type="formula">18</ref>) are equivalent upto a linear reparameterization.</p><p>&#8226; Expressive power. As every SDE can be converted into an ODE that has the same marginal distribution using the techniques in <ref type="bibr">[70,</ref><ref type="bibr">73]</ref> (see also <ref type="bibr">[84]</ref>), ODEs are as powerful as SDEs for representing marginal distributions, which is what needed for the transport mapping problems considered in this work. On the other hand, SDEs may be preferred if we need to capture richer time-correlation structures.</p><p>&#8226; Manifold data. When equipped with neural network drifts, the outputs of ODEs tend to fall into a smooth low dimensional manifold, a key inductive for structured data in AI such as images and text. In comparison, when using SDEs to model manifold data, one has to carefully anneal the diffusion noise to obtain smooth outcomes, which causes slow computation and a burden of hyperparameter tuning. SDEs might be more useful in for modeling highly noisy data in areas like finance and economics, and in areas that involve diffusion processes physically, such as molecule simulation.</p><p>Optimal vs. straight transport Optimal transport has been extensively explored in machine learning as a powerful way to compare and transfer between probability measures. For the transport mapping problem considered in this work, a natural approach is to finding the optimal coupling (Z 0 , Z 1 ) that minimizes a transport cost E[c(Z 1 -Z 0 )] for a given c. The most common choice of c is the quadratic cost c(&#8226;) = &#8226; 2 .</p><p>However, finding the optimal couplings, especially for high dimensional continuous measures, is highly challenging computationally and is the subject of active research; see for example <ref type="bibr">[67,</ref><ref type="bibr">34,</ref><ref type="bibr">35,</ref><ref type="bibr">49,</ref><ref type="bibr">63,</ref><ref type="bibr">10]</ref>. In addition, although the optimal couplings are known to have nice smoothness and other regularity properties, it is not necessary to accurately find the optimal coupling because the transport cost do not exactly align with the learning performance of individual problems; see e.g., <ref type="bibr">[34]</ref>.</p><p>In comparison, our reflow procedure finds a straight coupling, which is not optimal w.r.t. a given c (see Section 3.4). From the perspective of fast inference, all straight couplings are equally good because they all yield straight rectified flows and hence can be simulated with one Euler step.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Experiments</head><p>We start by studying the impact of reflow on toy examples. After that, we demonstrate that with multiple times of reflow, rectified flow achieves state-of-the-art performance on CIFAR-10. Moreover, it can also generate high-quality images on high-resolution image datasets. Going beyond unconditioned image generation, we apply our method to unpaired image-to-image translation tasks to generate visually high-quality image pairs.</p><p>Algorithm We follow the procedure in Algorithm 1. We start with drawing (X 0 , X 1 ) &#8764; &#960; 0 &#215; &#960; 1 and use it to get the first rectified flow Z 1 by minimizing <ref type="bibr">(1)</ref>. The second rectified flow Z 2 is obtained by the same procedure except with the data replaced by the draws from (Z 1 0 , Z 1 1 ), obtained by simulating the first rectified flow Z 1 . This process is repeated for k times to get the k-rectified flow Z k . Finally, we can further distill the k-rectified flow Z k into a one step model z 1 = z 0 + v(z 0 , 0) by fitting it on draws from (Z k 0 , Z k 1 ). By default, the ODEs are simulated using the vanilla Euler method with constant step size 1/N for N steps, that is, &#7824;t+1/N = &#7824;t + v( &#7824;t , t)/N for t &#8712; {0, . . . , N }/N . We use the Runge-Kutta method of order 5(4) from Scipy <ref type="bibr">[86]</ref>, denoted as RK45, which adaptively decide the step size and number of steps N based on user-specified relative and absolute tolerances. In our experiments, we stick to the same parameters as <ref type="bibr">[73]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1">Toy Examples</head><p>To accurately illustrate the theoretical properties, we use the non-parametric estimator v X,h (z, t) in ( <ref type="formula">5</ref>) in the toy examples in Figure <ref type="figure">2</ref>, 3, 4, 5. In practice, we approximate the expectation in <ref type="bibr">(5)</ref> an nearest neighbor estimator: given a sample {x</p><p>where knn(z, m) denotes the top m nearest neighbors of z in {x (i) t } i . We find that the results are not sensitive to the choice of m and the bandwidth h (see Figure <ref type="figure">7</ref>). We use h = 1 and m = 100 by default. The flows are simulated using Euler method with a constant step size of 1/N for N steps. We use N = 100 steps unless otherwise specified.</p><p>Alternatively, v X can be parameterized as a neural network and trained with stochastic gradient descent or Adam. Figure <ref type="figure">7</ref> shows an example of when v X is parameterized as an 2-hidden-layer fully connected neural network with 64 neurons in both hidden layers. We see that the neural networks fit less perfectly with the linear interpolation trajectories (which should be piece-wise linear in this toy example). As shown in Figure <ref type="figure">7</ref>, we find that enhancing the smoothness of the neural networks (by increasing the L2 regularization coefficient during training) can help straighten the flow, in addition to the rectification effect.  In Figure <ref type="figure">3</ref> of Section 2.2, the straightness is calculated as the empirical estimation of (3) based on the simulated trajectories. The relative transport cost is calculated based on {z</p><p>1 } n i=1 drawn from (Z 0 , Z 1 ) by simulating the flow, as</p><p>, where z</p><p>is the optimal L2 assignment of z (i) 0 obtained by solving the discrete L2 optimal transport problem between {z (i) 0 } and {z (i) 1 }. We should note that this metric is only useful in low dimensions, as it tends to be identically zero in high dimensional cases even v X is set to be a random neural network. This misleading phenomenon is what causes <ref type="bibr">[30]</ref> to make the false hypothesis that DDIM yields L2 optimal transport.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2">Unconditioned Image Generation</head><p>We test rectified flow for unconditioned image generation on CIAFR-10 and a number of high resolution datasets. The methods are evaluated by the quality of generated images by Fr&#233;chet inception distance (FID) and inception score (IS), and the diversity of the generated images by the recall score following <ref type="bibr">[38]</ref>.</p><p>Experiment settings For the purpose of generative modeling, we set &#960; 0 to be the standard Gaussian distribution and &#960; 1 the data distribution. Our implementation of rectified flow is modified upon the opensource code of <ref type="bibr">[73]</ref>. We adopt the U-Net architecture of DDPM++ <ref type="bibr">[73]</ref> for representing the drift v X , and report in Table <ref type="table">1</ref> (a) and Figure <ref type="figure">8</ref> the results of our method and the (sub)-VP ODE from <ref type="bibr">[73]</ref>      &#8226; Results on few and single step generation. As shown in Figure <ref type="figure">8</ref>, the reflow procedure substantially improves both FID and recall in the small step regime (e.g., N 80), even though it worsens the results in the large step regime due to the accumulation of error on estimating v x . Figure <ref type="figure">8</ref> (b) show that each reflow leads to a noticeable improvement in FID and recall. For one-step generation (N = 1), the results are further boosted by distillation (see the stars in Figure <ref type="figure">8</ref> (a)). Overall, the distilled k-Rectified Flow with k = 1, 2, 3 yield one-step generative models beating all previous ODEs with distillation; they also beat the reported results of one-step models with similar U-net type architectures trained using GANs (see the GAN with U-Net in Table <ref type="table">1</ref> (b)).</p><p>In particular, the distilled 2-rectified flow achieves an FID of 4.85, beating the best known one-step generative model with U-net architecture, 8.91 (TDPM, Table <ref type="table">1</ref> (b)). The recalls of both 2-rectified flow (0.50) and 3-rectified flow (0.51) outperform the best known results of GANs (0.49 from StyleGAN2+ADA) showing an advantage in diversity. We should note that the reported results of GANs have been carefully optimized with special techniques such as adaptive discriminator augmentation (ADA) <ref type="bibr">[28]</ref>, while our results are based on the vanilla implementation of rectified flow. It is likely to further improve rectified flow with proper data augmentation techniques, or the combination of GANs such as those proposed by TDPM <ref type="bibr">[99]</ref> and denoising diffusion GAN <ref type="bibr">[91]</ref>.</p><p>&#8226; Reflow straightens the flow. Figure <ref type="figure">9</ref> shows the reflow procedure decreases improves the straightness of the flow on CIFAR10. In Figure <ref type="figure">10</ref> visualizes the trajectories of 1-rectified flow and 2-rectified flow on the AFHQ cat dataset: at each point z t , we extrapolate the terminal value at t = 1 by &#7825;t 1 = z t + (1 -t)v(z t , t); if the trajectory of ODE follows a straight line, &#7825;t 1 should not change as we vary t when following the same path. We observe that &#7825;t 1 is almost independent with t for 2-rectified flow, showing the path is almost straight. Moreover, even though 1-rectified flow is not straight with &#7825;t 1 over time, it still yields recognizable and clear images very early (t &#8776; 0.1). In comparison, it is need t &#8776; 0.6 to get a clear image from the extrapolation of sub-VP ODE.</p><p>High-resolution image generation Figure <ref type="figure">11</ref> shows the result of 1-rectified flow on image generation on high-resolution (256 &#215; 256) datasets, including LSUN Bedroom <ref type="bibr">[93]</ref>, LSUN Church <ref type="bibr">[93]</ref>, CelebA HQ <ref type="bibr">[27]</ref> to AFHQ Cat <ref type="bibr">[9]</ref>. We can see that it can generate high quality results across the different datasets. Figure <ref type="figure">1</ref> &amp; 10 show that 1-(2-)rectified flow yields good results within one or few Euler steps.</p><p>Figure <ref type="figure">12</ref> shows a simple example of image editing using 1-rectified flow: We first obtain an unnatural image z 1 by stitching the upper and lower parts of two natural images, and then run 1-rectified flow backwards to get a latent code z 0 . We then modify z 0 to increase its likelihood under &#960; 0 (which is N (0, I)) to get more naturally looking variants of the stitched image.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.3">Image-to-Image Translation</head><p>Assume we are given two sets of images of different styles (a.k.a. domains), whose distributions are denoted by &#960; 0 , &#960; 1 , respectively. We are interested in transferring the style (or other key characteristics) of the images in one domain to the other domain, in the absence of paired examples. A classical approach to achieving this is cycle-consistent adversarial networks (a.k.a. CycleGAN) <ref type="bibr">[100,</ref><ref type="bibr">25]</ref>, which jointly learns a forward and backward mapping F, G by minimizing the sum of adversarial losses on the two domains, regularized by a cycle consistency loss to enforce F (G(x)) &#8776; x for all image x. By constructing the rectified flow of &#960; 0 and &#960; 1 , we obtain a simple approach to image translation that requires no adversarial optimization and cycle-consistency regularization: training the rectified flow requires a simple optimization procedure and the cycle consistency is automatically in flow models satisfied due to reversibility of ODEs.</p><p>As the main goal here is to obtain good visual results, we are not interested in faithfully transferring X 0 &#8764; &#960; 0 to an X 1 that exactly follows &#960; 1 . Rather, we are interested in transferring the image styles while preserving the identity of the main object in the image. For example, when transferring a human face image to a cat </p><p>The same random seed is adopted for all three methods. The &#7825;t 1 of 2-rectified flow is almost independent with t, indicating that its trajectory is almost straight.   <ref type="figure">12</ref>: An example of image editing using 1-rectified flow. Here, we stitch the images of a white cat and a black cat into an unnatural image (denoted as z 1 ). We simulate the ODE reversely from z 1 to get the latent code z 0 . Because z 1 is not a natural image, z 0 should have low likelihood under &#960; 0 = N (0, I). Hence, we move z 0 towards the high probability region of &#960; 0 to get z 0 and solve the ODE forwardly to get a more realistically looking image z 1 . The modification can be done deterministically by improving the &#960; 0 -likelihood via z 0 = &#945;z 0 with &#945; &#8712; (0, 1), or stochastically by Langevin dynamics, which yields a formula of z 0 = &#945;z 0 + &#8730; 1 -&#945; 2 &#958; with &#958; &#8764; N (0, I).</p><p>face, we are interested in getting a unrealistic face of human-cat hybrid that still "looks like" the original human face.</p><p>To achieve this, let h(x) be a feature mapping of image x representing the styles that we are interested in transferring. Let X t = tX 1 + (1 -t)X 0 . Then H t = h(X t ) follows an ODE of dH t = &#8711;h(X t ) (X 1 -X 0 )dt. Hence, to ensure that the style is transferred correctly, we propose to learn v such that H t = h(Z t ) with dZ t = v(Z t , t)dt approximates H t as much as possible. Because dH t = &#8711;h(Z t ) v(Z t , t)dt, we propose to minimize the following loss:</p><p>In practice, we set h(x) to be latent representation of a classifier trained to distinguish the images from the two domains &#960; 0 , &#960; 1 , fine-tuned from a pre-trained ImageNet <ref type="bibr">[77]</ref> model. Intuitively, &#8711; x h(x) serves as a saliency score and re-weights coordinates so that the loss in <ref type="bibr">(20)</ref> focuses on penalizing the error that causes significant changes on h.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Experiment settings</head><p>We set the domains &#960; 0 , &#960; 1 to be pairs of the AFHQ <ref type="bibr">[9]</ref>, MetFace <ref type="bibr">[28]</ref> and CelebA-HQ <ref type="bibr">[27]</ref> dataset. For each dataset, we randomly select 80% as the training data and regard the rest as the test data; and the results are shown by initializing the trained flows from the test data. We resize the image to 512 &#215; 512. The training and network configurations generally follow the experiment settings in Section 5.2. See the appendix for detailed descriptions.</p><p>Results  and generate high quality images. For example, when transferring cats to wild animals, we can generate diverse images with different animal faces, e.g., fox, lion, tiger and cheetah. Moreover, with one step of reflow, 2-rectified flow returns good results with a single Euler step (N = 1). See more examples in Appendix.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.4">Domain Adaptation</head><p>A key challenge of applying machine learning to real-world problems is the domain shift between the training and test datasets: the performance of machine learning models may degrade significantly when tested on a novel domain different from the training set. Rectified flow can be applied to transfer the novel domain (&#960; 0 ) to the training domain (&#960; 1 ) to mitigate the impact of domain shift.</p><p>Experiment settings We test the rectified flow for domain adaptation on a number of datasets. DomainNet <ref type="bibr">[58]</ref> is a dataset of common objects in six different domain taken from DomainBed <ref type="bibr">[20]</ref>. All domains from DomainNet include 345 categories (classes) of objects such as Bracelet, plane, bird and cello. Office-Home <ref type="bibr">[83]</ref> is a benchmark dataset for domain adaptation which contains 4 domains where each domain consists of 65 categories. To apply our method, first we map both the training and testing data to the latent representation from final hidden layer of the pre-trained model, and construct the rectified flow on the latent representation.  Results As demonstrated in Table <ref type="table">2</ref>, the 1-rectified flow shows state-of-the-art performance on both Do-mainNet and OfficeHome. It is better or on par with the previous best approach (Deep CORAL <ref type="bibr">[76]</ref>), while sustainably improve over all other methods. Expreiment Configuration on Image-to-Image Translation In this experiment, we also adopt the same U-Net structure of DDPM++ <ref type="bibr">[73]</ref> for representing the drift v X . We follow the procedure in Algorithm 1. For the purpose of generative modeling, we set &#960; 0 to be one domain dataset and &#960; 1 the other domain dataset. For optimization, we use AdamW <ref type="bibr">[45]</ref> optimizer with &#946; (0.9, 0.999), weight decay 0.1 and dropout rate 0.1. We train the model with a batch size of 4 for 1, 000 epochs. We further apply exponential moving average (EMA) optimizer with coefficient 0.9999. We perform grid-search on the learning rate from {5 &#215; 10 -4 , 2 &#215; 10 -4 , 5 &#215; 10 -5 , 2 &#215; 10 -5 , 5 &#215; 10 -6 } and pick the model with the lowest training loss.</p><p>We use the AFHQ <ref type="bibr">[9]</ref>, MetFace <ref type="bibr">[28]</ref> and CelebA-HQ <ref type="bibr">[27]</ref> dataset. Animal Faces HQ (AFHQ) is an animalface dataset consisting of 15,000 high-quality images at 512 &#215; 512 resolution. The dataset includes three domains of cat, dog, and wild animals, each providing 5000 images. MetFace consists of 1,336 high-quality PNG human-face images at 1024 &#215; 1024 resolution, extracted from works of art. CelebA-HQ is a humanface dataset which consists of 30,000 images at 1024 &#215; 1024 resolution. We randomly select 80% as the training data and regard the rest as the test data, and resize the image to 512 &#215; 512.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Experiment Configuration on Domain Adaptation</head><p>For training the model, we apply AdamW <ref type="bibr">[45]</ref> optimizer with batch size 16, number of iterations 50k, learning rate 10 -4 , weight decay 0.1 and OneCycle <ref type="bibr">[69]</ref> learning rate schedule.      </p></div></body>
		</text>
</TEI>
