What is an autoencoder?

An autoencoder is a neural network trained without labels, made of an encoder that compresses the input into a smaller internal representation and a decoder that tries to rebuild the input from it.

It differs from a variational autoencoder in the kind of representation: a standard autoencoder maps each input to a single point and is not designed to generate new samples, while the variational type learns a probabilistic latent space that can. It differs from the general encoder-decoder architecture in that the target is the input itself.

Topic
Machine learning, models and training
Also known as
Auto-encoder

How an autoencoder works

  1. In the standard form the encoder compresses high-dimensional input into a low-dimensional representation in a narrow layer called the bottleneck.
  2. The decoder rebuilds the input from that representation as closely as possible.
  3. Training minimises the reconstruction error between input and output; no labels are needed.
  4. The bottleneck forces the model to learn the main patterns rather than copy; after training the encoder alone can extract representations.

In more detail

Undercomplete and overcomplete autoencoders

Autoencoders fall into two structural families: undercomplete autoencoders restrict capacity via a narrower bottleneck dimension, whereas overcomplete autoencoders use a latent layer wider than the input and rely on regularisation, such as L1 or TopK sparsity (Sparse Autoencoders), input corruption (Denoising Autoencoders) or Jacobian penalties (Contractive Autoencoders), to extract meaningful features.

Loss functions

Training minimises a reconstruction loss such as Mean Squared Error (MSE) for continuous inputs or Binary Cross-Entropy for normalised or binary data, optionally plus a regularisation term. Choosing the right loss and output activation strongly affects anomaly-score calibration.

Sparse autoencoders in LLM interpretability

In recent mechanistic interpretability work, Sparse Autoencoders (such as TopK and JumpReLU SAEs) are trained on internal LLM activations to decompose polysemantic neurons into thousands of monosemantic, human-interpretable concepts, aiding safety auditing and activation steering.

The over-generalisation risk in anomaly detection

In anomaly detection, an over-parameterised autoencoder can generalise too well and reconstruct anomalous inputs accurately, creating false negatives. Practitioners mitigate this with tighter bottlenecks, denoising objectives, memory-augmented modules and periodic threshold recalibration against concept drift.

Commonly confused terms

TermHow it differs
Principal component analysis (PCA)PCA finds a linear orthogonal projection maximising variance in closed form, whereas a nonlinear autoencoder with deep neural layers can learn curved manifolds; a single-layer linear autoencoder spans the same subspace as PCA.

Why an autoencoder matters for on-premises AI

The most common in-house use is anomaly detection: an autoencoder trained only on normal data rebuilds unusual examples poorly and high error flags them. Needing no labelled fraud or fault examples, it suits catching rare events. Autoencoders also serve dimensionality reduction and denoising; sparse autoencoders now feature in work interpreting the internal representations of language models.

ON-PREMISES EXAMPLE

A bank trains an autoencoder only on ordinary transaction records and sends transactions whose reconstruction error exceeds a set threshold to in-house analysts for fraud review.

Common questions

Can an autoencoder generate new samples?

A standard autoencoder is not designed for it; its latent space is irregular, so random points do not decode into meaningful samples. Probabilistic types such as the variational autoencoder are used for generation.

How is an autoencoder used for anomaly detection?

It is trained only on normal data. It rebuilds normal examples well; error rises on unusual ones and that high error signals an anomaly.

Sources

In the glossary: Glossary, A to C

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.