Reparameterization trick
The reparameterization trick expresses a random variable as a deterministic function of parameter-independent noise and distribution parameters, enabling gradients to pass through stochastic sampling.
Build AI Drug Discovery Pipelines
The reparameterization trick expresses stochastic sampling from a parameterized distribution as a differentiable transformation of distribution parameters and independent noise.
- How it is used
- Enables training a molecular variational autoencoder despite random latent sampling.
- How deep it goes
- Connects Gaussian distribution parameters and standard-normal noise to latent sampling, while deferring longer probabilistic derivations.
- Examples
- Uses a SMILES molecular encoding pipeline and an end-to-end forward pass that samples a latent vector before decoding.
- What you can do after
- Apply it via PyTorch in a molecular VAE that encodes distribution parameters and decodes a sampled latent vector.
Read how Build AI Drug Discovery Pipelines explains reparameterization trick →
Applied Reinforcement Learning
A stochastic-gradient technique that expresses a random sample as a deterministic transformation of parameter-independent noise.
- How it is used
- Enables gradients to flow through stochastic action sampling when training a policy by backpropagation.
- How deep it goes
- Explains the noise transformation and its gradient benefit, then shows its use in Gaussian action sampling.
- Examples
- Illustrates sampling fan and valve controls for data-center cooling, then squashing actions into the 0–1 range.
- What you can do after
- Apply Normal.rsample() to generate differentiable stochastic actions for policy learning.
Read how Applied Reinforcement Learning explains reparameterization trick →
Causal AI
A reparameterization trick rewrites a stochastic variable as a deterministic function of newly introduced exogenous random variables while preserving its marginal distribution.
- How it is used
- Converts causal generative models into structural causal models with explicit exogenous noise and deterministic assignments.
- How deep it goes
- Explains normal and discrete constructions, then cautions that distributional preservation does not identify a unique causal model.
- Examples
- Uses a femur–height model, a weighted-coin flip, uniform stick breaking, and a three-sided die.
- What you can do after
- Evaluate alternative SCM constructions by checking distributional preservation and the causal assumptions induced by their mappings.
Grokking Bayes
The reparameterization trick expresses a random variable as a differentiable transformation of fixed noise and distribution parameters so gradients can be computed through stochastic sampling.
- How it is used
- Enables automatic differentiation and gradient descent when optimizing the ELBO with variational inference.
- How deep it goes
- Defines the transformation and explains its gradient path for Normal distributions, while deferring cases without a fixed-noise rewrite.
- Examples
- Uses a Normal transformation and a water-pipe analogy to illustrate fixed noise, differentiable operations, and restored gradient flow.
- What you can do after
- Apply the trick to rewrite Normal samples so gradient-based variational inference can optimize distribution parameters.
Also covered in
- Build a Text-to-Image Generator (from Scratch)
- Graph Neural Networks in Action
- Math and Architectures of Deep Learning
What to know first
- normal distributionA normal distribution is a continuous probability distribution with a symmetric, bell-shaped density determined by its mean and variance.
- meanThe mean is a measure of central location equal to the arithmetic average of numerical observations, or the probability-weighted average of a random variable’s possible values.
- varianceVariance is the expected squared deviation of a random variable from its mean and measures the dispersion of its values.
- backpropagationBackpropagation is reverse-mode differentiation that propagates derivatives backward through a computational graph to compute gradients of an output or loss with respect to inputs and parameters.
Related concepts
- variational autoencoderused by · A variational autoencoder is a generative neural network that learns a probabilistic latent representation of data and decodes samples from it to reconstruct or generate data.
- variational graph autoencoderused by · A variational graph autoencoder is a probabilistic graph autoencoder whose encoder defines a distribution over latent representations and whose decoder reconstructs graph-related inputs or structure.
- backpropagationaddresses · Backpropagation is reverse-mode differentiation that propagates derivatives backward through a computational graph to compute gradients of an output or loss with respect to inputs and parameters.
- structural causal modelproduces · A structural causal model represents causal relationships among variables through equations that determine each variable from other variables and exogenous factors.
- samplingaddresses · Sampling is a procedure for selecting items from a collection or generating outcomes from a probability distribution according to a specified rule.
- timestepuses · A timestep is a discrete position or interval in an ordered temporal or sequential process at which state, computation, or output may change.
Questions about reparameterization trick
What is reparameterization trick?
The reparameterization trick expresses a random variable as a deterministic function of parameter-independent noise and distribution parameters, enabling gradients to pass through stochastic sampling.
Which Manning books explain reparameterization trick?
Build AI Drug Discovery Pipelines, Applied Reinforcement Learning, Causal AI and Grokking Bayes.
What should I know before learning reparameterization trick?
Manning books that teach reparameterization trick usually introduce normal distribution, mean, variance and backpropagation first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



