3 · Reparameterisation trick
Instead of sampling `z ~ N(μ, σ²)` directly (which blocks gradients), we reparameterise as `z = μ + σ · ε` where `ε ~ N(0, I)`. Kingma & Welling 2014 showed this makes the sampling differentiable w.r.t. `μ` and `σ`.
objective Trace gradients through sampling
Instead of sampling `z ~ N(μ, σ²)` directly (which blocks gradients), we reparameterise as `z = μ + σ · ε` where `ε ~ N(0, I)`. Kingma & Welling 2014 showed this makes the sampling differentiable w.r.t. `μ` and `σ`.
import torch
def reparameterise(mu, log_var):
sigma = torch.exp(0.5 * log_var)
eps = torch.randn_like(sigma)
return mu + sigma * eps
mu = torch.zeros(1, 32)
logvar = torch.zeros(1, 32)
z = reparameterise(mu, logvar)
print(z.shape, z.mean().item())torch.Size([1, 32]) -0.018
What is the role of `ε` in the reparameterisation trick?
$ python train.py --epochs 3 --lr 1e-3 Epoch 1/3 · loss 184.2 Epoch 2/3 · loss 168.7 Epoch 3/3 · loss 156.1 Checkpoint → ./runs/vae_mnist.pt
BeforeTomorrow Tutorial Studio generates step-by-step tutorials, how-to guides, and instructional content. AI handles progressive complexity, visual instruction design, and learning path optimization.
Tutorial Studiouses BeforeTomorrow's domain engineering approach: rather than a generic AI prompt, it deploys specialized agents trained in the business communication and strategy domain. When you submit a brief, Claude Opus 4.6 handles creative judgment while Sonnet 4.6 manages intelligence extraction — together producing professional output tailored to your specific requirements and industry context.
Unlike generic document generators, every Tutorial Studio output is uniquely generated from scratch — adapting to your industry (across 140+ supported industries), audience, and specific goals. No two outputs are identical because the AI composes each piece individually rather than filling a template.
Step-by-step guides with progressive complexity, visual instruction callouts, prerequisites, and checkpoint assessments.
Yes. AI adapts explanation depth, terminology, and assumed knowledge based on beginner, intermediate, or advanced audience specification.
Last updated: June 2026