Md. Asif Uddin
    I.13.X10

    The pathwise estimator is not always the quieter one

    counterexample▲▲△

    Let q=N(μ,1)q=\mathcal N(\mu,1) at μ=0\mu=0 and f(z)=sin⁡(10z)f(z)=\sin(10z). Find the true derivative of Eq[f(z)]\E_q[f(z)] with respect to μ\mu, and the variances of the pathwise estimate f′(z)f'(z) and the score-function estimate f(z)(z−μ)f(z)(z-\mu).

    Hint

    For z∼N(μ,1)z\sim\mathcal N(\mu,1), E[cos⁡(ωz)]=cos⁡(ωμ)e−ω2/2\E[\cos(\omega z)]=\cos(\omega\mu)e^{-\omega^2/2}. Use cos⁡2t=12(1+cos⁡2t)\cos^2t=\tfrac12(1+\cos2t).

    Solution

    The truth. Eq[sin⁡(10z)]=sin⁡(10μ)e−50\E_q[\sin(10z)]=\sin(10\mu)e^{-50}, so the derivative at μ=0\mu=0 is 10e−50=1.9×10−2110e^{-50}=1.9\times10^{-21}: zero to any printed precision.

    Pathwise. The estimate is 10cos⁡(10z)10\cos(10z). Its mean is the derivative, and its second moment is 100 E[cos⁡2(10z)]=50(1+e−200)100\,\E[\cos^2(10z)]=50\big(1+e^{-200}\big). Its variance is therefore 5050 to every printed digit.

    Score function. The estimate is sin⁡(10z) z\sin(10z)\,z. Its mean is also the derivative. Its second moment is E[sin⁡2(10z) z2]=12E[z2]−12E[z2cos⁡(20z)]\E[\sin^2(10z)\,z^2]=\tfrac12\E[z^2]-\tfrac12\E[z^2\cos(20z)], and the second average is −399 e−200-399\,e^{-200}, so the variance is 0.50.5 to every printed digit.

    So the pathwise estimate is a hundred times noisier here. It reads the slope of ff 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 ff, 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.

    Draws on