Reparameterization trick
The reparameterization trick (aka "reparameterization gradient estimator") is a technique used in statistical machine learning, particularly in variational inference, variational autoencoders, and stochastic optimization.[src] It allows for the efficient computation of gradients through random variables, enabling the optimization of parametric probability models using stochastic gradient descent, and the variance reduction of estimators.[src] It was developed in the 1980s in operations research, under the name of "pathwise gradients", or "stochastic gradients".[src] Its use in variational inference was proposed in 2013.[src]
The reparameterization trick (aka "reparameterization gradient estimator") is a technique used in statistical machine learning, particularly in variational inference, variational autoencoders, and stochastic optimization.[src] It allows for the efficient computation of gradients through random variables, enabling the optimization of parametric probability models using stochastic gradient descent, and the variance reduction of estimators.[src] It was developed in the 1980s in operations research, under the name of "pathwise gradients", or "stochastic gradients".[src] Its use in variational inference was proposed in 2013.[src] Consider an objective function of the form: L(\phi) = \mathbb{E}_{z \sim q_\phi(z)}[f(z)] Without the reparameterization trick, estimating the gradient \nabla_\phi L(\phi) can be challenging, because the parameter appears in the random variable itself.[src] In more detail, we have to statistically estimate: \nabla_\phi L(\phi) = \nabla_\phi \int dz \; q_\phi(z) f(z) The REINFORCE estimator, widely used in reinforcement learning and especially policy gradient, uses the following equality: \nabla_\phi L(\phi) = \int dz \; q_\phi(z) \nabla_\phi(\ln q_\phi(z)) f(z) = \mathbb{E}_{z \sim q_\phi(z)}[\nabla_\phi(\ln q_\phi(z)) f(z)] This allows the gradient to be estimated: \nabla_\phi L(\phi) \approx \frac 1N \sum_{i=1}^N \nabla_\phi(\ln q_\phi(z_i)) f(z_i) The REINFORCE estimator has high variance, and many methods were developed to reduce its variance.[src] The reparameterization trick expresses z as: z = g_\phi(\epsilon), \quad \epsilon \sim p(\epsilon) Here, g_\phi is a deterministic function parameterized by \phi , and \epsilon is a noise variable drawn from a fixed distribution p(\epsilon) .[src] This gives: L(\phi) = \mathbb{E}_{\epsilon \sim p(\epsilon)}[f(g_\phi(\epsilon))] Now, the gradient can be estimated as: \nabla_\phi L(\phi) = \mathbb{E}_{\epsilon \sim p(\epsilon)}[\nabla_\phi f(g_\phi(\epsilon))] \approx \frac 1N \sum_{i=1}^N \nabla_\phi f(g_\phi(\epsilon_i)) Normal distribution: For z \sim \mathcal{N}(\mu, \sigma^2) , we can use: z = \mu + \sigma \epsilon, \quad \epsilon \sim \mathcal{N}(0, 1) Exponential distribution: For z \sim \text{Exp}(\lambda) , we can use: z = -\frac{1}{\lambda} \log(\epsilon), \quad \epsilon \sim \text{Uniform}(0, 1) Discrete distribution can be reparameterized by the Gumbel distribution (Gumbel-softmax trick or "concrete distribution") and diffusion models.[src] In general, any distribution that is differentiable with respect to its parameters can be reparameterized by inverting the multivariable CDF function, then apply the implicit method.[src] See for an exposition and application to the Gamma, Beta, Dirichlet, and von Mises distributions.[src] \text{ELBO}(\phi, \theta) = \mathbb{E}_{z \sim q_\phi(z|x)}[\log p_\theta(x|z)] - D_{\text{KL}}(q_\phi(z|x) || p(z)) where q_\phi(z|x) is the encoder (recognition model), p_\theta(x|z) is the decoder (generative model), and p(z) is the prior distribution over latent variables.[src] The gradient of ELBO with respect to \theta is simply \mathbb{E}_{z \sim q_\phi(z|x)}[\nabla_\theta \log p_\theta(x|z)] \approx \frac{1}{L} \sum_{l=1}^L \nabla_\theta \log p_\theta(x|z_l) but the gradient with respect to \phi requires the trick.[src] Express the sampling operation z \sim q_\phi(z|x) as: z = \mu_\phi(x) + \sigma_\phi(x) \odot \epsilon, \quad \epsilon \sim \mathcal{N}(0, I) where \mu_\phi(x) and \sigma_\phi(x) are the outputs of the encoder network, and \odot denotes element-wise multiplication.[src] Then we have \nabla_\phi \text{ELBO}(\phi, \theta) = \mathbb{E}_{\epsilon \sim \mathcal{N}(0, I)}[\nabla_\phi \log p_\theta(x|z) - \nabla_\phi \log q_\phi(z|x) + \nabla_\phi \log p(z)] where z = \mu_\phi(x) + \sigma_\phi(x) \odot \epsilon .[src] This allows us to estimate the gradient using Monte Carlo sampling: \nabla_\phi \text{ELBO}(\phi, \theta) \approx \frac{1}{L} \sum_{l=1}^L [\nabla_\phi \log p_\theta(x|z_l) - \nabla_\phi \log q_\phi(z_l|x) + \nabla_\phi \log p(z_l)] where z_l = \mu_\phi(x) + \sigma_\phi(x) \odot \epsilon_l and \epsilon_l \sim \mathcal{N}(0, I) for l = 1, \ldots, L .[src] This formulation enables backpropagation through the sampling process, allowing for end-to-end training of the VAE model using stochastic gradient descent or its variants.[src] More generally, the trick allows using stochastic gradient descent for variational inference.[src] Let the variational objective (ELBO) be of the form: \text{ELBO}(\phi) = \mathbb{E}_{z \sim q_\phi(z)}[\log p(x, z) - \log q_\phi(z)] Using the reparameterization trick, we can estimate the gradient of this objective with respect to \phi : \nabla_\phi \text{ELBO}(\phi) \approx \frac{1}{L} \sum_{l=1}^L \nabla_\phi [\log p(x, g_\phi(\epsilon_l)) - \log q_\phi(g_\phi(\epsilon_l))], \quad \epsilon_l \sim p(\epsilon) The reparameterization trick has been applied to reduce the variance in dropout, a regularization technique in neural networks.[src] The original dropout can be reparameterized with Bernoulli distributions: y = (W \odot \epsilon) x, \quad \epsilon_{ij} \sim \text{Bernoulli}(\alpha_{ij}) where W is the weight matrix, x is the input, and \alpha_{ij} are the (fixed) dropout rates.[src] More generally, other distributions can be used than the Bernoulli distribution, such as the gaussian noise: y_i = \mu_i + \sigma_i \odot \epsilon_i, \quad \epsilon_i \sim \mathcal{N}(0, I) where \mu_i = \mathbf{m}_i^\top x and \sigma_i^2 = \mathbf{v}_i^\top x^2 , with \mathbf{m}_i and \mathbf{v}_i being the mean and variance of the i -th output neuron.[src] The reparameterization trick can be applied to all such cases, resulting in the variational dropout method.[src]
25 sentences · 25 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Reparameterization trick." encyclopegia.org, 2026, https://encyclopegia.org/wiki/reparameterization-trick. Accessed 28 November 2026.
Chicago
"Reparameterization trick." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/reparameterization-trick.
APA
encyclopegia.org. (2026). Reparameterization trick. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/reparameterization-trick
Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON