= Solution
The discrete base factors in the displayed construction inherit their variational parameters. Accordingly write \b[$s_\lambda(\varepsilon)$], not a parameter-independent $s(\varepsilon)$, for the joint base <probability mass function> or <probability density function>. The continuous noise factors can be parameter independent while the discrete factors are $\lambda$ dependent. Calling the entire base law parameterless while retaining its nonzero <score function> would be inconsistent.
Let $t_\lambda$ push the base law forward to $q_\lambda$, and define
$$
W_\lambda(\varepsilon,x)=\log p(t_\lambda(\varepsilon),x)-\log q_\lambda(t_\lambda(\varepsilon)).
$$
Use a fixed base <measure> $\nu$, with <counting measure> for discrete coordinates and <Lebesgue measure> for continuous coordinates. Assume locally parameter-independent support, differentiability and an integrable domination permitting <differentiation under the integral sign>. A valid <reparameterization gradient> gives
$$
\mathcal L(\lambda)=\int s_\lambda(\varepsilon)W_\lambda(\varepsilon,x)\,d\nu(\varepsilon).
$$
Apply the <product rule> before simplifying:
$$
\begin{aligned}
\nabla_\lambda\mathcal L
&=\int\left[(\nabla_\lambda s_\lambda)W_\lambda+s_\lambda\nabla_\lambda W_\lambda\right]d\nu\\
&=\mathbb E_{s_\lambda}\left[(\nabla_\lambda\log s_\lambda(\varepsilon))W_\lambda(\varepsilon,x)+\nabla_\lambda W_\lambda(\varepsilon,x)\right]\\
&=\mathbb E_{s_\lambda}\left[(\nabla_\lambda\log s_\lambda(\varepsilon))W_\lambda(\varepsilon,x)+\nabla_\lambda\log p(t_\lambda(\varepsilon),x)-\nabla_\lambda\log q_\lambda(t_\lambda(\varepsilon))\right].
\end{aligned}
$$
This is the required <combined score and pathwise gradient estimator>. A sample from $s_\lambda$ and the integrand on the last line give an <unbiased stochastic gradient> under the stated regularity conditions. Its first term is a <score-function gradient estimator> contribution; the remaining terms differentiate the sampled objective along the continuous transformation. The same separation appears in the general <stochastic computation graph> construction.<Gradient Estimation Using Stochastic Computation Graphs by John Schulman and others>[Section 3.1, Theorem 1, equations (5)–(6); Appendix A]{ref}
All derivatives inside the <expectation> hold $\varepsilon$ fixed. They still include both explicit parameter dependence and dependence through $t_\lambda$. For a continuous coordinate $z=t_\lambda(\varepsilon)$,
$$
\nabla_\lambda\log q_\lambda(t_\lambda(\varepsilon))=(\partial_\lambda\log q_\lambda)(z)+(D_\lambda t_\lambda)^T\nabla_z\log q_\lambda(z).
$$
The model joint density $p(z,x)$ is fixed as $\lambda$ changes, but its composition with $t_\lambda$ need not be constant. Discrete coordinates are not differentiated as real-valued paths; their changing <probabilities> enter through the <score function>. Moving supports or parameter-dependent branch boundaries require additional care and are not justified merely by formally interchanging a derivative and an integral.
Back to article page