You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flowde: PyTorch-based solver for the reverse-time diffusion equation
Reverse-Time Ordinary Differential Equation (ODE)
Let $x(t) \in \mathbb{R}^d$ be a $d$-dimensional vector with probability density $p(x)$ defined on the domain $t \in [0, 1]$.
In Refs.~[1,2,3], it is noted that the reverse-time ODE
maps $x_1 \equiv x(t=1) \sim p(x_1)$ to $x_0 \equiv x(t=0) \sim p(x_0)$deterministically, where $p(x_1)$ is a diagonal $d$-dimensional standard normal density and $p(x_0)$ is a target $d$-dimensional density for which we have a point cloud, ${\cal D} = \{ x_0^{(j)}\}_{j=1}^M$. In a typical application, ${\cal D}$ is generated using a simulator. The probability density $p(x)$ smoothly interpolates between $p(x_1)$ and $p(x_0)$ and $S(t, x)$ is the associated score function. Using the definitions of the functions $f(t)$ and $g(t)$ given in Ref.[1], and after some manipulation, these equations can be written as
If the function $\alpha(t)$ is chosen so that it goes to zero as $t \rightarrow 1$, while $\sigma(t)$ remains finite in that limit, then, by construction, the vector $x_1$ will be distributed according to a diagonal $d$-dimensional zero mean normal with variance $\sigma_1^2$ irrespective of the density $p(x_0)$. The $d$-dimensional normal is a fixed point of the SDE. In Ref. [3], the choice is $\alpha = 1 - t$, $\sigma(t) = \sqrt{t}$. In this project, we choose
where, following Ref.[3], the integrals that define the vector field $q(t, x)$ are approximated by Monte Carlo integration using the point cloud ${\cal D}$. In principle, FlowDE works for any dimension $d$; in practice, FlowDE is limited by the available GPU memory. For $N$ points $x_1 \sim p(x_1)$, that is, $N$ solutions computed in parallel, using a point cloud of size $M$, FlowDE needs to store a minimum of $N \times M \times d$ 32-bit floating point numbers.
Example
The notebook tutorial.ipynb illustrates the usage FlowDE using a simple 2D density.
References
Yang Song, Jascha Narain Sohl-Dickstein, Ben Poole, Score-Based Generative Modeling through Stochastic Differential Equation, International Conference on Learning Representations, 26 November 2020; https://arxiv.org/abs/2011.13456
Cheng Lu†, Yuhao Zhou†, Fan Bao†, Jianfei Chen†, Chongxuan Li‡, Jun Zhu, DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps, arXiv:2206.00927v3, 13 Oct 2022.
Yanfang Lui, Minglei Yang, Zezhong Zhang, Feng Bao, Yanzhao Cao, and Guannan Zhang, Diffusion-Model-Assisted Supervised Learning of Generative Models for Density Estimation, arXiv:2310.14458v1, 22 Oct 2023
About
PyTorch-based solver for the reverse-time diffusion equation