DeepLLM Quiz
Deep Learning

Invariance and data augmentation: teaching a model what should not matter

10 questions on invariance, why it is hard to learn from raw data, four ways to build it in, data augmentation, tangent propagation and noise.

  • 10 questions
  • Stopwatch
  • Instant feedback

Shown publicly with your score. Don’t use your full real name.

Sample questions

Play now ↑

Answers stay hidden. Start the quiz to play them.

  1. Sample 1

    A classifier must tolerate 10 independent kinds of change, each of which can take 5 different settings. Roughly how many combinations would an unaided training set have to cover?

    • About 50
    • About 10 million
    • About 5,000

How it works

  • One question per screen. An answer is final once sent.
  • You see right away whether you were right, with a short explanation.
  • The stopwatch runs: on equal scores, the faster player ranks first.
  • Only your best attempt counts, so replaying is never risky.

About this quiz

A photograph of a dog is still a photograph of a dog if you move the dog a little to the left, make it slightly bigger, or brighten the picture. Humans never think about this. A neural network, left to itself, has no idea. To the raw pixels, a dog shifted by three places looks like a thoroughly different picture, because many pixel values change at once. If the model is to give the same answer in all these cases, someone has to tell it, or arrange for it to find out. The property of ignoring changes that should not matter is called invariance.

This quiz explores how invariance is obtained. You will see why simply hoping that a network learns it from examples is a poor plan once several kinds of change must be tolerated at once, because the number of combinations explodes. You will then meet the four families of remedy: building the invariance into the features, penalising the model whenever its output moves under a transformation, enlarging the training set with transformed copies, and designing the network so that the invariance is automatic. The quiz looks at the strengths and weaknesses of each, with special attention to the most popular, data augmentation.

The questions are practical. How should transformed copies be generated when training with stochastic gradient descent? What label does a transformed example carry? Which transformations are safe for a given task, and which would corrupt the labels? What does adding random noise to the inputs accomplish when seen as regularisation? A few questions use small numbers to make the combinatorial point vivid.

There are common misconceptions to watch for. One is that augmentation creates new information, when it only expresses knowledge you already have about what does not matter. Another is that any transformation will do, whereas the transformation must match the invariance you really want. A third is that hand-built features are a safe way to get invariance, although they can throw away information the model needs. Augmentation is also one of the cheapest ways to improve a model when data is scarce, which is why it appears in nearly every recipe for training on images. Medical scans, satellite pictures and photographs of products all benefit, and for soft tissue in scans even smooth stretching deformations, like a rubber sheet pulled in different directions, are used. Thinking carefully about which changes should leave the answer untouched, and which should not, is a skill that transfers directly to audio, text and sensor signals as well.

The quiz suits learners who have heard of augmentation as a training trick and want to see the reasoning behind it, and practitioners preparing image or sensor data. It needs no mathematics. There are 10 questions, each with an explanation, and it takes about four minutes.

Questions and answers

›How long does the quiz take?

About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. After every answer you see an explanation, which also shows what the wrong options got wrong.

›What is invariance in machine learning?

A prediction is invariant to a transformation if it does not change when the input undergoes that transformation. A classifier for animals in photographs should give the same answer wherever the animal appears and however large it is drawn. Invariance is a form of prior knowledge about what is irrelevant to the task, and building it in reduces the amount of data needed to learn.

›Why not just let the network learn invariance from data?

In principle it can, but in practice it is very demanding. Even small movements of an object change many raw values, and real tasks need tolerance to many kinds of change at once, such as position, size, rotation, lighting and colour balance. The number of combinations grows so fast that the training set required to cover them can become prohibitive.

›What are the four ways of encouraging invariance?

The first is to preprocess the data into features that already have the invariance. The second is to add a term to the training error that penalises changes in the output when the input is transformed. The third is data augmentation, which adds transformed copies of the examples to the training set. The fourth is to choose a network architecture that has the invariance built into its structure.

›What is data augmentation?

It is the practice of expanding the training set with altered versions of the existing examples, such as flipped, shifted, scaled, rotated or recoloured images, each given the same target as the original. It is easy to implement and often very effective. With sequential training, a fresh random transformation can be applied each time an example is presented.

›What is tangent propagation?

It is a method that adds a regularisation term to the training error which directly penalises changes in the network output caused by the transformations that should not matter. It needs extra machinery during training, and it can only cope with small transformations, such as shifts of less than a pixel, so it is less widely used than augmentation.

›What does adding noise to the inputs do?

Training on inputs with random noise added encourages the network to keep its outputs steady despite small changes in the inputs. Mathematically, it behaves like a regularisation term that penalises the sensitivity of the outputs to the inputs. It is a special case of the general idea that augmentation with small transformations acts as a regulariser.

›Are there risks in augmentation?

Yes. The transformations must preserve the property being predicted. A shift or a change of brightness leaves a photograph's content unchanged, but a transformation that changes the meaning of an example, such as turning one symbol into another, would attach a wrong label to the copy. The choice of transformations is therefore a matter of understanding the task.

More quizzes