Use the model of I.13.B01:
w=3u1, σ2=1, x=(1,2), so
wTx=23 and ∥w∥2=3. The encoder returns
m=0.5 and s=0.5, and the draw is ε=0.6. Compute the
one-draw gradient of the ELBO with respect to m and s, then the exact
gradient with respect to m.
Hint
The reconstruction term is −∥x−wz∥2/2 plus a constant, with
z=m+sε. The KL term is 21(m2+s2−1−logs2).
Solution
The code is z=0.5+0.5⋅0.6=0.8. The derivative of the reconstruction
term with respect to z is
wT(x−wz)=23−3⋅0.8=1.064102.
Since ∂z/∂m=1 and ∂z/∂s=ε,
and the KL has derivatives m and s−1/s,
The exact gradient with respect to m averages over ε. The
reconstruction derivative is linear in z, so its average is its value at
z=m: 23−1.5=1.964102. Subtracting the KL’s 0.5 gives
1.464102. The single draw underestimated it by 0.9, because
ε=0.6 moved the code above its mean; an ε of
−0.6 would have overestimated it by the same amount.
Both one-draw derivatives point uphill. An unbiased estimate need not be
close; it needs only to be right on average, which is all stochastic
gradient ascent requires.