AI · 12.1
Autoencoders and GANs: Machines That Create
Name
Class
Date
Mark / 22
Section A
Circle the letter of the correct answer. One mark each.
- 1What does a generative model learn?1
- AWhich label goes with each input
- BHow to compress files without any loss
- CWhat the data looks like, so it can produce new examples
- DWhich features to delete from the data
- 2Why does an autoencoder have a small bottleneck in the middle?1
- ATo increase the number of parameters
- BTo stop the decoder seeing any information
- CSo it cannot simply copy the input and must learn its key features
- DTo make training faster
- 3An autoencoder trained on normal engine sounds rebuilds a new sound badly. What might that mean?1
- AThe autoencoder has learned perfectly
- BThe sound is unusual, and the engine may be faulty
- CThe bottleneck is too large
- DThe sound must be louder than usual
- 4What happens when you decode points along a straight line between two latent codes?1
- AThe decoder always outputs noise
- BThe model forgets both examples
- CThe two examples are averaged pixel by pixel
- DThe output morphs smoothly from one example to the other
- 5What extra term does a variational autoencoder add to its loss?1
- AA penalty on the size of the images
- BA count of the training examples
- CA pull of each code's cloud towards a standard bell curve
- DA reward for using fewer layers
- 6In a GAN, what does the generator receive as input?1
- ARandom noise
- BReal training images
- CThe labels of the images
- DThe discriminator's weights
- 7How does the generator learn to improve its fakes?1
- ABy copying the real images it is shown
- BFrom the gradient of the discriminator's verdict on its fakes
- CFrom a list of mistakes written by people
- DBy deleting its worst fakes
- 8A GAN's generator produces only two kinds of face, though the data has many. What is this called?1
- AVanishing gradients
- BData augmentation
- COverfitting
- DMode collapse
- 9When a GAN's generator perfectly matches the real data, what does the best discriminator output?1
- ARandom numbers
- B1 for every input
- C0 for every input
- D0.5 for every input
- 10Which of these is a misuse of generative models?1
- AA video putting a real politician's face onto words they never said
- BTurning a sketch into a photo
- CCreating faces of people who do not exist for a game
- DRemoving noise from an old photograph
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1DescribeDescribe how an autoencoder is trained, and explain one use of it.4
- 2ExplainExplain how a generative adversarial network is trained.5
- 3ExplainExplain why a variational autoencoder can generate new data when a plain autoencoder usually cannot.3
Mark scheme
Section A
Section B
1 Describe how an autoencoder is trained, and explain one use of it. 4
One mark for each of the following, to a maximum of 4.
- An encoder compresses the input into a small latent code / bottleneck
- A decoder rebuilds the input from the code
- Trained to minimise the reconstruction error between input and output
- A use, explained: compression, denoising or anomaly detection
Model answer. An autoencoder has an encoder that compresses the input, such as an image, into a much smaller latent code, and a decoder that tries to rebuild the original from that code. Both are trained together by gradient descent to minimise the reconstruction error, the difference between the input and the rebuilt output, so the code is forced to capture the most important features. One use is anomaly detection: an autoencoder trained only on normal data rebuilds unusual data badly, so a large reconstruction error flags, for example, a faulty machine part.
2 Explain how a generative adversarial network is trained. 5
One mark for each of the following, to a maximum of 5.
- A generator turns random noise into fake data
- A discriminator is trained to tell real data from fakes
- The generator is trained to make the discriminator classify its fakes as real
- They are trained alternately / take turns
- Using the gradient of the discriminator's output with respect to the fakes
- Ideally until fakes match the data and the discriminator outputs 0.5
Model answer. A GAN has two networks. The generator takes random noise and turns it into fake data; the discriminator is shown both real examples and fakes and is trained to output 1 for real and 0 for fake. Training alternates between them: the discriminator takes a step to get better at spotting fakes, then the generator takes a step to make the discriminator call its fakes real, using the gradient of the discriminator's verdict, backpropagated through the discriminator into the generator. Ideally the contest continues until the fakes are distributed like the real data and the discriminator can only guess, outputting 0.5.
3 Explain why a variational autoencoder can generate new data when a plain autoencoder usually cannot. 3
One mark for each of the following, to a maximum of 3.
- A plain autoencoder's latent space has gaps; random points decode to nonsense
- A VAE's encoder outputs a mean and spread, and codes are sampled from that cloud
- An extra loss term pulls the clouds towards a standard bell curve, filling the space smoothly
- So a random sample from the standard bell curve decodes to a sensible new example
Model answer. A plain autoencoder maps each input to a single point, and the points it learns are scattered with gaps between them, so a random latent point often decodes to nonsense. A VAE's encoder instead outputs a mean and a spread, and the code is sampled from that small cloud, while an extra loss term pulls every cloud towards a standard bell curve centred on zero. This packs the codes into one smooth region without gaps, so a random sample from the standard bell curve decodes to a sensible new example.