Lesson 3 • 2 min
The Decoder
Back to pixels
Unzipping a file
When you unzip a file, you get back all the original data from the compressed version. The VAE decoder takes the latent representation and reconstructs a full-resolution image.
Watch the decoder expand latent space to full resolution
The decoder is a learned neural network—not a simple algorithm. It was trained on millions of images to learn how to reconstruct fine details from the compressed representation.
VAE encode/decode
# The full VAE pipeline
class VAE:
def encode(self, image):
# 1024×1024×3 → 128×128×4
return self.encoder(image)
def decode(self, latent):
# 128×128×4 → 1024×1024×3
return self.decoder(latent)
# In generation:
# 1. Start with noise in latent space
# 2. Denoise in latent space (all the diffusion magic)
# 3. Decode final latent to pixels
pixels = vae.decode(denoised_latent)Quick Win
Module 5 complete! You understand VAEs: compression to latent space for efficient processing, then decoding back to pixels.