Skip to content
class

VESDE

extendsSDE
VESDE(sigma_min: float = 0.01, sigma_max: float = 50.0)

Variance Exploding — the continuous limit of NCSN.

Parameters

sigma_minfloat= 0.01
The geometric noise range.
sigma_maxfloat= 0.01
The geometric noise range.

Notes

Song et al. (2021), equation 30:

dx=σmin⁡(σmax⁡σmin⁡)t2log⁡σmax⁡σmin⁡  dw,t∈(0,1],dx = \sigma_{\min}\left(\frac{\sigma_{\max}}{\sigma_{\min}}\right)^t \sqrt{2\log\frac{\sigma_{\max}}{\sigma_{\min}}}\; dw, \qquad t \in (0, 1],

with the perturbation kernel of equation 31, N(x(t);x(0),σ(t)2I)\mathcal{N}(x(t); x(0), \sigma(t)^2 I) — the mean does not move, which is what "variance exploding" means.

Defined on the open interval. The paper is explicit that σ\sigma is not differentiable at zero because σ(0)=0\sigma(0) = 0 by the discrete convention while σ(0+)=σmin⁡\sigma(0^+) = \sigma_{\min}, "causing the VE SDE ... undefined for t = 0". Sampling therefore stops at t_min rather than running to zero.

Examples

>>> from lucid.models.generative.score_sde._sde import VESDE
>>> sde = VESDE(sigma_min=0.01, sigma_max=50.0)
>>> sde.prior_variance
2500.0
Variance exploding: the prior is as wide as sigma_max squared, so
the terminal distribution is nothing like the data and the model
learns the whole way down.

Used by 2

Constructors

1
dunder

__init__

→None
__init__(sigma_min: float = 0.01, sigma_max: float = 50.0)

Initialise the SDE. See the class docstring for parameters.

Properties

2
prop

prior_variance

→float
prior_variance: float

σmax⁡2\sigma_{\max}^2.

prop

t_min

→float
t_min: float

Sampling stops here — see the class docstring on t = 0.

Instance methods

5
fn

drift

→Tensor
drift(x: Tensor, t: Tensor)

Zero — the VE process only adds variance.

fn

marginal_prob

→tuple[Tensor, Tensor]
marginal_prob(x: Tensor, t: Tensor)

Equation 31 — the mean is the sample itself.

fn

prior_sampling

→Tensor
prior_sampling(shape: tuple[int, ...], device: str, dtype: lucid.dtype | None = None)

N(0,σmax⁡2I)\mathcal{N}(0, \sigma_{\max}^2 I).

fn

sigma

→Tensor
sigma(t: Tensor)

σ(t)=σmin⁡(σmax⁡/σmin⁡)t\sigma(t) = \sigma_{\min}(\sigma_{\max}/\sigma_{\min})^t.