Poisson Flow Generative Models
Abstract
We propose a new “Poisson flow” generative model (PFGM) that maps a uniform distribution on a high-dimensional hemisphere into any data distribution.
We interpret the data points as electrical charges on the z = 0 hyperplane in a space augmented with an additional dimension z , generating a high-dimensional electric field (the gradient of the solution to Poisson equation).
We prove that if these charges flow upward along electric field lines, their initial distribution in the z = 0 plane transforms into a distribution on the hemisphere of radius r that becomes uniform in the r → ∞ limit.
To learn the bijective transformation, we estimate the normalized field in the augmented space.
For sampling, we devise a backward ODE that is anchored by the physically meaningful additional dimension: the samples hit the (unaugmented) data manifold when the z reaches zero.
Experimentally, PFGM achieves current state-of-the-art performance among the normalizing flow models on CIFAR-10, with an Inception score of 9 . 68 and a
FID score of 2 . 35 .
It also performs on par with the state-of-the-art SDE approaches while offering 10 × to 20 × acceleration on image generation tasks.
Additionally,
PFGM appears more tolerant of estimation errors on a weaker network architecture and robust to the step size in the Euler method.
The code is available at https: //github.com/
Newbeeer/poisson_flow .
Introduction
Deep generative models are a prominent approach for data generation, and have been used to produce high quality samples in image [1], text [2] and audio [35], as well as improve semi-supervised learning [20], domain generalization [25] and imitation learning [15].
However, current deep generative models also have limitations, such as unstable training objectives (GANs [1, 12, 17]) and low sample quality (VAEs [21], normalizing flows [6]).
New techniques [12, 24] are introduced to stablize the training of CNN-based or ViT-based GAN models.
Although recent advances on diffusion [16] and scored-based models [33] achieve comparable sample quality to GAN’s without adversarial training, these models have a slow stochastic sampling process.
[33] proposes backward
ODE samplers (normalizing flow) that speed up the sampling process but these methods have not yet performed on par with the SDE counterparts.
We present a new “Poisson flow” generative model ( PFGM ), exploiting a remarkable physics fact that generalizes to N dimensions.
As illustrated in Fig. 1(a), motion in a viscous fluid transforms any planar charge distribution into a uniform angular distribution.
Specifically, we interpret Ndimensional data points x (images, say) as positive electric charges in the z = 0 plane of an
N + 1 -dimensional space
(see Fig. 1(a))
filled with a viscous liquid (say honey).
A positive charge with z > 0 will be repelled by the other charges and move in the direction of their repulsive force, eventually crossing an imaginary hemisphere of radius r .
We show that, remarkably, if the the original charge distribution is let loose just above z = 0 , this law of motion will cause a uniform distribution for their hemisphere crossings in the r → ∞ limit.
[Figure]
[Equation]
[Figure]
[Equation]
[Figure]
Our Poisson flow generative process reverses the forward process: we generate a uniform distribution of negative charges on the hemisphere, then track their motion back to the z = 0 plane, where they will be distributed as the data distribution.
A Poisson flow can be viewed as a type of continuous normalizing flows [4, 10, 33] in the sense that it continuously maps between an arbitrary distribution and an easily sampled one: in the previous works an N -dimensional Gaussian and in PFGM a uniform distribution on an N -dimensional hemisphere.
In practice, we implement the Poisson flow by solving a pair of forward/backward ordinary differential equations (ODEs) induced by the electric field (Fig. 1(b)) given by the N -dimensional version of Coulomb’s law (the gradient of the solution to the Poisson’s equation with the data as sources).
We will interchangeably refer to this gradient as the Poisson field , since electric fields normally refer to the special case N = 3 .
The proposed generative model PFGM has a stable training objective and empirically outperforms previously state-of-the-art continuous flow methods [30, 33].
As a different iterative method, PFGM offers two advantages compared to score-based methods [32, 33].
First, the ODE process of PFGM achieves faster sampling speeds than the SDE samplers in [33].
while retaining comparable performance.
Second, our backward ODE exhibits better generation performance than the reverse-time
ODEs of VE/VP/sub-VP SDEs [33], as well as greater stability on a weaker architecture NSCNv2 [32].
The rationale for robustness is that the time variables in these ODE baselines are strongly correlated with the sample norms during training time, resulting in a less error-tolerant inference.
In contrast, the tie between the anchored variable and the sample norm in PFGM is much weaker.
Experimentally, we show that PFGM achieves current state-of-the-art performance on CIFARdataset in the normalizing flow family, with FID/Inception scores of 2 . 48 / 9 . 65 (w/ DDPM++ [33]) and 2 . 35 / 9 .
(w/ DDPM++ deep [33]).
It performs competitively with current state-of-the-art SDE samplers [33] and provides 10 × to 20 × speed up across datasets.
Notably, the backward ODE in
PFGM is the only ODE-based sampler that can produce decent samples on its own on NCSNv2 [32], while other ODE baselines fail without corrections.
In addition, PFGM demonstrates the robustness to the step size in the Euler method, with a varying number of function evaluations (NFE) ranging from 10 to 100 .
We further showcase the utility of the invertible forward/backward ODEs of the Poisson field on likelihood evaluation and image manipulations, and its scalability to higher resolution images on LSUN bedroom 256 × 256 dataset.
Background and Related works
Poisson equation Let x ∈ R N and ρ ( x ) ∶ R N
→ R be a source function.
We assume that the source function has a compact support, ρ ∈ C 0 and N ≥ 3 .
The Poisson equation is
[Equation]
where φ ( x ) ∶ R N
→
R is called the potential function , and ∇ 2 ≡ ∑ Ni = 1 ∂ 2 ∂x
i is the Laplacian operator.
It is usually helpful to define the gradient field E ( x ) =
−∇ φ ( x ) and rewrite the Poisson equation as
∇ ⋅ E = ρ , known in physics as Gauss’s law [11].
The Poisson equation is widely used in physics, giving rise to Newton’s gravitational theory [9] and the electrostatic theory [11], when ρ ( x ) is interpreted as mass density or electric charge density, respectively.
E is the N -dimensional analog of the electric field.
The Poisson equation Eq.
(1) (with zero boundary condition at infinity) admits a unique simple integral solution 2 :
[Equation]
where S N − 1 ( 1 ) is a geometric constant representing the surface area of the unit ( N − 1 ) -sphere 3 , and G ( x , y ) is the extension of Green’s function in N -dimensional space (details in Appendix A.3).
The negative gradient field of φ ( x ) , referred as Poisson field of the source ρ , is
[Equation]
Qualitatively, the Poisson field E ( x ) points away from sources, or equivalently − E ( x ) points towards sources, as illustrated in Fig.
It is straightforward to check that when ρ ( x ) → δ ( x − y ) , we get φ ( x ) → G ( x , y ) and E ( x ) → −∇ x G ( x , y ) .
This implies that G ( x , y ) and −∇ x G ( x , y ) can be interpreted as the potential function and the gradient field generated by a unit point source, e.g . , a point charge, located at y .
When ρ ( x ) takes general forms but has bounded support, simple asymptotics exist for ∣∣ x
∣∣ ≫ ∣∣ y ∣∣ .
To the lowest order, E ( x ) = ∇ x G ( x , y )
∣ y =
∼ x /∣∣ x ∣∣ N behaves as if it were generated by a unit point source at y = 0 .
In physics, the power law decay is considered to be long-range (compared to exponential decay) [11].
Particle dynamics in a Poisson field The Poisson field immediately defines a flow model, where the probability distribution evolves according to the gradient flow ∂p t ( x )/ ∂t = −∇ ⋅ ( p t ( x ) E ( x )) .
The gradient flow is a special case of the Fokker-Planck equation [28], where the diffusion coefficient is zero.
Intuitively we can think of p t ( x ) as represented by a population of particles.
The corresponding (non-diffusion) case of the It
ˆ o process is the forward ODE d x dt = E ( x ) .
We can interpret the trajectories of the ODE as particles moving according to the Poisson field E ( x ) , with initial states drawn from p 0 .
The physical picture of the forward ODE is a charged particle under the influence of electric fields in the overdamped limit (details in Appendix F).
The dynamics is also rescalable in the sense that the particle trajectory remains the same for d x dt = ± f ( x ) E ( x ) for f ( x ) > 0 ,f ( x ) ∈ C 1 , because the time rescaling dt → f ( x ( t )) dt recovers d x dt = ± E ( x ) .
Note that the dynamics is stiff due to the power law factor in the denominator in Eq.
(3), posing computational challenges.
Luckily the rescalablility allows us to rescale E ( x ) properly to get new ODEs (formally defined later in Section 3.3) that are more amenable for sampling.
Generative Modeling via ODE Generative modeling can be done by transforming a base distribution to a data distribution via mappings defined by ODEs.
The ODE-based samplers allow for adaptive sampling, exact likelihood evaluation and modeling of continuous-time dynamics [4, 33].
Previous works broadly fall into two lines.
[4, 3] introduce a continuous-time normalizing flow model that can be trained with maximum likelihood by the instantaneous change-of-variables formula [4].
For sampling, they directly integrate the learned invertiable mapping over time.
Another work [33] unifies the scored-based model [31, 32] and diffusion model [16] into a general diffusion process, and uses the reverse-time ODE of the diffusion process for sampling.
They show that the reverse-time ODE produces high quality samples with improved architecture.
Poisson Flow Generative Models
In this section, we start with the properties of the Poisson flow in the augmented space and show how to draw samples from the data distribution by following the backward ODE of the Poisson flow (Section 3.1).
We then discuss how to actually learn a normalized Poisson field from data samples through simulations of the forward ODE (Section 3.2) and present an equivalent backward
ODE that allows for exponentially decay on z (Section 3.3).
[Figure]
[Figure] d Φ in = p ( x ) dA / d Ω d Φ out = d Ω/ S N (1)
Gauss′ s Law
N dim
O r → ∞ d Φ in d Φ out =
z
S 5 S
S
S 1 S(b)
3.1 Augment the data with additional dimension
We wish to generate samples x ∈ R N from a distribution p ( x ) supported on a bounded region.
We may set the source ρ ( x ) =
p ( x ) ∈ C 0 4 and compute the resulting gradient field E ( x ) from Eq.
Since − E ( x ) points towards sources, the backward ODE d x / dt = − E ( x ) will take samples close to the sources.
One may naively hope that the backward ODE is a generative model that recovers p ( x ) .
Unfortunately, the backward ODE has the problem of mode collapse.
We illustrate this phenomenon with a 2D uniform disk.
The reverse Poisson field − E ( x ) on the 2D ( x,y ) -plane points towards the center of the disk O (Fig. 2(a) left), so all particle trajectories (blue lines) will eventually hit O .
If we instead add an additional dimension z (Fig. 2(a) right), particles can hit different points on the disk and faithfully recover the data distribution.
Consequently, instead of solving the Poisson equation ∇ 2 φ ( x ) =
− p ( x ) in the original data space, we solve the Poisson equation in an augmented space ˜ x
= ( x ,z ) ∈ R N
+ 1 with an additional variable z ∈ R .
We augment the training data ˜ x in the new space by setting z = 0 such that ˜ x
= ( x , 0 ) .
As a consequence, the data distribution in the augmented space is ˜ p ( ˜ x )
=
p ( x ) δ ( z ) , where δ is the Dirac delta function.
By Eq.
(3), the Poisson field by solving the new Poisson equation ∇ 2 φ ( ˜ x ) = − ˜ p
( ˜ x ) has an analytical form:
[Equation]
The associated forward/backward ODEs of the Poisson field are d ˜ x / dt = E ( ˜ x ) ,d ˜ x / dt = − E ( ˜ x ) .
Intuitively, theses ODEs uniquely define trajectories of particles between the z = 0 hyperplane and an enclosing hemisphere (cf.
Fig.
1(a)).
In the following theorem, we show that the backward
ODE defines a transformation between the uniform distribution on an infinite hemisphere and the data distribution ˜ p ( ˜ x ) in the z = 0 plane.
We present the formal proof to Appendix A, illustrated by Fig. 2(b).
The proof is based on the idea that when the radius of hemisphere r → ∞ , the data distribution ˜ p ( ˜ x ) can be effectively viewed as a delta distribution at origin.
Consequently, the Poisson field points in the radial direction at r → ∞ , perpendicular to S + N ( r ) (Green arrows in Fig. 2(b)).
Theorem 1.
Suppose particles are sampled from a uniform distribution on the upper ( z > 0 ) half of the sphere of radius r and evolved by the backward ODE d ˜x dt = − E ( ˜x ) until they reach the z =hyperplane, where the Poisson field E ( ˜x ) is generated by the source ˜ p ( ˜ x ) .
In the r → ∞ limit, under some mild conditions detailed in Appendix A, this process generates a particle distribution ˜ p
( ˜ x ) , i.e., a distribution p ( x ) in the z = 0 hyperplane.
Proof sketch.
Suppose the flux of the backward ODE connects a solid angle d Ω (on S + N ( r ) ) with an area dA (on supp ( ˜ p ( ˜ x ) ).
According to Gauss’s law, the outflow flux d Φ out = d Ω / S N ( 1 ) on the hemisphere (Green arrows in Fig. 2(b)) equals the inflow flux d Φ in = p ( x ) dA / 2 on supp ( ˜ p ( ˜ x ))
(Red arrows in Fig. 2(b)).
d Φ in = d Φ out gives d Ω / dA =
p ( x ) S N ( 1 )/ 2 ∝ p ( x ) .
Together, by change-ofvariable, we conclude that the final distribution in the z = 0 hyperplane is p ( x ) .
The theorem states that starting from an infinite hemisphere, one can recover the data distribution ˜ p by following the inverse Poisson field − E ( ˜x ) .
We defer the formal proof and technical assumptions of the theorem to Appendix A.
The property allows generative modeling by following the Poisson flow of ∇ 2 φ ( ˜ x )
= − ˜ p
( ˜ x ) .
3.2 Learning the normalized Poisson Field
Given a set of training data D = { x i } ni = 1 i.i.d sampled from the data distribution p ( x ) , we define the empirical version of the Poisson field (Eq.
(4)) as follows:
[Equation]
where the gradient field is calculated on n augmented datapoints { ˜ x i =
( x i , 0 )} ni = 1 , and c ( ˜ x ) = 1 /∑ ni =
∣∣ ˜ x − ˜ x
i ∣∣ N + 1 is the multiplier for numerical stability.
We further normalize the field to resolve the variations in the magnitude of the norm ∥ ˆ E ( ˜ x ) ∥ 2 , and fit the neural network to the more amenable negative normalized field v ( ˜ x ) = −√ N ˆ E ( ˜ x )/∥
ˆ E ( ˜ x ) ∥ 2 .
The Poisson field is rescalable (cf.
Section 2) and thus trajectories of its forward/backward ODEs are invariant under normalization.
We denote the empirical field calculated on batch data B by ˆ E B and the negative normalized field as v B ( ˜ x ) = −√ N ˆ E B ( ˜ x )/∥
ˆ E B ( ˜
[Equation]
Similar to the scored-based models, we sample points inside the hemisphere by perturbing the augmented training data.
Given a training point x ∈ D , we add noise to its augmented version { ˜ x i =
( x i , 0 )} ni = 1 to construct the perturbed point ( y ,z ) :
[Equation]
where ϵ =
( ϵ x ,ϵ z ) ∼ N( 0 ,σ 2 I N + 1 × N + 1 ) , u ∼ U( S N ( 1 )) and m ∼ U[ 0 ,M ] .
The upper limit M , standard deviation σ and τ are hyper-parameters.
With fixed ϵ and u , the added noise increases exponentially with m .
The rationale behind the design is that points farther away from the data support play a less important role in generative modeling, sharing a similar spirit with the choice of noisy scales in score-based models [32, 33].
In practice, we sample the points by perturbing a mini-batch data B = { x i } ∣B∣ i = 1 in each iteration.
We uniformly sample the power m in [ 0 ,M ] for each datapoint.
We select a large M (typically around 300 ) to ensure the perturbed points can reach a large enough hemisphere.
We use a larger batch B L for the estimation of normalized field since the empirical normalized field is biased, which empirically gives better results.
Denoting the set of perturbed points as { ˜ y i } ∣B∣ i = 1 , we train the neural network f θ on these points to estimate the negative normalized field by minimizing the following loss:
[Equation]
We summarize the training process in Algorithm 1.
In practice, we add a small constant γ to the denominator of the normalized field to overcome the numerical issue when ∃ i, ∣∣
˜ x − ˜ x i ∣∣ ≈ 0 .
3.3 Backward ODE anchored by the additional dimension
After estimating the normalized field v , we can sample from the data distribution by the backward
ODE d ˜ x = − v ( ˜ x ) dt .
Nevertheless, the boundary condition of the above ODE is unclear: the starting and terminal time t of the ODE are both unknown.
To remedy the issue, we propose an equivalent backward ODE in which x evolves with the augmented variable z :
[Equation]
Input: Training iteration T , Initial model f θ , dataset D , constant γ , learning rate η . for t = 1 ...
T do
Sample a large batch B L from D and subsample a batch of datapoints B = { x i } ∣B∣ i = 1 from B L
Simulate the ODE: { ˜ y i
= perturb ( x i ) } ∣B∣ i =
Calculate the normalized field by B L : v B L ( ˜ y i )
= −√ N ˆ E B L ( ˜ y i )/(∥
ˆ E B L ( ˜ y i ) ∥ 2 + γ ) , ∀
i
Calculate the loss: L( θ ) = 1 ∣B∣ ∑ ∣B∣ i = 1 ∥ f θ ( ˜ y i ) − v B L ( ˜ y i )
∥
Update the model parameter: θ = θ − η ∇L( θ ) end for return f θ
Sample the power m ∼ U[ 0 ,M ]
Sample the initial noise ( ϵ x ,ϵ z ) ∼ N( 0 ,σ 2 I ( N + 1 )×( N + 1 ) )
Uniformly sample the vector from the unit ball u ∼ U( S N ( 1 ))
Construct training point y = x
+ ∥ ϵ x ∥ ( 1 + τ ) m u , z = ∣ ϵ z ∣( 1 + τ ) m return ˜ y
= ( y ,z ) where v ( ˜ x ) x , v ( ˜ x ) z are the corresponding components of x ,z in vector v ( ˜ x ) .
In the new ODE, we replace the time variable t with the physically meaningful variable z , permitting explicit starting and terminal conditions: when z = 0 , we arrive at the data distribution and we can freely choose a large z max as the starting point in the backward ODE.
The backward ODE is compatible with general-purpose ODE solvers, e.g . , RK45 method [23] and forward Euler method.
The popular black-box ODE solvers, such as the one in Scipy library [37], typically use a common starting time for the same batch of samples.
Since the distribution on the z =
z max hyperplane is no longer uniform, we derive the prior distribution by radially projecting uniform distribution on the hemisphere with radius r = z max to the z
= z max hyperplane:
[Equation]
where S N ( r ) is the surface area of N -sphere with radius r .
The reason behind the radial projection is that the Poisson field points in the radial direction at r → ∞ .
The new backward ODE also defines a bijective transformation between p prior ( x ) on the infinite hyperplane ( z max → ∞ ) and the data distribution ˜ p ( ˜ x ) , analogous to Theorem 1.
In order to sample from p prior ( x ) , it is suffice to sample the norm from the distribution: p prior (∥ x ∥ 2 )
∝ ∥ x ∥ N − 1/(∥ x ∥ 22 + z 2 max ) N +
and then uniformly sample its angle.
Detailed derivations are deferred to Appendix A.4.
We further achieve exponentially decay on the z dimension by introducing a new variable t ′ :
[Equation]
The z component in the backward ODE, i.e . , dz = − zdt ′ , can be solved by z = e − t ′ .
Since z reaches zero as t ′ → ∞ , we instead choose a tiny positive number z min as the terminal condition.
The corresponding starting/terminal time of the variable t ′ are − log z max / − log z min respectively.
Empirically, this simple change of variable leads to 2 × faster sampling with almost no harm to the sample quality.
In addition, we substitue the predicted v ( ˜ x ) z with a more accurate one when z is small (Appendix B.2.3).
We defer more details of the simulation of backward ODE to Appendix B.2.
Generative Modeling via the Backward ODE
In this section, we demonstrate the effectiveness of the backward ODE associated with PFGM on image generation tasks.
In Section 4.1, we show that PFGM achieves currently best in class performance in the normalizing flow family.
In comparison to the existing state-of-the-art SDE or MCMC approaches, PFGM exhibits 10 × or 20 × acceleration while maintaining competitive or higher generation quality.
Meanwhile, unlike existing ODE baselines that heavily rely on corrector to
[Table]
generate decent samples on weaker architectures, PFGM exhibits greater stability against error (Section 4.2).
Finally, we show that PFGM is robust to the step size in the Euler method (Section 4.3), and its associated ODE allows for likelihood evaluation and image manipulation by editing the latent space (Section 4.4).
4.1 Efficient image generation by PFGM
Setup For image generation tasks, we consider the CIFAR-10 [22], CelebA 64 × 64 [38] and
LSUN bedroom 256 × 256 [39].
Following [32], we first center-crop the CelebA images and then resize them to 64 × 64 .
We choose M = 291 ( CIFAR-10 and CelebA )/ 356 ( LSUN bedroom ) , σ = 0 .
01 and τ = 0 .
03 for the perturbation Algorithm 2, and z min = 1 e − 3 , z max = 40 ( CIFAR-10 )/ 60 ( CelebA 64 2 )/ 100 ( LSUN bedroom ) for the backward ODE.
We further clip the norms of initial samples into ( 0 , 3000 ) for CIFAR-10, ( 0 , 6000 ) for CelebA 64 2 and ( 0 , 30000 ) for LSUN bedroom.
We adopt the DDPM++ and DDPM++ deep architectures [33] as our backbones.
We add the scalar z (resp.
predicted direction on z ) as input (resp.
output) to accommodate the additional dimension.
We take the same set of hyper-parameters, such as batch size, learning rate and training iterations from [33].
We provide more training details in Appendix B.1, and discuss how to set these hyper-parameters for general datasets in B.1.1 and B.2.1.
Baselines We compare PFGM to modern autoregressive model [36], GAN [17, 24], normalizing flow [19] and EBM [8].
We also compare with variants of score-based models such as DDIM [30] and current state-of-the-art SDE/ODE methods [33].
We denote the methods that use forward-time
SDEs in [33] such as Variance Exploding ( VE ) SDE/Variance Preserving ( VP ) SDE/ sub-Variance
Preserving ( sub-VP ), and the corresponding backward SDE/ODE, as A-B , where A ∈ { VE, VP, sub-VP } and B ∈ { SDE, ODE } .
We follow the model selection protocol in [33], which selects the checkpoint with the smallest FID score over the course of training every 50k iterations.
Numerical Solvers
The backward ODE (Eq.
(6)) is compatible with any general purpose ODE solver.
In our experiments, the default solver of ODEs is the black box solver in the Scipy library [37] with the RK45 [7] method ( RK45 ), unless otherwise specified.
For VE/VP/subVP-SDEs, we use the predictor-corrector ( PC ) sampler introduced in [33].
For VP/sub-VP-SDEs, we apply the predictor-only sampler, because its performance is on par with the PC sampler while requiring half computation.
Results For quantitative evaluation on CIFAR-10, we report the Inception [29] (higher is better) and FID [13] scores (lower is better) in Table 1.
We also include our preliminary experimental results on a weaker architecture NCSNv2 [32] in Appendix D.2.
We measure the inference speed by the average NFE (number of function evaluation).
We also explicitly indicate which methods belong to the invertible flow family.
Our main findings are: (1) PFGM achieves the best Inception scores and FID scores among the normalizing flow models.
Specifically, PFGM obtains an Inception score of 9 . 68 and a FID score of 2 .
48 using the DDPM++ deep architecture.
To our best knowledge, these are the highest FID and
Inception scores by flow models on CIFAR-10.
(2) PFGM achieves a 10 × ∼ 20 × faster inference speed than the SDE methods using the similar architectures, while retaining comparable sample quality.
As shown in Table 1, PFGM requires NFEs of 110 whereas the SDE methods typically use 1000 ∼ 2000 inference steps.
PFGM outperforms all the baselines on DDPM++ in all metrics.
In addition, PFGM generally samples faster than other ODE baselines with the same RK45 solver.
The backward ODE in PFGM is compatible with architectures with varying capacities.
PFGM consistently outperforms other ODE baselines on DDPM++ (Table 1) or NCSNv2 (Appendix D.2) backbones.
(4) PFGM shows scalability to higher resolution datasets.
In Appendix D.1, we show that PFGM are capable of scale-up to LSUN bedroom 256 × 256 .
In particular, PFGM has comparable performance with VE-SDE with 15 × fewer NFE.
In Fig.
3, we visualize the uncurated samples from PFGM on CIFAR-10, CelebA 64 × 64 and LSUN bedroom 256 × 256 .
We provides more samples in Appendix E.
4.2 Failure of VE/VP-ODEs on NCSNv2 architecture
[Figure]
In our preliminary experiments on NCSNv2 architectures, we empirically observe that the VE/VP-ODEs have FID scores greater than 90 on CIFAR-10.
In particular, VE/VPODEs can only generate decent samples when applying the Langevin dynamics corrector, and even then, their performances are still inferior to PFGM (Table 8, Table 9).
The poor performance on NCSNv2 stands in striking contrast to their high sample quality on NCSN++/DDPM++ in [33].
It indicates that the VE/VP-ODEs are more susceptible to estimation errors than PFGM.
We hypothesize that the strong norm- σ correlation seen during the training of score-based models causes the problem.
[Figure]
For score-based models, the l 2 norms of perturbed training samples and the standard deviations σ ( t ) of Gaussian noises have strong correlation, e.g . , l 2 norm ≈ σ ( t )√ N for large σ ( t ) in VE [33].
In contrast, as shown in Fig. 4, PFGM allocates high mass across a wide spectrum of the training sample norms.
During sampling, VE/VP-ODEs could break down when the trajectories of backward ODEs deviate from the norm- σ ( t ) relation to which most training samples pertain.
The weaker NCSNv backbone incurs larger errors and thus leads to their failure.
The PFGM is more resistant to estimate errors because of the greater range of training sample norms.
To further verify the hypothesis above, we split a batch of VE-ODE samples into cleaner and noisier samples according to visual quality (Fig. 9(a)).
In Fig. 5(a), we investigate the relation for cleaner and noisier samples during the forward Euler simulation of VE-ODE when σ ( t ) < 15 .
We can see that the trajectory of cleaner samples stays close to the norm- σ ( t ) relation (the red dash line), whereas that of the noisier samples diverges from the relation.
The Langevin dynamics corrector changes the trajectory of noisier samples to align with the relation.
Fig.
5(b) further shows that the anchored variable z ( t ′ ) and the norms in the backward ODE of PFGM are not strongly correlated, giving rise to the robustness against the imprecise estimation on NCSNv2.
We defer more details to Appendix C.
4.3 Effects of step size in the forward Euler method
In order to accelerate the inference speed of ODEs, we can increase the step size (decrease the NFEs) in numerical solvers such as the forward Euler method.
It also enables the trade-off between sample quality and computational efficiency in real-world deployment.
We study the effects of increasing step size on PFGM, VP-ODE and DDIM [30] using the forward Euler method, with a varying NFE ranging from 10 to 100 .
In Fig. 5(c), we report the sample quality measured by FID scores on CIFAR-10.
As expected, all the methods have higher FID scores when decreasing the NFE.
We observe that the sample quality of
PFGM degrades gracefully as we decrease the NFE.
Our method shows significantly better robustness to step sizes than the VP-ODE, especially when only taking a few Euler steps.
In addition, PFGM obtains better FID scores than DDIM on most NFEs except for 10 where PFGM is marginally worse.
This suggests that the PFGM is a promising method for accommodating instantaneous resource availability, as high-quality samples can be generated in limited steps.
4.4 Utilities of ODE: likelihood evaluation and latent representation
Similar to the family of discrete normalizing flows [6, 19, 14] and continuous probability flow [33], the forward ODE in PFGM defines an invertible mapping between the data space and latent space with a known prior.
Formally, we define the invertible forward M mapping by integrating the corresponding forward ODE d ( x ,z ) =
( v ( ˜ x ) x v ( ˜ x ) − 1 z z,z ) dt ′ of Eq.
[Equation]
where log z min / log z max are the starting/terminal time in the forward ODE.
The forward mapping transfers the data distribution to the prior distribution p prior on the z =
z max hyperplane (cf.
Section 3.3): p prior ( x ( log z max ))
=
M( p ( x ( log z min ))) .
The invertibility enables likelihood evaluation and creates a meaningful latent space on the z = z max hyperplane.
In addition, we can adapt to the computational constraints by adjusting the step size or the precision in numerical ODE solvers.
[Figure]
[Figure]
[Figure]
Likelihood evaluation We evaluate the data likelihood by the instantaneous change-of-variable formula [4, 33].
In Table 6, we report the bits/dim on the uniformly dequantized CIFAR-10 test set and compare with existing baselines that use the same setup.
We observe that
PFGM achieves better likelihoods than discrete normalizing flow models, even without maximum likelihood training.
Among the continuous flow models, sub-VP-ODE shows the lowest bits/dim, although its sample quality is worse than VP-ODE and PFGM (Table 1).
The exploration of the seeming trade-off between likelihood and sample quality is left for future works.
Latent representation Since the samples are uniquely identifiable by their latents via the invertible mapping M , PFGM further supports image manipulation using its latent representation on the z
= z max hyperplane.
We include the results of image interpolation and the temperature scaling [6, 19, 33] to Appendix D. and Appendix D.5.
For interpolation, it shows that we can travel along the latent space to obtain perceptually consistent interpolations between CelebA images.
Conclusion
We present a new deep generative model by solving the Poisson equation whose source term is the data distribution.
We estimate the normalized gradient field of the solution in an augmented space with an additional dimension.
For sampling, we devise a backward ODE that exponential decays on the physically meaningful additional dimension.
Empirically, our approach has currently best performance over other normalizing flow baselines, and achieving 10 × to 20 × acceleration over the stochastic methods.
Our backward ODE shows greater stability against errors than popular
ODE-based methods, and enables efficient adaptive sampling.
We further demonstrate the utilities of the forward ODE on likelihood evaluation and image interpolation.
Future directions include improving the normalization of Poisson fields.
More principled approaches can be used to get around the divergent near-field behavior.
For example, we may exploit renormalization, a useful tool in physics, to make the Poisson field well-behaved in near fields.
Acknowledgements
We are grateful to Shangyuan Tong, Timur Garipov and Yang Song for helpful discussion.
We would like to thank Octavian Ganea and Wengong Jin for reviewing an early draft of this paper.
YX and TJ acknowledge support from MIT-DSTA Singapore collaboration, from NSF Expeditions grant (award 1918839) ”
Understanding the World Through Code”, and from MIT-IBM Grand Challenge project.
ZL and MT would like to thank the Center for Brains, Minds, and Machines (CBMM) for hospitality.
ZL and MT are supported by The Casey and Family Foundation, the Foundational Questions Institute, the Rothberg Family Fund for Cognitive Science and IAIFI through NSF grant PHY-2019786.
Appendix A Proofs A.1 Formal Proof of Theorem
Before proceeding to Theorem 1, we show a technical lemma that guarantees the existence-uniqueness of the solution to the Poisson equation, under some mild conditions.
Lemma 1.
Given Ω = R N ,N ≥ 3 , assume that the source function ρ ∈ C
( Ω ) , and ρ has a compact support.
Then the the Poisson equation ∇ 2 φ ( x ) = − ρ ( x ) on Ω with zero boundary condition at infinity ( lim ∥ x
∥ 2 →∞ φ ( x ) = 0 ) has a unique solution φ ( x ) ∈ C 2 ( Ω ) up to a constant.
Proof.
For the existence of the solution, one can verify that the analytical construction using the extension of Green’s function in N ≥ 3 dimensional space (Lemma 4), i.e . , φ ( x ) = ∫ G ( x , y ) ρ ( y )
d y ,G ( x , y ) =
[Equation]
, is one possible solution to the Poisson equation ∇ 2 φ ( x ) = − ρ ( x ) .
Since ρ ∈ C 0 ( Ω ) and ∇ 2 φ ( x ) = − ρ ( x ) , we conclude that φ ( x ) ∈ C 2 ( Ω ) .
The proof idea of the uniqueness is similar to the uniqueness theorems in electrostatics.
Suppose we have two different solutions φ 1 ,φ 2 ∈ C 2 which satisfy
[Equation]
We define ˜ φ ( x ) ≡ φ 2 ( x ) − φ 1 ( x ) .
Subtracting the above two equations gives
[Equation]
By the vector differential identity we have
[Equation]
By the divergence theorem we have
[Equation]
where d N − 1 S denotes an N − 1 dimensional surface element at infinity, and the second equation holds due to zero boundary condition at infinity.
Combining Eq.
(8)(9)(10), we have
[Equation]
since this is an integral of a positive quantity, we must have ∇ ˜ φ ( x ) = 0 , or ˜ φ ( x ) =
c , ∀ x ∈ Ω .
This means φ 1 and φ 2 differ at most by a constant, but a constant does not affect gradients, so ∇ φ 1 ( x ) = ∇ φ 2 ( x ) .
In our method section (Section 3.1), we augmented the original N -dimensional data with an extra dimension.
The new data distribution in the augmented space is ˜ p
( ˜ x ) = p ( x ) δ ( z ) , where δ is the
Dirac delta function.
The support of the data distribution is in the z = 0 hyperplane.
In the following lemma, we show the existence and uniqueness of the solution to ∇ 2 φ ( ˜ x ) = − ˜ p
( ˜ x ) outside the data support.
Lemma 2.
Assume the support of the data distribution in the augmented space (supp ( ˜ p ( ˜ x )) ) is a compact set on the z = 0 hyperplane, p ( x ) ∈ C 0 and N ≥ 3 .
The Poisson equation ∇ 2 φ ( ˜ x ) = − ˜ p
( ˜ x ) with zero boundary condition at infinity ( lim ∥ x
∥ 2 →∞ φ ( ˜ x ) = 0 ) has a unique solution φ ( ˜ x ) ∈ C 2 for ˜ x ∈ R N + 1 ∖ supp ( ˜ p ( ˜ x )) , up to a constant.
Proof.
Similar to the proof in Lemma 1, one can easily verify that the analytical construction using
Green’s method, i.e . , φ ( ˜ x ) = ∫ G ( ˜ x , ˜ y )
˜ p
( ˜ x ) d ˜ y ,G ( ˜ x ,
˜ y )
=
1 ( N − 1 ) S N ( 1 ) 1 ∣∣ ˜ x − ˜
y
∣∣
N − 1 , is one possible solution to the Poisson equation ∇ 2 φ ( ˜ x )
= − ˜ p
( ˜ x ) .
Since ˜ p ( ˜ x ) =
for ˜ x ∈ R N + 1 ∖ supp ( ˜ p ( ˜ x )) and ∇ 2 φ ( ˜ x )
= − ˜ p
( ˜ x ) , we conclude that φ ( ˜ x ) ∈ C 2 ( R N + 1 ∖ supp ( ˜ p ( ˜ x ))) .
d Φ in = p ( x ) dA / d Ω d Φ out = d Ω/ S N (1)
Gauss′ s Law
N dim
O r → ∞ d Φ in d Φ out =
z
S 5 S
S
S S
For the uniqueness, suppose we have two different solutions φ 1 ,φ 2 ∈ C 2 ( R N + 1 ∖ supp ( ˜ p ( ˜ x ))) which satisfy
[Equation]
We define ˜ φ
[Equation]
˜ x ) ≡ φ
[Equation]
˜ x ) − φ 1 ( ˜ x ) .
Subtracting the above two equations gives
[Equation]
By the vector differential identity we have
[Equation]
By the divergence theorem we have
[Equation]
[Equation]
where d N S denotes an N dimensional surface element at infinity, and the second equation holds due to zero boundary condition at infinity.
Combining Eq.
(13)(14)(15), we have
[Equation]
The first equation holds because Lebesgue measure of supp ( ˜ p ( ˜ x )) is zero.
Since ∣∣∇ ˜ φ ( ˜ x )∣∣ 2 is an integral of a positive quantity, we must have ∇ ˜ φ ( ˜ x ) = 0 , or ˜ φ ( ˜ x )
=
c , ∀ ˜ x ∈ R N + 1 ∖ supp ( ˜ p ( ˜ x )) .
This means φ 1 and φ 2 differ at most by a constant function, but a constant does not affect gradients, so ∇ φ 1 ( ˜ x )
= ∇ φ 2 ( ˜ x ) .
As illustrated in Fig.
7, there is a bijective mapping between the upper hemisphere of radius r and the z = 0 plane, where each pair of corresponding points is connected by an electric field line.
We will now formally prove that, in the r → ∞ limit, this mapping transforms the arbitrary charge distribution in the source plane (that generated the electric field) into a uniform distribution on the hemisphere.
Theorem 2.
Suppose particles are sampled from a uniform distribution on the upper ( z > 0 ) half of the sphere of radius r and evolved by the backward ODE d ˜x dt = − E ( ˜x ) until they reach the z =hyperplane, where the Poisson field E ( ˜x ) is generated by the source ˜ p ( ˜ x ) .
In the r → ∞ limit, under the conditions in Lemma 2, this process generates a particle distribution ˜ p
( ˜ x ) , i.e., a distribution p ( x ) in the z = 0 hyperplane.
Proof.
By Lemma 2, we know that with zero boundary at infinity, the Poisson equation ∇ 2 φ ( ˜ x ) = − ˜ p
( ˜ x ) has a unique solution φ ( ˜ x ) ∈ C 2 for ˜ x ∈ R N + 1 ∖ supp ( ˜ p
( ˜ x )) .
Hence E ( ˜x ) =
−∇ φ ( ˜ x ) ∈ C 1 , guaranteeing the existence-uniqueness of the solution to the ODE d ˜x dt = − E
( ˜x ) according to Theorem 2.8.1 in [27].
Consider the tube in Fig.
7 connecting an area on dA in the z = ϵ → 0 + hyperplane ( S 3 ) to a solid angle d Ω on the hemisphere ( S 1 ), with S 2 as its side.
The tube is the space swept by dA following electric field E , so by definition the electric field is parallel to the tangent space of the tube sides S 2 .
The bottom of the tube S 3 is located at z =
ϵ → 0 + , a bit above the z = 0 plane, so the tube does not enclose any charges.
We note that the divergence of Poisson field is zero in R N + 1 ∖ supp ( ˜ p ( ˜ x )) :
[Equation]
Denote the volume and surface of the tube as V and B .
According to divergence theorem, (cid:118) E ( ˜x ) ⋅ d B = ∫
V ∇ ⋅ E ( ˜x ) dV = 0 .
Hence the net flux leaving the tube is zero:
[Equation]
There is no flux through the sides, i.e., Φ S 2 = 0 , since E ( ˜x ) is orthogonal to the surface element d B on the tube sides by definition.
As a result, the flux Φ S 3 entering from below must equal the flux Φ S 1 leaving the other end.
Denote the l 2 norm of the vector r as r .
We first calculate the influx Φ S 3 .
To do so, we study a Gaussian pillbox whose top, side and bottom are S 3 , Sand S 5 .
S 3 and S 5 are located at z
= ϵ and z = − ϵ
( ϵ → 0 + ).
Denote the volume and surface of the pillbox as V ′ and B ′ .
The pillbox contains charge p ( x ) dA , so according to Gauss’s law
[Equation]
The flux on the sides Φ ′ S 4 ∝ ϵ → 0 , and Φ ′ S 3 =
Φ ′ S
due to mirror symmetry of z = 0 .
So Φ ′ S 3 =
Φ ′ S 5 = p ( x ) dA / 2 .
Note on the S 3 surface, the outflux of the pillbox is exactly the influx of the tube, so we have:
[Equation]
[Equation]
inserting which and Φ S 2 = 0 to Eq.
(16) gives
[Equation]
On the other hand, in the far-field limit r → ∞ , since supp ( p ( x )) is bounded, the data distribution can be effectively seen as a point charge (see Appendix A.2).
By Lemma 3, we have lim r →∞ E ( r ) =
− lim
r →∞ ∇ φ ( r ) =
r S N ( 1 ) r N + 1 .
The resulting outflux on the hemisphere is
[Equation]
[Equation]
where E r ≡ E ( r ) ⋅ r / r is the radial component of E .
Comparing Eq.
(19) and Eq.
(20) yields d Ω / dA
= p ( x ) S N ( 1 )/ 2 ∝ p ( x ) .
In other words, the mapping from the z = 0 hyperplane to the hemisphere dilutes the charge density p ( x ) up to a constant factor.
Thus by change-of-varible, we conclude that the mapping transforms the data distribution into a uniform distribution on the infinite hemisphere.
Since the ODE is reversible, the backward ODE transforms the uniform distributoin on the infinite hemisphere to the distribution ˜ p ( ˜ x ) .
A.2 Multipole Expansion
We discuss the behaviors of the potential function in Poisson equation (Eq.
(1)) under different scenarios, utilizing the multipole expansion.
Suppose we have a unit point charge q = 1 located at x ∈ R N .
We know that the potential function at another point y ∈ R N is φ ( y − x ) =
[Equation]
∣∣
y − x ∣∣
N −(ignoring a constant factor).
Now we assume that x is close to the origin such that we can Taylor expand around x = 0 :
[Equation]
where
[Equation]
In the case where the source is a distribution p ( x ) , the potential φ ( y ) can again be Taylor expanded:
[Equation]
where
[Equation]
which are called monopole, dipole and quadrupole in physics, respectively.
The gradient field
E ( y ) =
∇ Φ ( y ) can be expanded in the same such that
[Equation]
It is easy to check that
∣∣
E ( i ) ( y )∣∣ decays as
1 /∣∣ y ∣∣
N − 2 + i , which means higher-order corrections decay faster than leading terms.
So when ∣∣ y ∣∣ → ∞ , only the monopole term ∣∣ E ( 0 ) ( y )∣∣ matters, which behaves like a point source.
In a more realistic setup, we only have a large but finite ∣∣ y ∣∣ , so the question is: under what condition is the point source approximation valid?
We examine φ ( 0 ) , φ ( 1 ) and φ ( 2 ) more carefully:
[Equation]
Since φ ( 1 ) is an odd function of x , integrating φ ( 1 ) over x leads to zero (samples are normalized to zero mean).
In machine learning applications, N is usually a large number (although in physics N is merely 3).
If y is a random vector of length ∣∣ y ∣∣ , then x T y ∼ ( 1 √ N ± 1 N )∣∣ x ∣∣∣∣ y ∣∣ .
So Eq.
(26) can be approximated as
[Equation]
Requiring ∫ φ ( 0 ) p ( x ) d x ≫ ∫ φ ( 2 ) p ( x ) d x gives ∣∣ y ∣∣ 2 ≫ √ N E p ( x ) ∣∣ x ∣∣ 2 .
So the condition for the point source approximation to be valid is:
[Equation]
Based on this condition, we can partition space into three zones: (1) the far zone κ ≫ 1 , where the point source approximation is valid; (2) the intermediate zone κ ∼ O ( 1 ) , where the gradient field has moderate curvature; (3) the near zone κ ≪ 1 , where the gradient field has high curvature.
In practice, the initial value ∣∣ y ∣∣ is greater than 1000 (hence κ ≫ 1 ) with high probability on CIFARand CelebA datasets, incidating that the initial samples lie in the far zone and gradually move toward the near zone where ∣∣ y ∣∣
≈ ∣∣ x ∣∣ ( κ ≪ 1 ).
We summarize above observations in the following lemma in the ∣∣ y ∣∣
→ ∞ limit:
Lemma 3.
Assume the data distribution p ( x ) ∈ C 0 has a compact support in R N , then the solution φ to the Poisson equation ∇ 2 φ ( x ) = − p ( x ) with zero boundary condition at infinity satisfies lim
[Equation]
Proof.
By Lemma 1, the gradient of the solution has the following form:
[Equation]
∣∣ x − y ∣∣ N .
Since p ( x ) has a bounded support, we assume max {∥ x
∥ 2 ∶ p ( x ) /= 0 } < B .
On the other hand, we have
[Equation]
for ∀ y such that ∥ y ∥ 2 < B .
Hence,
[Equation]
A.3 Extension of Green’s Function in N -dimensional Space
In this section, we show that the function G ( x , y ) defined in Eq.
(2) is the N -dimensional extension of the Green’s function, φ ( x ) = ∫
G ( x , y ) ρ ( y )
d y solves the Poisson equation ∇ 2 φ ( x ) =
− ρ ( x ) .
Lemma 4.
Assume the dimension N ≥ 3 , and the source term satisfies ρ ∈ C
( Ω ) , ∫ R N ρ 2 ( x ) d x < +∞ , lim ∥
x ∥ 2 →∞ ρ ( x ) = 0 .
The extension of Green’s function G ( x , y ) =
[Equation]
solves the Poisson equation ∇ 2 x G ( x , y )
= − δ ( x − y ) .
In addition, with zero boundary condition at infinity ( lim ∥ x
∥ 2 →∞ φ ( x ) = 0 ), φ ( x ) = ∫ G ( x , y ) ρ ( y )
d y solves the Poisson equation ∇ 2 φ ( x ) =
− ρ ( x ) .
Proof.
It is convenient to denote r = x − y , r = ∣∣ r ∣∣ and notice ∂r / ∂ x = r / r .
Firstly, we calculate ∇ x G ( x , y ) :
[Equation]
Then we calculate ∇
[Equation]
[Equation]
which is 0 for r > 0 , but undermined for r = 0 .
So we are left with proving
[Equation] [Equation]
where S ϵ ( y ) denotes a ball centered at y with a radius ϵ → 0 + .
With the divergence theorem, we have
[Equation]
where the surface integral can be computed
[Equation]
in which we used (cid:118)
∂S ϵ ( y ) r ⋅ d N − 1 B = ϵS N − 1 ( ϵ ) .
Together, we conclude that
[Equation]
[Equation]
Next we show that φ ( x ) = ∫ G ( x , y ) ρ ( y )
d y solves ∇ 2 φ ( x ) =
− ρ ( x ) .
Taking the Laplacian operator of both sides gives:
[Equation] [Equation]
In addition, we show that φ ( x ) is zero at infinity.
Since ρ ( x ) ∈ C
and has compact support, we know that ρ ( x ) is bounded, and let ∣ ρ ( x )∣ < B .
[Equation]
The last equality holds since supp ( ρ ) is a compact set.
A.4 Proof for the Prior Distribution on z = z max Hyperplane
[Figure]
We obtain the prior distribution p prior by projecting the uniform distribution U( S + N ( z max )) on the hemisphere S + N ( z max ) to the z
= z max hyperplane.
In the following proposition, we show that the projected distribution is p prior ( x ) =
[Equation]
Proposition 1.
The radial projection of U( S + N ( z max )) on the hemisphere S + N ( z max ) to the z
= z max hyperplane is
[Equation]
Proof.
We calculate the change-of-variable ratio by comparing two associate areas.
As illustrated in Fig.
8, an area dA 1 on S + N ( z max ) is projected to an area dA 3 on the hyperplane in the ( x ,z max ) direction, and we have
[Equation]
We aim to calculate the ratio dA 1 / dA 3 below.
We define the angle between ( 0 ,z max ) and ˜ x
= ( x ,z max ) to be θ .
We project dA 3 to the hyperplane orthogonal to ˜ x to get dA 2 = dA 3 cos θ = dA 3 z max / r where r ≡
∣∣
˜x ∣∣ = √ ∣∣ x
∣∣ 2 + z 2 max .
Since dA 1 is parallel to dA 2 and they lie in the same cone from the origin O , we have dA 2 / dA 1 =
( r / z max ) N .
Combining all the results gives p
[Equation]
B Experimental Details B.1 Training
In this section we include more details about the training of PFGM and other baselines.
We show the hyper-parameters settings for all the baselines (Appendix B.1.1).
All the experiments are run on a single NVIDIA A100 GPU.
B.1.1 Additional Settings
PFGM We set the hyper-parameters γ = 5 , the larger batch size for calculating normalize field ∣B L ∣ =
(CIFAR-10) , 256 (CelebA) , 64 (LSUN bedroom) in Algorithm 1, and M = 291 (CIFAR-10, CelebA) / 356 (LSUN bedroom), σ = 0 .
01 and τ = 0 . 03 in Algorithm 2.
We use the a batch size of ∣B∣ = 128 (CIFAR-10, CelebA) /
32 (LSUN bedroom), the same Adam optimizer and exponential moving average in [33].
We center the data around the origin.
The initial z components in the normalized field are approximately zero with small initial ∣ ϵ z ∣ values in Algorithm 2.
In this case, the trajectories of the forward ODE terminate at points that are unlikely traversed by the backward
ODE, i.e . , points with large ∥ x ∥ 2 and small z .
In light of this, we heuristically confine the maximum sampling step to M = 200 (CIFAR-10, CelebA) / 250 (LSUN bedroom) for points with the initial ∣ ϵ z ∣ smaller than 0 .
More principal solutions are left for future works.
For selecting M in more general settings , we recommend the following rule-of-thumb.
According to analysis in Section A.2, given a perturbation point ( y ,z ) when setting the exponent m =
M in
Algorithm 2, we can ensure the point source approximation by
[Equation] By WLLN, we have ∣∣ ϵ x ∣∣ = √ Nσ , and recall that y = x + ∥ ϵ x ∥ ( 1 + τ ) M u where ϵ
=
( ϵ x ,ϵ z ) ∼
N( 0 ,σ 2 I N + 1 × N + 1 ) , u ∼ U( S N ( 1 )) .
Together, we conclude ∣∣
y ∣∣ ≈ √ Nσ ( 1 + τ ) M .
Substituting in Eq.
(35), we have
[Equation]
{+We empirically observe that setting M = 
+}
ln
[Equation]
already gives good results, and the corresponding ∣∣ y ∣∣ ≈ 3000 .
For example, on CIFAR-10 datasets, N = 3072 ,τ = 0 .
03 ,σ = 0 .
01 , E p ( x ) ∣∣ x ∣∣ 2 ≈ 900 , we have 34 ln
[Equation]
Since we are operating in the augmented space, we add minor modifications to the
DDPM++/DDPM++ deep architectures to accommodate the extra dimension.
More specifically, we replace the conditioning time variable in VP/sub-VP with the additional dimension z in PFGM as the input to the positional embedding.
We also need to add an extra scalar output representing the z direction.
To this end, we add an additional output channel to the final convolution layer and take the global average pooling of this channel to obtain the scalar.
For LSUN bedroom dataset, we both experiments with the channel configurations suggested in NSCN++ [33] and DDPM [16].
VE/VP/sub-VP We use the same set of hyper-parameters and the NCSN++/DDPM++ (deep) backbone and the continuous-time training objectives for forward SDEs in [33].
B.2 Sampling
We provide more details of PFGM and VE/VP sampling implementations in Appendix B.2.1.
We further discuss two techniques used in PFGM ODE sampler: change-of-variable formula (Appendix B.2.2) and the substitution of ground-truth Poisson field direction on z (Appendix B.2.3).
B.2.1 Additional settings
PFGM For RK-45 sampler, we use the function implemented in scipy.integrate.solve ivp with atol = 1 e − 4 , rtol = 1 e − 4 .
For forward Euler method, we discretize the ODE with constant step size determined by the number of steps, i.e . , step size =
( log z max − log z min ) /number of steps for the backward ODE (Eq.
As in [1], we set the terminal value of z min = 1 e − 3 .
We choose z max = 40 (CIFAR-10) , 60 (CelebA 64 2 ) , 100 (LSUN bedroom) to satisfy the condition κ ≫ 1 by the multipole expansion analysis in Appendix A.2.
The condition ensures that the data distribution can be viewed roughly as a point source at origin.
For example, we set z max = 40 on CIFAR-10, and the corresponding κ is greater than 50 with high probability.
The hyperparameters work well without further fine tuning.
Hence, we hypothesize that PFGM is insensitive to the choice of hyperparameters in a reasonable range, as shown in Table 2.
We clip the norms of initial samples into ( 0 , 3000 ) for
CIFAR-10, ( 0 , 6000 ) for CelebA and ( 0 , 30000 ) for LSUN bedroom.
For selecting z max and clipping upper bound of norms for general datasets, we recommend the following rule-of-thumb.
Recall that during the training perturbations (Eq.
(5)), given a random initial value
ϵ z ∼ N( 0 ,σ 2 ) , maximum z is
[Equation]
Hence we set z max =
E [∣ ϵ z ∣( 1 + τ ) M ] = √ 2 π σ ( 1 + τ ) M .
For example, on CIFAR-10, τ = 0 .
03 ,M = 291 , and z max ≈ 43 .
The clipping upper value is similarity derived, by setting it to E [∣∣ ϵ x ∣∣( 1 + τ ) M ] = √
Nσ ( 1 + τ ) M ≈ 3000 , where ϵ x ∼ N( 0 ,σ 2 I N × N ) .
By combining Eq.
(35), we further have
[Equation]
max
[Equation]
clipping upper value [Equation] 2 √ N ) which are easier formulas for practitioner. VE/VP/sub-VP For the PC sampler in VE, we follow [33] to set the reverse diffusion process as the predictor and the Langevin dynamics (MCMC) as the corrector.
For VP/sub-VP, we drop the corrector in PC sampler since it only gives slightly better results [33]. [Table]
B.2.2 Exponential Decay on z Dimension
Recall that in Section 3.3, we replace the vanilla backward ODE with a new ODE anchored by z :
[Equation]
We further use the change-of-variable formula, i.e . , t ′ =
− log z , to achieve exponential decay on the z dimension:
[Equation]
The trajectories of the two ODEs above are the same when dt,dt ′
→ 0 .
We compare the NFE and the sample quality of different ODEs in Table 3.
We measure the NFE/FID of generating
CIFAR-10 samples with the RK45 method in Scipy package [37].
The batch size is set to 1000 .
All the numbers are produced on a single NVIDIA A100 GPU.
We observe that the ODE with the anchor variable t ′ not only accelerates the vanilla by 2 times, but has almost no harm to the sample quality measured by FID score.
B.2.3 Substitute the Predicted z Direction with the Ground-truth
Since the neural network cannot perfectly learn the ground-truth z direction, we replace the predicted f θ ( x ) z with the ground-truth direction when z is small.
More specifically, given ˜ x
= ( x ,z ) ∈ R N + 1 , [Table] recall that the empirical field is ˆ E ( ˜ x )
=
c ( ˜ x )
∑ ni =˜ x − ˜ x i ∣∣ ˜ x − ˜ x i ∣∣ N + 1 where c ( ˜ x ) = 1 /∑ ni =1 ∣∣ ˜ x − ˜ x i ∣∣ N + 1 .
Hence we can rewrite the empirical field as
[Equation]
where ∑ ni = 1 w ( ˜ x , ˜ x i ) =
∑ ni =1 ∣∣ ˜ x − ˜ x i ∣∣ N +∑ nj =1 ∣∣ ˜ x − ˜ x
j ∣∣ N + 1 = 1 .
Furthermore we have ∀ i, ( ˜ x − ˜ x i ) z
= z −
= z .
Together, the z component in the empirical field is ˆ E ( ˜ x ) z
=
∑ ni = 1 w ( ˜ x , ˜ x i )( ˜ x − ˜ x i ) z
= z .
The predicted normalized field is trained to approximate the normalized field, i.e . , f θ ( ˜ x ) x ≈ − √ N ˆ E ( ˜ x ) x /( √ ∥
ˆ E ( ˜ x ) x ∥ 2 2 + z 2 + γ ) {+≈ − √ N ˆ E ( ˜ x ) x /( √ ∥ ˆ E ( ˜ x ) x ∥ 2 2 + γ ) since ∥ ˆ E ( ˜ x ) x ∥ 
+}
≫ z . Solving for ∥ ˆ E ( ˜ x ) x ∥ 2 , we get ∥ ˆ E ( ˜ x ) x ∥ 2 ≈ γ ∥
f θ ( ˜ x ) x ∥ 2 /√ N 1 −∥ f θ ( ˜ x ) x ∥ 2 /√ N .
Hence the z component in the normalized field after substituting the ground-truth is ˆ E ( ˜ x ) z /(√∥
ˆ E ( ˜ x ) x ∥ 22 + z 2 + γ )
=
z /( γ ∥ f θ ( ˜ x )∥ 2 /√ N 1 −∥ f θ ( ˜ x )∥ 2 /√ N + γ ) .
In our experiments, we therefore replace the original prediction f θ ( ˜ x ) z with −√ Nz /( γ ∥ f θ ( ˜ x )∥ 2 /√ N 1 −∥ f θ ( ˜ x )∥ 2 /√ N + γ ) when z < 5 / 1 / 0 .
1 during the backward ODE sampling for CIFAR10/CelebA 64 2 /LSUN bedroom 256 2 .
Table 4 reports the NFE and FID score w/o and w/ the above substitution.
We observe that the usage of ground-truth
z direction in the near field accelerates the sampling speed.
[Table]
B.3 Evaluation
We use FID [13] and Inception scores [29] to quantitatively measure the sample quality, and
NFE (number of evaluation steps) for the inference speed.
FID (Fr ´ echet Inception Distance) score is the Fr ´ echet distance between two multivariate Gaussians, whose means and covariances are estimated from the 2048-dimensional activations of the Inception-v3 [34] network for real and generated samples respectively.
Inception score is the exponential mutual information between the predicted labels of the
Inception network and the images.
We also report bits/dim for likelihood evaluation.
It is computed by dividing the negative log-likelihood by the data dimension, i.e . , bits/dim = − log p prior ( x )/ N .
For CIFAR-10, we compute the Fr´echet distance between 50000 samples and the pre-computed statistics of CIFAR-10 dataset in [13].
For CelebA 64 × 64 , we follow the setting in [32] where the distance is computed between 10000 samples and the test set.
For model selection, we follow [32] and pick the checkpoint with smallest FID every 50k iterations on 10k samples for computing all the scores.
B.4 Effects of Step Size: FID versus NFE
For preciseness, Table 5 reports the exact numbers in Fig. 5(c).
Since in the ODE d ( x ,z ) = −( v ( ˜ x ) x v ( ˜ x ) − 1 z z,z ) dt ′ of PFGM, the z variable is a function of t ′ ( z = e t ′ ), we integrate the z in the Euler method to reduce the discretization error.
The vanilla update [Table] [Figure] from time t ′ i to time t
′ i + 1 is ( x i + 1 ,z
i + 1 ) =
( x i ,z i ) − ( v ( ˜ x i ) x v ( ˜ x i ) − 1 z
i
z
i ,z i )( t ′ i + 1 − t ′ i ) , and the new update is ( x i + 1 ,z
i + 1 ) =
( x i ,z i ) − ( v [Equation] ˜ x [Equation]
[Equation]
v [Equation]
˜ x i ) [Equation] i ∫
[Equation] z ( t [Figure] ) dt ′ , ∫ t
[Figure]
z ( t ′ ) dt ′ ) .
We empirically observe that the new update scheme significantly improve the FID score.
C Failure of VE/VP-ODE on NCSNv2 backbone
In Fig. 5(a), we demonstrate the trajectories of cleaner samples/noisier samples/noisier samples w/ corrector.
We visualize these three groups in Fig.
9(a) and Fig. 9(b).
The noisier samples are marked with red boxes in Fig.
9(a) and the remaining images in Fig.
9(a) are cleaner samples.
The samples within green boxes in Fig. 9(b) are noisier samples w/ corrector.
Samples on the same spatial locations in the two figures are generated by identical initial latents.
The Gaussian kernels in score-based models are N( x ,σ ( t ) 2 ) (VE) and N(√ 1 − σ ( t ) 2 x ,σ ( t ) 2 ) (VP) [33].
When σ ( t ) is large, the norms of perturbed samples are approximately √ Nσ ( t ) .
The backward
ODE could break down if the trajectories diverge from the norm- σ ( t ) relation, as shown by the noisier samples’ trajectories in Fig. 5(a).
In contrast, the norm distributions of PFGM is approximately p (∥ x ∥)
∝ ∥ x ∥ N − 2/(∥ x
∥ 22 + z 2 ) N 2 when z is large (see deviation for p prior in Appendix A.4), which have a wider span for high density region (see Fig. 4).
The weak correlation between norm and z makes PFGM more robust on the lighter NCSNv2 backbone.
D Extra Experiments D.1 LSUN Bedroom 256 ×
We report the FID scores and NFEs for LSUN bedroom dataset in Table 6.
We adopt the code base of [33] in our experiments.
In [33], they experimented on the LSUN bedroom 256 × 256 dataset only on VE-SDE using a deeper NCSN++ backbone.
In our DDPM++ architecture, we directly borrow the configuration of channels from the NCSN++ architecture [33] in each residual block (PFGM w/
NCSN++ channel).
We further change z max to 100 , as it empirically gives better sample quality.
We also evaluate the performance when using the configuration of channels in the DDPM [16] architecture (PFGM w/ DDPM channel).
We use the RK45 [7] solver in the Scipy library [37] for
PFGM sampling.
We report the FID score using the evaluation protocol in [5]. [Table]
[Table]
Table 6 shows that PFGM has comparable performance with VE-SDE when using DDPM channel, while achieving around 15 × acceleration.
We observe that PFGM achieves a better FID score using the similar configuration in the DDPM model, and converges faster — 150k over the total 2.4M training iterations suggested in [33].
Remarkably, the VE-ODE baseline — the method most comparable to ours — only produces noisy samples on this dataset.
It suggests that PFGM is able to scale up to high resolution images when using advanced architectures.
We also compare with the number reported in [16] using similar architecture.
Note that DDPM requires 1000 NFE during sampling, and doesn’t possess invertibility compared to flow models.
D.2 Results on NCSNv2 Architecture
In this section, we demonstrate the image generation on CIFAR-10 and CelebA 64 × 64 , using
NCSNv2 architecture [32], which is the predecessor of NCSN++ and DDPM++ [33] and has smaller capacity.
Since the VE/VP-ODE has poor performance (FID greater than 90), with the RK45 solver, we also apply the forward Euler method ( Euler ) with fixed number of steps.
We explicitly name the sampler, with forward Euler method as predictor and Langevin dynamics as corrector, as Euler w/ corrector .
For Euler w/ corrector in VE/VP-ODE, we use the probability flow ODE (reverse-time
ODE) as the predictor and the Langevin dynamics (MCMC) as the corrector.
We borrow all the hyper-parameters from [33] except for the signal-to-noise ratio.
We empirically observe the new configurations in Table 7 give better results on the NCSNv2 architecture.
To accommodate the extra dimension z on NCSNv2, we concatenate the image with an additional constant channel with value z and thus the first convolution layer takes in four input channels.
We also add an additional output channel to the final convolution layer and take the global average pooling of this channel to obtain the direction on z .
[Table]
Table 8 reports the image quality measured by Inception/FID scores and the inference speed measured by NFE on CIFAR-10, using a weaker architecture NCSNv2 [32].
We show that PFGM with the RK45 solver has competitive FID/Inception scores with the Langevin dynamics, which was the best model on the NCSNv2 architecture before, and requires 10 × less NFE.
In addition, PFGM performs better than all the other ODE samplers.
Our method is more tolerant of sampling error.
Among the compared ODEs, our backward ODE (Eq. (6)) is the only one that successfully generates high quality samples while the VE/VP-ODE fail w/o the Langevin dynamics corrector.
The backward ODE still beats the baselines w/ corrector.
[Table]
D.2.2 CelebA
In Table
[Table]
we report the quality of images generated by models trained on CelebA 64 × 64 , as measured by the FID scores
[Table]
and the sampling speed, as measured by NFE.
We use this dataset as our preliminary experiments hence we only apply NCSNv2 [32] for different baselines.
As shown in
Table 9, PFGM achieves best FID scores than all the baselines on CelebA dataset, while accelerating the inference speed around 20 × .
Remarkably, PFGM outperforms the Langevin dynamics and reverse-time SDE samplers, which are usually considered better than their deterministic counterparts.
Remark:
On the FID scores on CelebA 64 × 64 One interesting observation is that the samples of PFGM (RK45) (Fig. 10(b)) contain more obvious artifacts than Langevin dynamics (Fig. 10(a)), although PFGM has a lower FID score on the same architecture.
We hypothesize that the diversity of samples has larger effects on the FID scores than the artifacts.
As shown in Fig.
10(a) and Fig.
10(b), samples generated by PFGM have more diverse background colors and hair colors than samples of
Langevin dynamics.
In addition, we evaluate the performance of PFGM on the DDPM++ architecture.
We show that the FID score can be further reduced to 3 .
68 using the more advanced DDPM++ architecture.
By examining the generated samples of PFGM on DDPM++ (Fig. 14), we observe that the samples are diverse and exhibit fewer artifacts than PFGM on NCSNv2.
It suggests that by using a more powerful architecture like DDPM++, we can remove the artifacts while retaining the diversity in PFGM.
D.3 Wall-clock Sampling Time
The main bottleneck of sampling time in each ODE step is the function evaluation of the neural network.
Hence, for different ODE equations using similar neural network architectures, their inference times per ODE step are approximately the same.
We implement PFGM on the NCSNv2 [32], DDPM++ [33], and DDPM++ deep [33] architectures, with sight modifications to account for the extra dimension z .
In Table 10, we report the sampling time per ODE step method with the DDPM++ backbone, as well as the total sampling time.
We measure the sampling time of generating a batch of 1000 images on CIFAR-10.
We compare PFGM,
VP/sub-VP ODEs using the RK45 solver.
As a reference, we also report the results of VP-SDE using the predictor-corrector sampler [33].
All the numbers are produced on a single NVIDIA A100 GPU.
As expected, ODEs using similar architectures and the same solver have nearly the same wall-clock time per ODE step.
The table also shows that PFGM achieves the smallest total wall-clock sampling time. [Figure]
[Table]
D.4 Image Interpolations
The invertibility of the ODE in PFGM enables the interpolations between pairs of images.
As shown in Fig.
[Table] we adopt the spherical interpolations between the latent representations of the images in the first and last column. [Table]
D.5 Temperature Scaling
To demonstrate more utilities of the meaningful latent space of PFGM, we include the experiments of temperature scaling on CelebA 64 × 64 dataset.
We linearly increase the norm of latent codes from 1000 to 6000 to get the samples in Fig.
E Extended Examples
We provide extended samples from PFGM on CIFAR-10 (Fig. 13), CelebA 64 × 64 (Fig. 14) and
LSUN bedroom 256 × 256 (Fig. 15) datasets.
F Physical Interpretation of the ODEs in PFGM
In Section 2, in order to move the particles along the electric lines, we set the time derivative of x to the Poisson field E ( x ) :
[Equation]
We give the interpretation of the ODEs from a physical perspective.
Newton’s law implies that the external force is proportional to the acceleration of the particle.
In the overdamped limit, e.g., when the particle is moving in honey, the external force is instead proportional to the velocity of the particle, making the equation of motion a first-order ODE.
Denoting the viscosity of the fluid as γ , the dynamics of the particle under the influence of the electric field of the source ρ ( x ) is
[Equation]
which has an overdamped limit d x dt = q E ( x ) when we set t → γt and γ → ∞ .
In this case, a particle with mass m = 1 and charge q = 1 would follow the electric field with velocity equal to E , justifying
Eq.
G Limitations and Future Directions
In Section 3.2 we discuss the training paradigm of PFGM, including the normalized Poisson field and the discretized forward ODE.
There are several potential improvements.
First, the normalized field on mini-batch is biased.
In this paper, we directly alleviate the bias by using a larger training batch.
However, it does not solve the problem fundamentally.
Some potential directions are incorporating more physical tools: we can exploit renormalization to make the Poisson field well-behaved in near fields.
Another possibility is to replace a point charge with a quantum particle, whose position uncertainty fills the empty space among nearest neighbor data samples and makes the data manifold smoother.
H Potential Social Impact
Generative models is a rapidly growing field of study with far-reaching implications for science and society.
Our work proposes a new generative model that allows for high-quality samples, quick inference and adaptivity.
Many downstream applications benefit from our PFGM models’ powerful expressive capabilities, particularly those that need fast inference speed and good sample quality at the same time.
The usage of these models might have both positive and negative outcomes depending on the downstream use case.
For example, PFGM can be incorporated in producing good image/audio samples by the fast backward ODE.
This, on the other hand, promotes deepfake technology and leads to social scams.
Generative models are also brittle and susceptible to backdoor adversarial attacks on publicly available training data, causing unanticipated failure.
Addressing the above concerns requires further research in providing robustness guarantees for generative models as well as close collaborations with researchers in socio-technical disciplines.