Course contentsShow
← Machine Learning and Deep Learning
Lesson 1430 of 3,53832. Generative Models: Autoencoders and VAEsFree lesson

The Encoder-Decoder Architecture

Breaking down the two-part structure: encoder compresses input to latent space, decoder reconstructs from latent code.

The Encoder-Decoder Architecture

What you'll learn: How autoencoders use two connected components—an encoder and a decoder—to compress and reconstruct data.

The Two-Part Structure

An autoencoder splits its work between two specialized networks:

  1. The Encoder: Takes your input (like an image or text) and compresses it into a smaller, dense representation called the latent code or latent vector. Think of this as creating a compact summary that captures the essential features.

  2. The Decoder: Takes that compact latent code and attempts to reconstruct the original input from it.

A Helpful Analogy

Imagine packing for a trip where luggage space is extremely limited. The encoder is like you carefully selecting only the most essential items and packing them efficiently. The latent space is your suitcase—much smaller than your entire wardrobe. The decoder is like unpacking at your destination and trying to recreate your full outfit selection from just those packed essentials.

Why This Matters

This architecture forces the model to learn what's truly important about the data. The encoder can't just memorize everything—it must discover meaningful patterns and compress them into the latent space. The decoder then proves whether that compression was effective by reconstructing the original input.

The latent space sits between these two components and acts as an information bottleneck. This bottleneck is crucial: it prevents the model from simply copying input to output and instead forces it to learn a meaningful compressed representation.

Key Takeaway: The encoder-decoder architecture in autoencoders creates a compression bottleneck where the encoder maps inputs to a compact latent representation, and the decoder reconstructs outputs from that representation—learning useful data patterns through this process.