VP diffusion schedules (spec layer) #
This file defines a discrete-time variance-preserving (VP) schedule for diffusion models.
We follow the common DDPM-style discrete schedule:
- choose
Tsteps and a sequence ofβ₀, …, β_{T-1}with0 ≤ β_t < 1, - define
α_t := 1 - β_t, - define the cumulative product
ᾱ_0 := 1andᾱ_{t+1} := ᾱ_t * α_t.
Then the forward noising kernel is (informally):
x_t = sqrt(ᾱ_t) x_0 + sqrt(1-ᾱ_t) ε where ε ~ N(0, I).
We keep the schedule scalar-polymorphic (Context α) so the same definitions can be reused under:
Float(fast runtime execution),IEEE32Exec/NeuralFloat(proof-relevant floating-point models),- interval-like scalars (verification), and
ℝ(mathematical proofs).
References (informal pointers):
- Ho, Jain, Abbeel (2020), "Denoising Diffusion Probabilistic Models" (DDPM).
Fetch β_t as a scalar.
Instances For
α_t := 1 - β_t.
Instances For
Compute ᾱ_t for t : Fin (T+1) with the convention:
ᾱ_0 = 1,ᾱ_{t+1} = ᾱ_t * α_t.
Implementation note: we define an auxiliary recursion on Nat and then package it as a Fin
function; this keeps the definition total and easy to evaluate.
Instances For
Instances For
Vector form of alphaBar (length T+1).
Instances For
Simple constructors #
These are convenience constructors for examples and demos. We intentionally keep them small and deterministic; large-scale training pipelines usually want explicit control over schedules.
Linear β schedule over T steps: β_t interpolates from β_start to β_end.
Note: this is a small spec helper. Popular schedules in the diffusion literature often use variants such as cosine schedules or continuous VP schedules; add those as separate named specs when a model or theorem needs them.
Instances For
Build a schedule from a linear beta ramp.