Skip to content
ExamSpine

Convolutional neural networks in image generation

The network inside most diffusion models, and the judge inside most GANs, is built from convolutions. Know what a convolution does and why images need it.

Challenge 1SL and HL

Why images need a special kind of network

A 512 by 512 colour image has 786,432 numbers. A fully connected layer joining every pixel to every neuron would need hundreds of millions of weights or more, would be very slow, and would not "know" that neighbouring pixels belong together.

Key idea: A convolutional neural network (CNN) looks at small patches at a time and reuses the same weights everywhere in the image. That makes it far smaller, and an edge detector learned in one corner works in every corner.

Convolutions, kernels and feature maps

  • A kernel (or filter) is a small grid of weights, often 3 by 3.
  • The kernel slides across the image. At each position it multiplies the pixels under it by its weights and adds them up, producing one number.
  • Doing this everywhere produces a feature map: a new grid that is high wherever the pattern the kernel looks for appears.
  • A layer has many kernels, so it produces many feature maps. Early layers find edges and colours; deeper layers combine those into textures, shapes and whole objects.
  • Downsampling (pooling, or a stride above 1) shrinks the maps so later layers see a wider area of the image.

The kernel weights are not designed by hand. They are learned by backpropagation, like any other weights.

The U-Net inside a diffusion model

A denoiser must output an image the same size as its input (the predicted noise). The usual design is a U-Net:

  1. An encoder path of convolutions and downsampling squeezes the image into small, deep feature maps that capture what is in the picture.
  2. A decoder path of convolutions and upsampling grows it back to full size.
  3. Skip connections copy feature maps straight across from each encoder level to the matching decoder level.

Key idea: Skip connections let fine detail (exact edges and positions) bypass the bottleneck, while the deep middle handles the overall layout. Attention layers are usually added at the middle and lower-resolution levels, which is where the text prompt joins in. Some newer systems replace the U-Net with a transformer, but the job is the same: predict the noise.

CNNs elsewhere in generative systems

  • In a GAN, the discriminator is usually a CNN classifier: image in, "real or fake" score out. The generator is often a CNN run in reverse, growing a small grid into a full image with upsampling convolutions.
  • In an autoencoder for latent diffusion, convolutional encoders and decoders compress images and restore them.
  • In evaluation, a pretrained CNN classifier is used to extract features from real and generated images so their distributions can be compared (the FID score).

Key terms

Convolutional neural network (CNN)
A neural network that processes images by sliding small learned kernels across them, sharing weights across the whole image.
Kernel (filter)
A small grid of learned weights slid across an image to detect one feature, producing a feature map.
Feature map
The grid of values produced by sliding one kernel over an input; high where the kernel's pattern appears.
Downsampling
Shrinking feature maps (by pooling or a stride above 1) so later layers see a wider area of the image.
U-Net
An encoder-decoder CNN with skip connections, whose output is the same size as its input. The usual denoiser in diffusion models.
Skip connection
A link that copies feature maps from an encoder level straight to the matching decoder level, keeping fine detail.
Backpropagation
The method that works out how much each weight in a network contributed to the error, so gradient descent can adjust it.
Transformer
A network built on attention layers. Some newer image generators use one in place of the U-Net.

See all 65 terms in the glossary

Exam-style questions

In the style of Paper 1 Section B. Write your answer first, then open the marking points and mark yourself honestly. The questions use our own company, Hearth & Oak: an online furniture shop that wants to generate room scenes around its products.

Worked example · Explain · AO1

[3 marks]

Explain why a U-Net denoiser uses skip connections.

How to approach it

Three marks, so three linked steps: what goes wrong without them, what they do, why that helps this task. Tie the last point to denoising, not to CNNs in general.

0 words

Marking points and model answer

A model answer

The encoder half of a U-Net repeatedly downsamples the image, which captures what is in the picture but loses exactly where edges and small details are. Skip connections copy the feature maps from each encoder level straight across to the decoder level of the same size. The decoder can then combine the overall understanding from the bottleneck with the precise detail from early layers, which matters because the denoiser must predict noise for every single pixel.

For each point, does your answer make it? Be strict: a marker would be.

  • Point 1: The encoder downsamples the image, so fine spatial detail is lost at the bottleneck. (1 mark)
  • Point 2: Skip connections pass feature maps from encoder levels directly to the matching decoder levels. (1 mark)
  • Point 3: So the output keeps precise detail / positions, which a denoiser needs because its output is the same size as its input. (1 mark)

Also accepted

  • Mentioning that skip connections also help gradients flow during training earns point 3.

Earns nothing

  • "They make it faster."

Mark every point to see your total.

Question 1 · Define · AO1

[1 mark]

Define the term "kernel" in the context of a convolutional neural network.

0 words

Marking points and model answer

A model answer

A kernel is a small matrix of learned weights that is moved across an image, multiplying and summing the values under it, to detect one kind of feature and produce a feature map.

For each point, does your answer make it? Be strict: a marker would be.

  • Point 1: A small grid / matrix of learned weights that is slid across the input to detect a feature (producing a feature map). (1 mark)

Also accepted

  • "Filter" used as a synonym, with the same meaning.

Earns nothing

  • The operating system kernel.

Mark every point to see your total.

Question 2 · Explain · AO1

[4 marks]

Explain why a convolutional layer is more suitable than a fully connected layer for processing images.

0 words

Marking points and model answer

A model answer

An image has hundreds of thousands of pixel values, so a fully connected layer would need a weight between every pixel and every neuron, which is too many to train or run efficiently. A convolutional layer instead slides one small kernel over the image and reuses the same weights everywhere, so it has far fewer parameters. Each kernel only looks at a small neighbourhood, which suits images because nearby pixels form edges and textures. Because the same kernel is used everywhere, a pattern it learns, such as the edge of a table leg, is recognised wherever it appears.

For each point, does your answer make it? Be strict: a marker would be.

  • Point 1: A fully connected layer would need a weight for every pixel to every neuron: an enormous number of weights. (1 mark)
  • Point 2: A convolutional layer shares one small kernel across the whole image, so it has far fewer weights / is faster to train and run. (1 mark)
  • Point 3: Convolutions look at local neighbourhoods, matching how meaning in images comes from nearby pixels. (1 mark)
  • Point 4: A feature learned in one place is detected anywhere in the image (translation equivariance / invariance). (1 mark)

Earns nothing

  • "CNNs are better for images" with no reason.

Mark every point to see your total.

Question 3 · Suggest · AO2

[3 marks]

Hearth & Oak's generated rooms often have furniture with warped legs and mismatched edges. Suggest how the structure of a U-Net relates to this problem.

0 words

Marking points and model answer

A model answer

Straight table legs and clean edges are fine detail that has to be correct at full resolution. In a U-Net the middle of the network sees a heavily downsampled version of the image, so it knows roughly where a table is but not exactly where its edges are; that precision has to come back through the skip connections and the high-resolution layers. If those layers are small, or the model has seen few clean product photos, edges may come out warped. Hearth & Oak could fine-tune on its own sharp studio photos or generate at a higher resolution.

For each point, does your answer make it? Be strict: a marker would be.

  • Point 1: Straight edges and thin structures depend on fine spatial detail at full resolution. (1 mark)
  • Point 2: Detail is lost in the downsampled bottleneck, and is recovered only through the skip connections / higher-resolution layers. (1 mark)
  • Point 3: A sensible consequence or fix: too little capacity at high-resolution levels, training data with few such objects, or more training on product images / a higher resolution / more steps. (1 mark)

Also accepted

  • A valid answer that relates the problem to limited attention between distant parts of the image (so two legs are not kept consistent) earns point 2.

Earns nothing

  • "The AI is bad at furniture."

Mark every point to see your total.

All case study topics

  1. Challenge 1

    SL and HL

    How diffusion models make an image

    Noise, denoising, the network that predicts the noise, and how a text prompt steers it.

  2. Challenge 2

    SL and HL

    Training data: ethics, ownership and bias

    Consent, copyright and attribution for training images, and how curation choices shape what the model makes.

  3. Challenge 3

    HL only

    GANs: a generator against a discriminator

    How two networks train against each other, and why that training is unstable.

  4. Challenge 4

    HL only

    Hybrid models and the trade-offs between them

    Systems that combine diffusion, GANs and autoencoders, judged on quality, speed, diversity and complexity.

Written by Spine in our own words. Spine is not affiliated with or endorsed by the International Baccalaureate. Every question, set of marking points and model answer here is our own, set in our own made-up company. Facts about the case study itself come from public guides and are marked “reported”. Last checked 2026-10-23.