The pathwise estimator is not always the quieter one
counterexample▲▲△
Let q=N(μ,1) at μ=0 and f(z)=sin(10z). Find the true
derivative of Eq[f(z)] with respect to μ, and the variances of the
pathwise estimate f′(z) and the score-function estimate
f(z)(z−μ).
Hint
For z∼N(μ,1), E[cos(ωz)]=cos(ωμ)e−ω2/2.
Use cos2t=21(1+cos2t).
Solution
The truth.Eq[sin(10z)]=sin(10μ)e−50, so the derivative at
μ=0 is 10e−50=1.9×10−21: zero to any printed precision.
Pathwise. The estimate is 10cos(10z). Its mean is the derivative,
and its second moment is
100E[cos2(10z)]=50(1+e−200). Its variance is therefore
50 to every printed digit.
Score function. The estimate is sin(10z)z. Its mean is also the
derivative. Its second moment is
E[sin2(10z)z2]=21E[z2]−21E[z2cos(20z)], and the
second average is −399e−200, so the variance is 0.5 to every
printed digit.
So the pathwise estimate is a hundred times noisier here. It reads the
slope of f at the draw, and a function that oscillates ten times per
unit has slopes of size ten everywhere, which cancel only on average. The
score function reads the value of f, which never exceeds one. The claim
broken is that reparameterisation always lowers the variance. It does for
the smooth, slowly varying log-likelihoods of a VAE decoder; it does not
in general.