An encoder turns an input into a representation a model can use. Think of it as a summarizer: it keeps useful information while changing the form or level of detail. What it does depends on the task. A U-Net encoder shrinks image feature maps to capture broader context; a text encoder turns words into numerical embeddings. section 12.15 section 12.11
In a U-Net for image generation, the encoder is the downsampling half. Convolutional layers extract features from a noisy image and progressively reduce their spatial resolution. Deeper features help answer “What am I looking at?” but retain less precise information about where edges and textures belong. The decoder upsamples the representation, while skip connections pass earlier, higher-resolution features to it so it can recover fine detail. section 12.15 section 12.17
Following an 8×8 noisy image
An 8×8 image first meets eight separate 3×3 convolutional filters. Each filter scans the image, combining each local patch with its learned values and a bias. The result is eight 8×8 feature maps, or an 8×8×8 tensor. Group normalization then recenters and rescales groups of feature maps before activation. A later convolution uses a stride of 2 to downsample: with the illustrated 4×4 filter and padding of 1, an 8×8 feature map becomes 4×4. The image is smaller, but the network can work with features rather than individual pixels alone. section 12.17
Figure 12.27 The U-Net architecture
The U-shaped diagram shows where the shrinking encoder path, bottleneck, expanding decoder path, and detail-preserving skip connections fit together. section 12.15
“Encoder” does not always mean an image-shrinking network. A pretrained text encoder can turn a label such as “a happy face” into an information-rich embedding; a small feed-forward network can then adapt that embedding to guide image denoising. In the simplified Transformer workflow, encoding also names the initial preparation of token and position information for self-attention. That use should not be confused with a classic multilayer Transformer encoder: many modern language models are decoder-only. section 12.11 section 11.11




















