Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

~11 min readJMLR 2014

Dropout,
explained.

The idea sounds like sabotage: while training a neural network, randomly switch off half its neurons on every single step. Yet this one trick became the standard cure for overfitting for years. The reason is beautiful — deleting neurons at random forces every one to be independently useful, and quietly trains an ensemble of billions of networks at once. Here's exactly how, and why the surviving neurons get scaled up.

The delta

What changes here: the network stops being one network

This is rung 1, so the comparison is not against another rung but against the practice it displaced. Before dropout, the standard defences against overfitting were an L2 penalty on the weights, stopping training early, and — where you could afford it — training several networks independently and averaging their predictions. The first two shrink the model's capacity. The third works far better and costs you a full training run per member.

Dropout's change is to get the averaging without the extra runs. On every forward pass, each unit is switched off independently with probability p, so each pass trains a different thinned network, and the weights are shared between all of them. With n droppable units there are 2^n such networks, and the single set of weights you end up with approximates averaging over that whole collection.

The units to carry up the ladder: dropout introduces exactly one hyperparameter, the rate p (classically 0.5 for hidden units, lower for inputs), and it adds no parameters at all. It also introduces the first train/test asymmetry on this ladder — the network you train is never the network you deploy — and the bookkeeping that fixes it, scaling the survivors by 1/(1−p) so the expected input to the next layer is unchanged. Rung 2 introduces a second, more awkward asymmetry of the same kind, and rung 5 removes it.

01

The co-adaptation problem

A big network has enough capacity to memorize its training set — to fit noise instead of signal. One face of this is co-adaptation: neurons learn to work only in specific committees, each one correcting for another's quirks. A feature detector that only fires usefully when three particular neighbors are present is fragile; it hasn't learned something true about the data, it has learned to fit this data alongside those partners. Come test time, on data it hasn't seen, the brittle committee falls apart.

The pre-dropout cure was to train many separate networks and average them — a real ensemble, which reliably generalizes better. But training and running dozens of large networks is expensive. Dropout's genius is getting the ensemble benefit from a single network, almost for free.

The one-sentence version

Randomly deleting neurons during training stops any neuron from relying on any other, so each must learn a feature that stands on its own — and the randomness secretly averages over an army of sub-networks.

02

The trick: drop units at random

On each training step, for each unit in a dropout layer, flip a biased coin. With probability p (say 0.5) set that unit's output to zero for this step — as if it doesn't exist. The remaining units carry the forward pass and receive the backward pass; the dropped ones are simply absent, updated on other steps when they survive.

What a dropout layer does per step
Sample maskEach unit kept with prob 1 − p, zeroed with prob p. A fresh mask every step.
ForwardOnly surviving units pass signal — a different thinned network each step.
ScaleDivide survivors by (1 − p) so the layer's expected output is unchanged.
Test timeNo dropout, no scaling — the full network runs at once.

Because a neuron never knows which of its inputs will be present, it cannot lean on any single partner. It is pushed to extract a feature that is useful on average, across all the random committees it finds itself in. That is the regularization, mechanically.

03

Why the survivors scale up

Zeroing a fraction p of units shrinks a layer's total output by roughly that fraction. If training runs at that reduced scale but testing runs the full network, the next layer sees a different input magnitude in the two regimes — and everything downstream is thrown off. Inverted dropout fixes this at training time by dividing the surviving activations by (1 − p), which restores the expected output exactly:

The mask's mean is (1 − p), so dividing by (1 − p) makes the expected surviving activation equal the original — the layer is unbiased. That single line is why test time needs no dropout and no rescaling: the network was already trained to produce, in expectation, exactly what the full network produces. The runnable version below confirms the expectation matches the plain forward pass to machine precision.

04

An ensemble of 2ⁿ networks

Here is the deeper reason it works. Every distinct dropout mask picks out a different sub-network — a subset of neurons wired through the same shared weights. A layer of n units has 2ⁿ possible masks, so over training you are sampling from, and improving, an exponentially large family of thinned networks that all share parameters. Training with dropout approximately trains this whole ensemble at once.

At test time, running the full network with the scaled weights is a cheap approximation to averaging that entire ensemble's predictions. And averaging many models is the oldest trick in the book for cutting variance and beating overfitting — you are getting the statistical benefit of thousands of models for the price of one. With just 100 units, that is 2¹⁰⁰ ≈ 10³⁰ sub-networks, more than there are stars in the observable universe.

How it works

How the dropout paper trains and tests a network

The JMLR paper writes p for the probability of keeping a unit, the reverse of the drop rate that most frameworks take and that the rest of this page uses. Its p = 0.5 means keep half; its typical input-layer value, p = 0.8, drops one input in five.

Training: one thinned net Test: full net, weights × p input hidden output input hidden output grey units dropped this step keep each unit with probability p nothing dropped W(test) = p × W(train)
Training samples a different thinned network for every case; testing runs one full network whose weights are scaled by the keep probability p, so each unit receives the same expected input in both.
  1. Sample a mask for every training case. For each unit j in layer l, draw rj ~ Bernoulli(p) and multiply it into that unit's output, so the next layer receives r ∗ y. Each example in a mini-batch gets its own mask, so one mini-batch trains many different thinned networks.
  2. Backpropagate through the thinned network only. Gradients flow through the surviving units. A parameter that a training case did not use gets a zero gradient from that case, and gradients are averaged over the mini-batch as usual.
  3. Cap each unit's incoming weights. After every update, if the vector of weights entering a hidden unit has an L2 norm above a constant c, it is projected back onto the sphere of radius c. The paper's practical guide puts c at 3 to 4, and this max-norm constraint is the regularizer the authors found most useful alongside dropout.
  4. Drive the optimizer hard. Because the noisy gradients partly cancel, the guide recommends 10 to 100 times the learning rate that suits the same network without dropout, momentum of 0.95 to 0.99 instead of the usual 0.9, and a decaying schedule. Max-norm is what stops those large steps from inflating the weights.
  5. Size the layer for the units that survive. Only about pn of n units are active on a given case, so if n units suit a standard network, the guide suggests at least n/p with dropout.
  6. Test with one scaled network. At test time nothing is dropped. Instead, the weights leaving each unit are multiplied by its keep probability, Wtest = pW, so each unit's input equals its expected input during training. The paper also notes the equivalent alternative of multiplying retained activations by 1/p during training and leaving test weights alone, which is the form frameworks implement.

How much noise, and of what kind

Typical keep probabilities are 0.5 to 0.8 for hidden units and 0.8 for real-valued inputs such as image patches or speech frames; on MNIST, test error was flat for p between 0.4 and 0.8. Bernoulli masks are not the only choice. The paper reports that multiplying each activation by Gaussian noise with mean 1 and variance (1 − p)/p, the same variance as a 1/p-scaled Bernoulli mask, works as well or slightly better, and because its mean is 1 it needs no rescaling at test time.

Where the recipe was run

The same procedure was applied to fully connected networks on MNIST; to convolutional networks on SVHN, CIFAR and ImageNet, on SVHN with keep rates rising from 0.5 in the top layers to 0.9 at the input; to deep networks for TIMIT speech, with and without deep-belief-net pretraining; to bag-of-words classifiers on Reuters; and to a small genetics data set where it was set against Bayesian neural networks. The paper also extends dropout to restricted Boltzmann machines, and it checks the cost of the test-time shortcut: averaging the predictions of k randomly thinned networks only matched the weight-scaled network at about k = 50.

The math

The dropout forward pass, and what it penalizes in linear regression

In the paper's notation, with p the keep probability, the forward pass into layer l + 1 and the test-time rule are:

rj^(l) ~ Bernoulli(p), ỹ^(l) = r^(l) ∗ y^(l), zi^(l+1) = wi^(l+1) · ỹ^(l) + bi^(l+1); at test time Wtest^(l) = p · W^(l)

For linear regression with dropped-out inputs, the noise can be averaged out exactly, which shows what dropout penalizes:

ER ‖y − (R ∗ X)w‖² = ‖y − pXw‖² + p(1 − p) ‖Γw‖², where Γ = (diag(XᵀX))^1/2
  • R — an N × D matrix of independent Bernoulli(p) entries, one per input value; ∗ is the elementwise product.
  • ‖y − pXw‖² — the ordinary squared error of the scaled-weight model that is used at test time.
  • p(1 − p)‖Γw‖² — a ridge penalty that scales the cost of each weight wd by the spread of feature d across the data (Γ holds the square root of each feature's sum of squares), so weights on features that vary a lot are squeezed hardest.

At the extremes, p = 1 removes the penalty and gives plain least squares, while p(1 − p) peaks at 0.25 when p = 0.5. Absorbing p into the weights, w̃ = pw, rewrites the penalty as ((1 − p)/p)‖Γw̃‖², which grows without limit as p → 0: very aggressive dropout behaves like very strong shrinkage.

The evidence

What the dropout experiments measured

The paper runs one recipe across vision, speech, text and genetics and compares each result with networks trained without dropout or with the best published result at the time. Error rates, lower is better:

TaskBaselineWith dropout
MNIST, permutation-invariant net1.60% (standard net)1.35% logistic; 1.25% ReLU; 1.06% with max-norm; 0.95% at 2 × 8,192 units
SVHN, conv net3.95%3.02% in fully connected layers; 2.55% in all layers
CIFAR-10 / CIFAR-100, conv net14.98% / 43.48%12.61% / 37.20%
ImageNet ILSVRC-2010, top-525.7% (SIFT + Fisher vectors)17.0% (conv net of Krizhevsky and colleagues)
TIMIT phone error, 4-layer pretrained net22.7%19.7%
Reuters RCV1, 50 topics31.05%29.62%

Two comparisons isolate the ingredients. On one MNIST network (784-1024-1024-2048-10, ReLU) the authors swapped regularizers: L2 alone gave 1.62%, L2 with KL-sparsity 1.55%, max-norm alone 1.35%, dropout with L2 1.25% and dropout with max-norm 1.05%. On SVHN, adding dropout to the convolutional layers as well as the fully connected ones lowered error further, which the authors attribute to the noisier inputs it feeds the upper layers.

The negative results are reported too. On text the gain was much smaller than on images or speech. On MNIST subsets of 100 and 500 examples dropout gave no improvement, because a large network can still memorize so little data; the benefit grew with data and then shrank once the set was too large to overfit. On the small alternative-splicing data set a Bayesian neural network beat it, 623 to 567 bits of code quality (higher is better), although dropout still beat early stopping at 440 and was far cheaper to train and run.

Since then

What the authors admit, and what happened next

The paper is direct about the cost: the gradient each pass produces is noisier, because it is a gradient for one thinned network rather than the full one, so training takes substantially longer to converge — the authors put it at roughly two to three times the number of epochs for the same result. Dropout buys generalisation with compute, which is a trade worth naming because every later regulariser on this ladder is measured against it.

They are also clear that it is not free at inference time to reason about: the weight-scaling rule is an approximation to averaging over the 2^n networks, only a rough stand-in for that average in a deep nonlinear network, and the paper presents it as an approximation rather than claiming the ensemble interpretation is literal.

How it held up: unevenly, and the unevenness is instructive. Dropout is still standard inside transformer blocks and on classifier heads, and the idea — inject noise into the computation to stop units from co-adapting — spawned a family (DropConnect, DropPath, stochastic depth). But in convolutional networks it was largely displaced by rung 2, which regularises as a side effect of what it is actually for, and in large language-model pre-training it is frequently set to zero: when a model makes roughly one pass over a corpus far larger than its capacity, the overfitting dropout exists to prevent is not the binding constraint. A regulariser whose value depends on the data-to-parameter ratio is one you should expect to see switched off as that ratio moves, which is the axis the scaling ladder formalises.

SOLVE IT YOURSELF

Dropout, and the expectation it preserves

Inverted dropout is three lines, and its correctness is checkable exactly. This zeroes units by a mask and scales the survivors by 1/(1−p); then it enumerates all 2ⁿ masks and averages, showing the expected training output equals the plain forward pass to machine precision — which is precisely why inference uses the full network untouched. It also counts the sub-networks a mask defines. Change the drop rate p or the input and watch the expectation stay pinned to x.

YOUR TASK

Write the body of expected_train_output. Everything else in the file is already written; this is the function the paper is about. Press ▶ Run to check it against the 5 assertions below — they start red.

WHAT IT HAS TO SATISFY — 5 ASSERTIONS
  1. Survivors are scaled up to compensate for drops
  2. A dropped unit contributes zero
  3. Inverted dropout is unbiased: E over masks == x
  4. The training expectation matches the test-time forward
  5. Dropout trains an exponential ensemble
CPython · WebAssembly
06

What it left behind

Dropout was, for a stretch, the reason deep networks generalized — a central ingredient in the models that kicked off the deep-learning boom. Its influence outlived its dominance. The ensemble-by-noise idea seeded a whole family: DropConnect (drop weights, not units), stochastic depth (drop whole layers), DropPath, and the general principle that injecting the right noise during training is a regularizer.

In today's largest models dropout is often lighter or absent — batch and layer normalization, weight decay, data augmentation, and simply training on enormous datasets carry much of the anti-overfitting load. But open a transformer implementation and you will still find small dropout on the attention weights and feed-forward layers. The specific tool receded; the idea it proved — that a single network can behave like an ensemble — is permanent.

Worth knowing

Keep dropout on at inference and run the network many times, and the spread of predictions estimates the model's uncertainty — "Monte Carlo dropout," a cheap trick for asking a network how sure it is.

07

Why it still matters

Dropout was a beautifully simple answer to overfitting: during training, randomly "drop" a fraction of neurons on each forward pass, forcing the network to not rely on any single unit. Because the network never sees the same architecture twice, it can't build fragile co-adaptations where neurons only work in specific combinations — so it learns more robust, redundant features that generalize better.

One way to see it: dropout approximates training an enormous ensemble of thinned networks that share weights, then averaging them at test time (when dropout is off and activations are scaled to compensate). Ensembling is a classic way to reduce overfitting; dropout gets much of that benefit for almost no extra cost.

That train-vs-test difference is the practical gotcha it made everyone learn: dropout is active only during training, and inference must either scale activations or use the "inverted dropout" trick so the expected output matches — a bug that silently hurts models when handled wrong.

Dropout remains a standard regularizer, though its role shifted as the field changed: heavy data augmentation, batch/layer normalization, and simply training on more data reduced reliance on it in some settings, and large Transformers often use only light dropout. But the core idea — inject noise during training to prevent brittle co-adaptation — endures, and variants (spatial dropout, DropPath, attention dropout) are everywhere in modern architectures.

Questions

Questions people ask about Dropout

Why does the dropout paper pair dropout with a max-norm constraint?

Dropout makes every gradient noisy, so the paper compensates with a learning rate 10 to 100 times higher than usual and momentum of 0.95 to 0.99, and steps that large can make the weights grow very large. Max-norm caps the L2 norm of the weight vector entering each hidden unit at a constant c, typically 3 to 4, by projecting it back onto that sphere whenever an update pushes it outside. With the weights bounded, the optimizer can explore with big steps safely. On one MNIST network the combination beat every alternative the authors tried: 1.05% error for dropout with max-norm, against 1.25% for dropout with L2 and 1.35% for max-norm alone.

Is inverted dropout the same as the weight scaling in the original dropout paper?

In expectation, yes. The paper's main description keeps each unit with probability p during training and multiplies its outgoing weights by p at test time, so every unit's test input equals its average training input. It also notes the alternative that modern frameworks use, usually called inverted dropout: divide the surviving activations by p during training and leave the test-time network untouched. The authors say the two are equivalent once the learning rate and weight initialization are scaled accordingly, because the inverted form trains weights that are effectively 1/p times larger. Its practical advantage is that inference code needs no change; the model is simply run with dropout switched off.

Does p mean the keep probability or the drop probability in dropout?

In the Srivastava et al. paper, p is the probability of keeping a unit: p = 1 means no dropout, typical hidden-layer values are 0.5 to 0.8, and 0.8 is typical for real-valued inputs. Most libraries use the opposite convention. PyTorch's nn.Dropout and the Keras Dropout layer both take the probability of zeroing a unit, so the paper's input setting of p = 0.8 corresponds to a dropout rate of 0.2 in code. Mixing the two up silently turns light dropout into heavy dropout, for example dropping 80% of the inputs instead of 20%, and the training run still proceeds without any error to warn you.

Is dropout equivalent to L2 regularization?

Only in a special case, and even then not plain L2. For linear regression with dropped-out inputs, the paper shows that averaging over the noise gives exactly a ridge objective: the squared error of the scaled model plus p(1 − p) times a penalty in which each weight is weighted by its feature's spread across the data. High-variance features are therefore shrunk most, unlike uniform weight decay. For deep nonlinear networks there is no such closed form, and the empirical difference is clear: on the paper's MNIST network, L2 alone gave 1.62% error while dropout with L2 gave 1.25% and dropout with max-norm 1.05%.

How does Gaussian dropout compare with ordinary Bernoulli dropout?

Instead of zeroing units, Gaussian dropout multiplies each activation by noise drawn from a normal distribution with mean 1. To match standard dropout with keep probability p, the paper sets the noise variance to (1 − p)/p, which equals the variance of a Bernoulli mask rescaled by 1/p; at p = 0.5 that is a variance of 1. The authors report it works as well as, or slightly better than, Bernoulli dropout in their comparisons. Because the noise has mean 1, the expected activation is unchanged, so no weight scaling is needed at test time. It also never removes a unit entirely, which weakens the picture of training an ensemble of thinned networks.

Check yourself

5 questions to test what you just read

Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.

Under the paper's scheme a hidden unit outputs 2.0, its keep probability is 0.5 and its outgoing weight is 0.6. What does the next unit receive at test time, and on average during training?

Show answer

0.6 in both cases. At test time the weight is scaled to 0.5 × 0.6 = 0.3, so the input is 2.0 × 0.3 = 0.6. In training the unit sends 2.0 × 0.6 = 1.2 half the time and 0 otherwise, an average of 0.6. Under inverted dropout both numbers would be 1.2 instead.

A layer of 300 units works well without dropout. By the paper's sizing heuristic, how wide should it be with a keep probability of 0.6, and why?

Show answer

At least n/p = 300/0.6 = 500 units. Only about p × n units are active on any training case, so 0.6 × 500 = 300 survive on average: the thinned network the gradient trains is as wide as the one that worked without dropout.

In the ridge form of dropout for linear regression, how does the penalty factor change from p = 0.5 to p = 0.8, and which weights does it shrink hardest?

Show answer

p(1 − p) falls from 0.25 to 0.16, so keeping more inputs regularizes less. Within one setting, weight wd is penalized in proportion to Σn xnd^2, so weights on features with a large spread across the data are shrunk the most.

Why did dropout give no improvement on MNIST subsets of 100 or 500 examples when it helped on larger ones?

Show answer

With so few examples, a 784-1024-1024-2048-10 network can memorize the training set even through the noise, so there is no overfitting left for the regularizer to prevent. As data grows the gain rises, then shrinks again once the set is too big to memorize anyway: the authors describe a sweet spot for each architecture and rate.

Would averaging 10 randomly thinned networks at test time beat the single weight-scaled network on MNIST, and why?

Show answer

It should not. In the paper's test, Monte Carlo averages only caught up with weight scaling at about k = 50 samples and were at best slightly better after that, within one standard deviation. Ten samples leave the average too noisy, so the deterministic scaled network, which costs one forward pass, is the better choice.

Where this sits

Making deep nets train

Seven papers that turned "deeper is better in theory" into a network that actually converges. Every later architecture paper assumes all of them.

  1. 1Dropout2014
  2. 2Batch Normalization2015
  3. 3Adam2015
  4. 4ResNet2016
  5. 5LayerNorm & RMSNorm2016
  6. 6mixup2018
  7. 7The Lottery Ticket Hypothesis2019

All 110 papers, in 19 ladders →

Dropout: A Simple Way to Prevent Neural Networks from Overfitting · Srivastava, Hinton, Krizhevsky, Sutskever, Salakhutdinov · JMLR 2014 · read the original paper → · Vibe Engines · 2026
Finished this one? 0 / 110 Paper Breakdowns done
NextBatch Normalization Next on the “Making deep nets train” ladder · rung 2 of 7

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns