Reparameterization of Target
The original diffusion update was given by
z t = α t ⋅ x + 1 − α t ⋅ ϵ
Recall that in the original diffusion loss function was:
L [ ϕ 1 … T ] = i = I ∑ I reconstruction term − log [ Norm x i [ f 1 [ z i 1 , ϕ 1 ] , σ 1 2 I ] ] + t = 2 ∑ T 2 σ t 2 1 target, mean of q ( z t − 1 ∣ z t , x ) 1 − α t 1 − α t − 1 1 − β t z i t + 1 − α t α t − 1 β t x i − predicted z t − 1 f t [ z i t , ϕ t ] 2
where the original form of the KL divergence as:
D K L [ q ( z t − 1 ∣ z t , x ) ∣∣ P r ( z t − 1 ∣ z t , ϕ t )] = 2 σ t 2 1 1 − α t ( 1 − α t − 1 ) 1 − β t z t + 1 − α t α t − 1 β t x − f t [ z t , ϕ t ] 2 + C
The data term x in the KL divergence can be expressed as the diffused image minus the noise that was added to it:
x = α t 1 ⋅ z t − α t 1 − α t ⋅ ϵ
Substituting this into the target terms from the original loss function gives:
1 − α t ( 1 − α t − 1 ) 1 − β t z t + 1 − α t α t − 1 β t x = 1 − α t ( 1 − α t − 1 ) 1 − β t z t + 1 − α t α t − 1 β t ( α t 1 z t − α t 1 − α t ϵ ) = 1 − α t ( 1 − α t − 1 ) 1 − β t z t + 1 − α t β t ( 1 − β t 1 z t − 1 − β t 1 − α t ϵ )
where we have used the fact that α t / α t − 1 = 1 − β t between the second and third lines.
Simplifying further, we get:
1 − α t 1 − α t − 1 1 − β t z t + 1 − α t α t − 1 β t x = ( 1 − α t ( 1 − α t − 1 ) 1 − β t + ( 1 − α t ) 1 − β t β t ) z t − 1 − α t 1 − β t β t ϵ = ( ( 1 − α t ) 1 − β t ( 1 − α t − 1 ) ( 1 − β t ) + ( 1 − α t ) 1 − β t β t ) z t − 1 − α t 1 − β t β t ϵ = ( 1 − α t ) 1 − β t ( 1 − α t − 1 ) ( 1 − β t ) + β t z t − 1 − α t 1 − β t β t ϵ = ( 1 − α t ) 1 − β t 1 − α t z t − 1 − α t 1 − β t β t ϵ = 1 − β t 1 z t − 1 − α t 1 − β t β t ϵ .
where we multiplied the numerator and denominator of the first term by 1 − β t between lines 2 and 3, multiplied out the terms, and then simplified the numerator in the first term between lines 3 and 4.
Substituting this back into the loss function, we have:
L [ ϕ 1 … T ] = i = 1 ∑ I ( − log [ Norm x i [ f 1 [ z i 1 , ϕ 1 ] , σ 1 2 I ]] + t = 2 ∑ T 2 σ t 2 1 ( 1 − β t 1 z i t − 1 − α t 1 − β t β t ϵ i t − f t [ z i t , ϕ t ] 2 ) 2 )
Reparameterization of network
Now we replace the model z ^ t − 1 = f t [ z t , ϕ t ] with a new model ϵ ^ = g t [ z t , ϕ t ] , which predicts the noise ϵ that was mixed with x to create z t :
f t [ z t , ϕ t ] = 1 − β t 1 z t − 1 − α t 1 − β t β t g t [ z t , ϕ t ]
Substituting the new model our loss function produces the criterion:
L [ ϕ 1 … T ] = i = 1 ∑ I − log [ Norm x i [ f 1 [ z i 1 , ϕ 1 ] , σ 1 2 I ] ] + t = 2 ∑ T ( 1 − α t ) ( 1 − β t ) 2 σ t 2 β t 2 ∣ ∣ g t [ z i t , ϕ t ] − ϵ i t ∣ ∣ 2
The log normal can be written as a least squares loss plus a constant C i :
L [ ϕ 1 … T ] = i = 1 ∑ I 2 σ 1 2 1 ∣ ∣ x i − f 1 [ z i 1 , ϕ 1 ] ∣ ∣ 2 + t = 2 ∑ T ( 1 − α t ) ( 1 − β t ) 2 σ t 2 β t 2 ∣ ∣ g t [ z i t , ϕ t ] − ϵ i t ∣ ∣ 2
Substituting in the definitions of x and f 1 [ z 1 , ϕ 1 ] from above, the first term simplifies to
2 σ 1 2 1 x i − f 1 [ z i 1 , ϕ 1 ] 2 = 2 σ 1 2 1 1 − α 1 1 − β 1 β 1 g 1 [ z i 1 , ϕ 1 ] − 1 − α 1 1 − β 1 β 1 ϵ i 1 2
Adding this back to the final loss function yields:
L [ ϕ 1 … T ] = i = 1 ∑ I t = 1 ∑ T ( 1 − α t ) ( 1 − β t ) 2 σ t 2 β t 2 g t [ z i t , ϕ t ] − ϵ i t 2
where we have disregarded the additive constants C i .
In practice, the scaling factors (which might be different at each time step) are ignored, giving an even simpler formulation:
L [ ϕ 1 … T ] = i = 1 ∑ I t = 1 ∑ T g t [ z i t , ϕ t ] − ϵ i t 2 = i = 1 ∑ I t = 1 ∑ T g t [ α t ⋅ x i + 1 − α t ⋅ ϵ i t , ϕ t ] − ϵ i t 2
where we have rewritten z t using the diffusion kernel in the second line.