VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

How Artificial Intelligence AI Works | How AI Prevents Overfitting With Dropout and Regularisation

Did you know? An artificial intelligence model can become extremely good at its training examples yet fail when someone gives it a new one. The problem is called overfitting, and it is one of the reasons developers use techniques such as regularisation and dropout.

Think of a student who memorises the answers to a mathematics worksheet but cannot solve a new problem with different numbers. The practice score looks wonderful, but independent understanding is missing. An AI model can make a comparable error by learning features that were useful only in its training data.

Quick answer: regularisation encourages a model to avoid relying too heavily on fragile training-specific patterns. Dropout temporarily removes selected numerical activations during training. Neither technique guarantees reliable predictions, but both can help generalisation when used appropriately.

The 30-second guide

  • Training loss: how poorly the model fits the examples on which it is being optimised.
  • Validation loss: an error measure on separate development examples used to guide choices.
  • Generalisation: useful performance on genuinely unfamiliar cases.
  • Regularisation: methods that constrain or modify learning to discourage unhelpful complexity.
  • Dropout: a neural-network technique that randomly sets selected activations to zero during training.
  • L2 regularisation: adding a penalty related to the squares of model weights.

Dropout is not the same as hiding training records, deleting permanent neurons or randomly corrupting every output after deployment. It is a specific operation used in suitably designed training pipelines.

A fictional fruit-classifier problem

Imagine a model trained on photographs where every apple rests on a blue table and every orange rests on a yellow table. It may learn to identify the background rather than the fruit.

When we test it using a yellow table with a real apple, the model can be confidently wrong. The training photographs rewarded a shortcut that does not describe the intended task.

Developers should improve the dataset itself, perhaps by including varied backgrounds and lighting. They can also consider regularisation, but a regularised model trained on fundamentally misleading examples may still learn the wrong thing.

Step 1: Recognise overfitting in the learning curves

During training, a model often reduces its training loss. That looks encouraging. But if validation loss starts increasing while training loss continues falling, the model may be adapting too closely to the training examples.

For a fictional demonstration, suppose training error drops from 20% to 2%, while error on an independent development set first drops to 10% but later rises to 18%. More training has not improved that outside performance.

The exact percentages here are invented. The general lesson is to inspect both training and held-out performance, ideally across multiple relevant conditions, before concluding the model is improving.

Step 2: Understand the idea of regularisation

Some regularisation methods discourage large or complex parameter settings. Others inject training-time noise, alter training examples or use a stopping rule before the model fits every idiosyncrasy.

The goal is to encourage patterns that are useful beyond one collection of examples, not to make every model as small or simple as possible. An overly constrained model may fail to learn even the underlying task.

Different architectures and tasks need different controls. A decision tree might restrict depth; a neural network might use weight decay or dropout. Developers compare these choices on appropriate validation data.

Step 3: How L2 regularisation discourages large weights

A common approach adds a penalty based on squared weights to the original training loss. In a simple teaching formula, the new objective can be expressed as task loss + λ × sum of squared weights, where λ controls the regularisation strength.

Suppose two fictional weights are 3 and 4. The sum of their squares is 3² + 4² = 25. If the chosen λ is 0.01, that component adds 0.25 to the stated toy objective. Another set of weights 1 and 2 gives squares totalling five, so the penalty becomes 0.05.

These examples illustrate the direction of the penalty, not a recommendation for real settings. Actual frameworks may include scaling constants, exclude particular parameters or implement related weight-decay procedures differently.

Increasing regularisation strength can make large weights more costly, but too much can cause underfitting: a model that fails to capture even the important pattern.

Step 4: What dropout actually does

During a training forward pass, dropout randomly sets selected values of a layer’s input or activation tensor to zero. The probability of removal is often written as p. In PyTorch’s basic dropout module, the chosen values are sampled anew on each training forward pass.

For a fictional activation vector [2, 4, 6, 8], imagine dropout with p = 0.25 removes the second element on one pass. The remaining values continue through the network, with appropriate scaling under the implementation.

This is not a permanent deletion of the second unit. It may remain active on the next pass while another is removed instead. The changing pattern discourages some forms of excessive dependence on particular intermediate signals.

Step 5: Why dropout changes scaling during training

Many implementations use inverted dropout: the activations that remain are scaled during training by a factor of 1 ÷ (1 − p). This keeps the expected scale of the activations aligned with the ordinary inference pathway under the method’s assumptions.

If p = 0.25, the scale factor is 1 ÷ 0.75, or approximately 1.333. A retained activation of 6 becomes about 8 during the training pass. An activation selected for removal becomes zero.

In an ordinary evaluation or inference mode, standard dropout is disabled and the module passes those inputs without random removal. This distinction matters when comparing performance or trying to reproduce a model’s outputs.

A helpful way to remember it: during training, the network practises without relying on every signal being available. During normal inference, the standard dropout mask is not applied.

Step 6: Why more dropout is not always better

A dropout rate of zero means no units are dropped by that operation. A higher rate removes more activations during each training pass. But excessive dropout can make the task harder than necessary and prevent the model from learning adequately.

The useful setting depends on the dataset, architecture, placement and other regularisation methods. Some neural-network designs use dropout selectively; others may require little or none for a particular task.

The method must also be compared with the model’s performance without dropout. An impressive training procedure is not valuable if a simpler approach performs better on representative unseen data.

Step 7: Early stopping can protect generalisation too

Early stopping ends training at an appropriate point selected from validation performance, rather than continuing indefinitely simply because training loss still decreases.

For example, if an independent validation measure reaches its best value at an earlier checkpoint and then worsens, developers may return to that checkpoint. This can limit further adaptation to training-specific noise.

Stopping decisions belong to the development process. A separate final test should remain untouched until the model and its main settings have been selected.

Step 8: Regularisation cannot repair every data problem

Suppose a study assistant was trained with wrong answers to algebra problems. Dropout does not magically replace those labels with correct mathematics. If the training examples systematically omit certain learners or conditions, an L2 penalty does not fill those gaps.

The same applies to data leakage. If the final test secretly overlaps with training examples, the evaluation may be optimistic even when the model uses perfect dropout and weight decay.

Regularisation should complement representative examples, accurate labels, honest data splits and independent testing—not replace them.

Dropout versus other ways to improve generalisation

  • Data augmentation: create suitable variations of training examples without changing the intended label.
  • Weight penalties: discourage some large parameter settings as part of optimisation.
  • Dropout: randomly remove selected training activations, with appropriate scaling.
  • Early stopping: select when to finish training based on development evidence.
  • Simpler models: reduce capacity when excessive complexity is contributing to overfitting.

These methods can be combined, but each has assumptions and costs. The correct choice is driven by the task and evidence from evaluation.

Try it: test memorisation against understanding

Write four algebra questions with the same structure, such as 2x + 3 = 11. Practise solving them, then close your notes and tackle a question with a new structure, such as 3(x + 2) = 18.

If the new question is unexpectedly difficult, ask whether you learned the equality principle or memorised one sequence of steps. The activity is an analogy to generalisation; actual neural-network dropout is a numerical operation.

For conceptual mathematics support, the Secondary 1 Mathematics Tutor Clementi guide illustrates why practice should build transferable reasoning rather than simple repetition.

Frequently asked questions

Does dropout permanently remove neurons?

No. Standard dropout randomly zeros selected numerical activations during training. It does not delete the underlying learned parameters.

Is dropout normally active when the model answers a user?

Not in ordinary evaluation mode for standard dropout modules. Specific uncertainty-estimation methods may deliberately run dropout differently, but that is a separate design choice.

What is the difference between dropout and L2 regularisation?

Dropout modifies the activation pathway during training. L2 regularisation adds a penalty associated with weight magnitude to a training objective.

Can I eliminate overfitting completely?

There is no universal guarantee. Representative data, task-appropriate regularisation and honest evaluation help manage generalisation errors.

Does lower training loss mean the model improved?

Only on the defined training objective. Validation and independent testing establish whether the model remains useful on new examples.

Your one-minute takeaway

  • Overfitting occurs when a model learns training details that do not transfer to new cases.
  • Dropout and regularisation are techniques that can improve generalisation under suitable conditions.
  • Good data and an independent final test matter more than the presence of any particular technique.

Trusted references and connected AI chapters

Discover more from eduKate Singapore

Subscribe now to keep reading and get access to the full archive.

Continue reading