Skip to content
BIASED

Autoencoders

Block 1 of 7~2 min

Encoder, decoder and bottleneck

The topic Batch normalization, gradients and convolutions left us with the bricks: strided convolutions that shrink an image and transposed convolutions that grow it back. Now we assemble them into the first architecture on the road to models whose likelihood we can compute or at least bound: the autoencoder. It does not generate anything yet, but its two halves reappear in VAEs, VQ-VAEs and latent diffusion.

An autoencoder is trained to reproduce its own input. An encoder fφf_\varphi with parameters φ\varphi maps an input x∈RDx \in \mathbb R^D to a code z∈Rdz \in \mathbb R^d, and a decoder gθg_\theta with parameters θ\theta maps the code back to a reconstruction x^\hat x:

z=fφ(x),x^=gθ(z)=gθ(fφ(x)).z = f_\varphi(x), \qquad \hat x = g_\theta(z) = g_\theta\big(f_\varphi(x)\big).

Reproducing the input is only a pretext. What we actually want is the code. The key is the bottleneck: the code is smaller than the input, d<Dd < D, so the network cannot pass the pixels through unchanged. It has to keep what it needs to rebuild the image and drop the rest. Every input becomes a point in a lower-dimensional latent space that is learned from the data.

The idea is old: Rumelhart, Hinton and Williams (1986) already trained a network to squeeze its input through a narrow hidden layer and back.

Answers are saved on the server and tied to this browser until you sign in.