AI Glossary / Probabilistic machine learning / Advanced
Variational recurrent neural network
Definition
A variational recurrent neural network, or VRNN, is a sequence model that combines recurrent neural-network memory with latent random variables at each time step. Variational inference trains an approximate posterior for those latent variables alongside the generative model.
What it means
A sequence can contain uncertainty that affects more than one observation. In speech, motion or sensor data, a hidden source of variation may influence how later values unfold. A VRNN represents such variation using random latent states together with a recurrent summary of history.
The deterministic recurrent state and the stochastic latent variable play different roles. The recurrent state summarizes preceding information; the latent variable introduces a distribution of possibilities at the current step and influences subsequent recurrence.
This entry follows the VRNN formulation introduced by Chung and colleagues. It does not use “variational RNN” as a generic name for every recurrent network trained with dropout or every Bayesian treatment of recurrent weights.
How it works
At time t, use the previous recurrent state to define a conditional prior for the current latent variable. A decoder then defines the observation distribution from that latent variable and the previous recurrent state. After observing or generating the current value, update the recurrent state using both the observation and latent information.
During training, an encoder also uses the current observation and preceding recurrent state to form an approximate latent posterior. The evidence lower bound combines expected observation log likelihood with a penalty measuring divergence from the history-dependent prior.
Training propagates information through the sequence and through reparameterized latent samples. At generation time, the current observation is unavailable, so latent values come from the conditional prior rather than an encoder that has seen that observation. Evaluation must respect this difference to avoid giving a forecasting model future information.
Three practical examples
- A speech-modeling experiment represents structured variation across successive audio frames using latent variables and recurrent memory.
- A handwriting-generation study models a sequence of pen coordinates with uncertainty about how a stroke develops.
- A sensor-forecasting prototype produces alternative plausible future trajectories rather than only a single next-value prediction.
Think of it this way
Think of telling a story with both a running memory of earlier events and uncertain choices about what happens next. A new choice affects the present event and the context for later events.
The analogy describes history and stochastic variation. A VRNN does not understand a story, and its latent variables need not correspond to meaningful intentions or independently identifiable real-world causes.
Worked example
One conditional step of a sequence objective
Hold the preceding recurrent state fixed and consider a simplified scalar latent model. Let the conditional prior be z distributed as Normal(0,1), and let the decoder give x given z as Normal(2z,0.25), where the second argument is variance.
For observed x = 1, suppose the encoder proposes q(z) = Normal(0.5,0.25). The Gaussian KL divergence from q to the prior is half of 0.25 + 0.25 − 1 − log(0.25), approximately 0.443147.
Under q, the expected squared decoder residual is E[(1 − 2z) squared] = (1 − 2 times 0.5) squared + 4 times 0.25 = 1. Therefore the expected observation log likelihood is −0.5 log(2 pi times 0.25) − 1/(2 times 0.25), approximately −2.225791.
The conditional lower-bound contribution is approximately −2.225791 − 0.443147 = −2.668938. For this simple linear example, the exact predictive distribution is Normal(0,4.25), whose log density at 1 is approximately −1.760045. The bound is lower, as expected.
A full VRNN repeats related calculations across time while its prior, encoder, decoder and recurrent state change with history. This fixed-history example checks one contribution; it is not a trained neural-network result.
Illustrative case study
A fictional equipment-analytics team wants to simulate alternative sensor trajectories during a machine cycle. A deterministic recurrent baseline captures the average shape but does not represent the range of plausible developments adequately for the team's evaluation.
The team tests a VRNN and separates complete machine cycles into training and validation sets. It compares generated trajectories with held-out sequences, checks whether latent variables are actually used and distinguishes reconstruction with observed inputs from forecasting without them.
The team reports uncertainty and failure cases rather than claiming every latent dimension represents an operating mode. This fictional study supplies no measured advantage over the baseline.
Common misconceptions and mistakes
- A latent variable is the same as the recurrent hidden state: one is sampled from a distribution, while the recurrence is a deterministic update given its inputs.
- Generation can use the current observation encoder: that requires the observation being generated and would leak information in forecasting.
- A good reconstruction guarantees good long-horizon prediction: errors and distribution mismatch can accumulate during rollout.
- Every latent dimension has a clear meaning: useful density modeling does not establish semantic or causal identifiability.
Business use
A VRNN can be investigated when sequential uncertainty has structure that a simple output-noise model does not capture adequately. Compare it with simpler state-space and recurrent alternatives under the same observation and forecasting conditions.
Report whether scores are exact likelihoods, estimated likelihoods or variational bounds. Evaluate multiple forecast horizons and consider whether generated variability matches the intended operational uncertainty. Training can suffer from unused latent variables, sensitive optimization and model misspecification. Additional complexity needs evidence of value for the specific sequence task.
People also ask
Is every VRNN observation distribution Gaussian?
No. The likelihood should fit the observation type; the worked example uses a Gaussian for transparent arithmetic.
Are the latent variables independent over time?
Not in the standard history-dependent-prior formulation. Their distributions depend on the recurrent history.
Does a VRNN automatically quantify uncertainty in neural-network weights?
No. Stochastic latent variables do not by themselves make the network parameters Bayesian random variables.
Check your understanding
For forecasting the next unseen observation, should z be drawn from the conditional prior or from an encoder that uses that unseen observation?
Answer: From the conditional prior based on available history. An encoder requiring the unseen observation is an inference tool for observed data, not a valid source of future information.
Related terms
- Recurrent neural network
- Variational autoencoder
- Latent variable
- conditional prior
- evidence lower bound
- reparameterisation
- state-space model
- sequence generation
Learn next
Review a one-step variational autoencoder, then draw the VRNN's generation and inference paths separately. Mark which quantities are available before an observation arrives. Finally compare reconstruction and forecasting experiments to see why their information requirements differ.
More in Probabilistic machine learning
- Variational expectation maximization - Variational expectation maximization, or variational EM, is an alternating optimization method for latent-variable models when exact posterior inference is...
- Variational filtering sequential Monte Carlo - Variational filtering sequential Monte Carlo refers here to combining particle-based sequential inference with variational optimization of proposals or...
- Variational message passing - Variational message passing, or VMP, is a way to organize variational inference as local computations and messages in a probabilistic graphical model.
- Vector-Jacobian product - A vector-Jacobian product, or VJP, combines sensitivities at a function's outputs with its derivatives to produce sensitivities at its inputs.
- Vector-quantized generative adversarial network - A vector-quantized generative adversarial network, usually called VQGAN, learns a discrete codebook for image representations while using reconstruction...
- Vector-quantized variational autoencoder - A vector-quantized variational autoencoder, or VQ-VAE, is a generative representation model that maps encoder outputs to entries in a learned discrete...
Sources
Chung and colleagues, A Recurrent Latent Variable Model for Sequential Data, NeurIPS 2015, VRNN formulation and learning objective: https://proceedings.neurips.cc/paper/2015/file/b618c3210e934362ac261db280128c22-Paper.pdf
Author preprint: https://arxiv.org/abs/1506.02216
The scalar conditional calculation and fictional sensor project are original teaching illustrations. Historical benchmark superiority is not asserted as a current general claim.
Previous: Variational posterior Next: Vauquois triangle