Visual explainer
Autoencoders
Trace a two-input, one-code autoencoder through averaging, reconstruction, denoising and a visible information-loss limit.
An autoencoder learns an encoder and decoder by reconstructing inputs through an internal code. A useful code preserves patterns needed for the task, but a narrow layer alone guarantees neither meaningful features nor generalization.
Start with a deliberately simple family: for . Both coordinates change, but one value identifies every member. The three plotted examples are , and . The line marks the assumed family, not a universal model of images. Both axes cover the same numerical interval; this opening plot stretches horizontal space for readability.
Encode, Then Decode
Our synthetic encoder computes ; the decoder repeats its input, . The network shape is 2→1→2. Circles show actual scalar values, not unnamed hidden layers. For , the path is .
These are specified toy weights, not weights claimed to emerge from an experiment. On the diagonal training family, the same rule rebuilds every point exactly: and . The general architecture and reconstruction objective are described in Deep Learning, chapter 14.
Keep A Shared Summary
The two coordinates contribute equally to the midpoint . Each arrow identifies a value being combined; the mean preserves their shared level while losing their difference. Two stored activations become one: a 2:1 coordinate-count ratio. Storage savings also depend on precision, model parameters and encoding overhead. A 784→32 architecture would have a 24.5:1 coordinate-count ratio, not an automatic 24.5-fold compressed file.
Measure What Was Lost
The filled dot is input ; the open square is reconstruction . From here, coordinate plots use equal horizontal and vertical scales, so the arrow is perpendicular to the diagonal for this particular linear projection. Its component errors are and . Mean squared error is
An arbitrary nonlinear autoencoder need not be an orthogonal projection. The decoder produces what its code and learned mapping permit; it cannot consult the discarded input coordinates.
Corrupt Input, Clean Target
Use clean target and corrupted input . Its errors cancel in the mean, so and . The plot translates the origin and extends the range to include 1.2, retaining 200 drawing units per coordinate on both axes. The output square coincides with the clean target; the dot is the noisy input.
Denoising training pairs a corrupted input with its clean target, as in Vincent et al., section 3. Success depends on the corruption and learned mapping. This fixed model would leave unchanged, yielding MSE against . A bottleneck does not universally remove noise.
Compare Code Capacity
Keep the input fixed. The upper one-coordinate mean code rebuilds with MSE . The lower two-coordinate code uses the identity encoder and decoder, rebuilding with zero error. The labels “1 code” and “2 codes” count scalar code coordinates, not separate networks.
More capacity can preserve more detail, including unwanted detail. A small nonlinear code can also memorize a finite training set if the surrounding networks have enough capacity. Evaluate held-out reconstruction and downstream usefulness; no universally optimal width follows from this drawing.
An Unseen Code Is Unchecked
For this separate support example, suppose training constrains only codes zero and one. Compare two possible decoders: and . Both exactly rebuild and . The plot shows only each decoder's second output coordinate, with 400 drawing units per code unit and 120 per output unit.
At , their second outputs are and . The filled endpoint dots agree, while the open midpoint markers separate. These are constructed alternatives, not observed training results. Reconstruction at a few known codes does not determine sampling quality throughout latent space. A plain autoencoder does not itself specify a probability distribution for sampling new codes; the VAE visual adds that modeling choice.
Train A Decoder Weight
This controlled update freezes the encoder at and varies the decoder . With target , MSE is . At , loss is and derivative .
A teaching learning rate gives , reducing loss to . The ring marks the new point on the exact loss curve; its axes are weight and MSE, not input coordinates. In general, reconstruction gradients train both encoder and decoder through backpropagation.
Check A Fresh Input
Restore the original mean encoder and repeat decoder, and predict what happens to . Its mean is , so reconstruction is . Component errors are , giving MSE . The plot uses the same equal coordinate scales as the earlier reconstruction view. Exact diagonal reconstruction does not imply zero error on off-family inputs.
Where It Breaks
Both and produce code . A deterministic decoder receiving that code must return the same answer for both. Our decoder returns , with MSE for each. The cross marks the lost distinction, not a stopped forward computation.
Changing the decoder alone cannot reconstruct both inputs exactly once the encoder has merged them. Code dimension, architecture, regularization and data assumptions determine what gets preserved. Measure which differences matter before choosing what the bottleneck may discard.
The Quick Version
- An encoder produces a code; a decoder reconstructs from it.
- Coordinate-count reduction is not a compressed-file guarantee.
- Reconstruction loss measures what the code and decoder fail to preserve.
- Denoising learns from corrupted inputs and clean targets.
- Narrow codes do not rule out memorization.
- Unseen codes require separate evaluation.
- Reconstruction gradients train the mapping.
- Identical codes cannot recover different inputs exactly.