AI Glossary / Probabilistic machine learning / Intermediate
Semisupervised variational autoencoder
Definition
A semisupervised variational autoencoder is a latent-variable generative model trained using both labeled and unlabeled observations. In a common formulation, the class label is observed for some examples and treated as a latent variable for the rest. An inference network learns label probabilities while the generative model learns to explain the observations.
What it means
An organization may have many examples but only a small labeled subset. A semisupervised VAE attempts to use the unlabeled inputs' structure as well as the known labels. It does more than reconstruct data and attach a classifier afterward: in the common joint model, class information participates in generation and inference.
Several architectures fit the broad term. This entry focuses on the M2-style generative model introduced by Kingma and colleagues, where y is a class and z captures additional latent variation. The effectiveness of unlabeled data depends on whether the model's assumptions connect that variation with the classification task usefully.
How it works
The generative model specifies a class prior p(y), a latent prior p(z) and a decoder likelihood p(x|y,z). An inference model predicts q(y|x) and a distribution q(z|x,y). For a labeled example, the known y is used when forming the variational objective for the remaining latent variable.
For an unlabeled example, the objective averages class-conditioned bounds over q(y|x) and includes the entropy of that label distribution. With a manageable number of classes, the label expectation can be evaluated by summing over classes. Continuous latent variables can use a reparameterized gradient estimator.
The original approach also adds a supervised classification term so labeled examples train the classifier directly. The overall balance between labeled, unlabeled and classification contributions matters. At prediction time, q(y|x) supplies approximate class probabilities. These probabilities are learned model outputs, not guaranteed calibrated confidence or proof that the generative assumptions are correct.
Three practical examples
1. Document categorization: use a limited set of reviewed labels alongside a larger document collection. Check that the unlabeled collection uses the same relevant categories and does not overwhelm the model with unrelated material.
2. Image classification: model a class label and other visual variation jointly. Evaluate classification on held-out labels rather than judging the system only by reconstruction quality.
3. Sensor-event labeling: combine expert-labeled events with additional unlabeled sequences or feature vectors. Preserve a realistic evaluation split so repeated measurements from the same event do not leak across training and testing.
Think of it this way
Think of learning both how examples are constructed and which category descriptions fit them, using the few confirmed categories to orient the process. The analogy explains the combination of supervised and generative information. It does not imply that unlabeled examples reveal their true categories automatically or that visually coherent reconstructions establish correct classification.
Worked example
Consider one unlabeled input and two candidate classes A and B. Suppose their class-conditioned joint-data ELBO contributions are -4 and -6 nats. These values already include the class-prior term and the continuous-latent contribution. Let the inference classifier assign q(A|x)=0.75 and q(B|x)=0.25.
The weighted bound contribution is 0.75 × (-4) + 0.25 × (-6) = -4.5. The label entropy is -0.75 log(0.75)-0.25 log(0.25), approximately 0.562335. The unlabeled ELBO is therefore approximately -3.937665. Both classes contribute; the method has not simply assigned the example permanently to A.
If the same input had a known label A, its labeled generative bound would use the A contribution -4. An additional supervised classifier loss would be -log(0.75), approximately 0.287682, before applying its chosen weight. The example illustrates objective bookkeeping with stipulated values. It is not a complete training run, and the entropy term should not be mistaken for a claim that maximum label uncertainty is always desirable.
Illustrative case study
Fictional case: Birch Archive has a small reviewed set of document categories and a much larger unlabeled collection. Its team trains a semisupervised VAE and initially assumes that improved reconstruction means improved categorization. Reviewers discover that some unlabeled documents belong to categories absent from the labeled set.
The team investigates this mismatch, evaluates the classifier on independently reviewed examples and studies the weight of the unlabeled objective. It treats attractive generated samples as a separate result. This fictional case illustrates data and objective alignment, not evidence that adding unlabeled data necessarily improves a deployed classifier.
Common misconceptions and mistakes
Semisupervised does not mean self-supervised: known labels directly inform at least part of training. Nor is every VAE followed by a classifier the same joint architecture. In the original research, the latent-feature M1 approach and the generative M2 approach are distinct constructions.
Unlabeled data can hurt when its distribution or class coverage conflicts with the task assumptions. The additional latent variable z does not automatically contain only style, nor does y capture every meaningful category distinction. A good generative likelihood can reflect details irrelevant to classification. Class probabilities also need calibration checks when used for decisions or selective human review.
Business use
Consider the approach when labels are scarce, unlabeled inputs are relevant and modeling their structure is a plausible way to support classification. Compare against a supervised baseline and other semisupervised methods at the same labeling budget. Record how labels were selected, since a small convenience sample can miss important subgroups.
Separate reconstruction metrics, classification metrics and uncertainty calibration. Test class imbalance and distribution shift, and review whether new or unknown categories require explicit handling. The model's generative component adds assumptions and computational cost; it should earn its place through evaluation on the intended task.
People also ask
Does every training input need a label?
No. The model uses known labels where available and treats missing labels as latent for other examples.
Is an unlabeled example assigned one fixed class during training?
Not necessarily. The common variational objective averages over a predicted label distribution.
Can good image generation guarantee good classification?
No. The two goals are related through the model but require separate evaluation.
Check your understanding
Why is the example's unlabeled ELBO not just the A bound of -4?
Answer: It combines both class-conditioned bounds according to q(y|x) and adds the label-distribution entropy. The label remains uncertain.
Related terms
- Variational autoencoder
- Reparameterization trick
- semisupervised learning
- latent class
- evidence lower bound
- inference network
- label entropy
- generative classifier
Learn next
Derive the labeled and unlabeled bounds for a two-class model, then trace the classifier's supervised loss. Next compare label-budget experiments and examine how distribution mismatch affects the usefulness of unlabeled examples.
More in Probabilistic machine learning
- Score matching - Score matching is a method for fitting a continuous probability model by matching its gradient of log density with respect to the data to that of the data...
- Self-normalized importance sampling - Self-normalized importance sampling estimates an expectation under a target distribution by drawing from a proposal distribution, weighting the draws, and...
- Semi-amortized variational inference - Semi-amortized variational inference combines an inference network's fast prediction of variational parameters with additional optimization for each...
- Sequential model-based optimization - Sequential model-based optimization, or SMBO, is an approach to optimizing an expensive objective by repeatedly fitting a surrogate model, using it to...
- Sequential Monte Carlo approximate Bayesian computation - Sequential Monte Carlo approximate Bayesian computation, or SMC-ABC, uses successive populations of weighted parameter samples to approximate Bayesian...
- Shampoo optimizer - Shampoo is an adaptive gradient optimizer that uses the matrix or tensor structure of model parameters to build manageable preconditioners.
Sources
Kingma and colleagues, Semi-Supervised Learning with Deep Generative Models, M2 construction and objectives: https://arxiv.org/pdf/1406.5298
The latent-label formulation and objective distinction were checked in the original paper. The numerical objective calculation and fictional archive case are original illustrations. Independent review consulted M2 equations 2, 4 and 6–9 for the labeled, unlabeled and classifier objectives.
Previous: Semisupervised parsing Next: Semivowel