Autoencoders

What Are Autoencoders?

Autoencoders are artificial neural networks trained to reproduce their own input, learning a compressed internal representation of the data as a side effect. Every autoencoder has two halves: an encoder that maps an input vector to a code, often called the latent representation, and a decoder that maps the code back into the original input space. Training minimizes a reconstruction loss, typically squared error for continuous inputs or cross-entropy for binary ones, so no labels are required. Because the code layer is narrower than the input layer, or is otherwise constrained, the network cannot simply copy its input and must instead retain the structure that matters for reconstruction.

The idea descends from work on nonlinear dimensionality reduction. A single-hidden-layer autoencoder with linear activations recovers the same subspace as principal component analysis, so the architecture is often described as a nonlinear generalization of PCA. Adding nonlinear activations and depth lets the network model curved manifolds that linear projection cannot represent, which is what makes autoencoders useful for representation learning rather than compression alone.

Architecture and Training

The encoder and decoder are ordinary feedforward networks, and both are trained together by backpropagation on the reconstruction objective. Layer sizes, activation functions, and the width of the code determine what the model can express: a very narrow code forces aggressive summarization, while a code as wide as the input requires some other constraint to prevent the network from learning the identity function. Convolutional layers are standard when the input is an image, and recurrent or transformer encoders appear when the input is a sequence. Weight tying, in which the decoder reuses the transpose of the encoder weights, halves the parameter count and was common in early deep architectures trained layer by layer before end-to-end training of deep networks became routine.

Regularized and Denoising Variants

Constraining the code rather than shrinking it produces a family of regularized autoencoders. Sparse autoencoders add a penalty that keeps most code units near zero for any given input, so each unit specializes. Contractive autoencoders penalize the Frobenius norm of the encoder Jacobian, which makes the representation insensitive to small perturbations of the input. Denoising autoencoders take a different route: the input is deliberately corrupted, by masking or additive noise, and the network is asked to reconstruct the clean original. The stacked denoising autoencoder work published in the Journal of Machine Learning Research showed that this criterion yields features that transfer well to classification tasks, and it established denoising as a general recipe for learning representations without labels.

Variational Autoencoders

Variational autoencoders reinterpret the architecture as a probabilistic generative model. The encoder outputs the parameters of a distribution over latent variables rather than a single code, the decoder defines a likelihood over inputs given a latent sample, and training maximizes a variational lower bound on the data log-likelihood. The reparameterization trick makes the sampling step differentiable so the whole model trains by gradient descent. Carl Doersch's tutorial on variational autoencoders works through the derivation without assuming a background in variational Bayesian methods, and a later survey by Kingma and Welling, An Introduction to Variational Autoencoders, covers the extensions that followed. Because the latent space is continuous and regularized toward a simple prior, points sampled from it decode into plausible new data, which is why the variational form is treated as a generative model while the plain autoencoder is not.

Applications

Autoencoders have applications across engineering and scientific computing, including:

  • Dimensionality reduction and feature extraction for downstream classifiers
  • Anomaly and fault detection, where high reconstruction error flags out-of-distribution samples
  • Image and signal denoising, including medical image restoration
  • Learned compression of images, video, and sensor telemetry
  • Generative modeling and data synthesis using the variational form
  • Pretraining and self-supervised initialization for networks with limited labeled data
  • Recommender systems that reconstruct sparse user-item interaction vectors
Loading…