Training Methods Intermediate

Regularization

A device that fines a model whenever its values grow too large

Key points
  • Regularization is a device that fines a model during training whenever its values grow too large. It trains on the size of the values as well as the error.
  • Chasing error alone lets some values swing to extremes, carving out a jagged answer that fits the data too closely.
  • Once the fine is in place, the model looks for a way to succeed without using large values. The result smooths out and holds up better on new data.
  • The strength of the fine is set by a person. Too weak and it does nothing; too strong and the model can't learn what it needs to.
  • It shares a name with the value-scaling kind of normalization, but the two do completely different jobs.
Contents

1The analogy

Crank up the heat under a pressure cooker and the pressure inside keeps climbing. Leave it alone and the lid won't hold, so a weight sits on top. Once the pressure reaches a set line, the weight lifts, steam hisses out, and the pressure drops back below that line.

The weight doesn't stop the cooking. The heat stays on, the food still cooks through. All it does is charge a cost every time the pressure tries to climb past the line. Thanks to that, the inside stays at a level the pot can always handle.

Regularization is this weight. Training carries on as usual, but every time a value tries to grow, a cost gets added on. If growing the value doesn't buy more than that cost, the model simply doesn't bother. How heavy to make the weight gets decided before the pot even goes on the stove.

2In detail

Chasing error alone lets values grow

Training only ever moves in the direction that lowers error. But try to hit every single point in the data exactly, and the line standing in for the answer has to bend hard, weaving in and out between the points. Bending that much takes some very large values — a large value is what lets a small change in input swing the result wildly.

A model like this scores extremely well on the data it trained on. But feed it something new and it gets things badly wrong, because it traced the noise mixed into the data as if it were the answer. This is exactly the state called overfitting.

A large value also means the result is leaning hard on that one value. Let that one feature shift even slightly and the answer wobbles. That's why a large value is itself a warning sign.

Fining the size of the values

Regularization adds one more item to the loss training measures. Up to now, training only watched "how wrong am I." Now it watches "how large are my values" too, and moves in the direction that brings both down together.

That turns growing a value to shave a little off the error into a losing trade. The model only grows a value when the error drops by a lot, and otherwise keeps it small. The result is a smoother line standing in for the answer, and scores that hold up on data it has never seen.

The same term shows up in the calculation that moves the values too. Every step, an extra pull toward zero gets tacked onto each value. This approach also goes by the name weight decay.

Setting the strength of the fine

How heavy to make the weight is a choice a person makes. Set it too light and the fine barely registers, so values shoot up as if nothing were there. Set it too heavy and the model can't grow its values at all, missing even the real patterns hiding in the data — everything it outputs turns bland and obvious.

The right strength depends on how much data there is and how big the model is. Less data means memorizing is easy, so the fine gets set heavy; plenty of data lets it run lighter. In practice, several strengths get tried and whichever scores best on data held aside gets kept.

Two ways to charge the fine

How you measure the size of the values changes the outcome. Squaring the values before adding them up charges an especially heavy fine on large values. Values shrink overall without hitting exactly zero, and several of them end up sharing the load evenly.

Adding up the values as they are, with no squaring, behaves differently. It pushes values with little use straight down to zero, so the actual number of values in play shrinks. This approach gets picked when the goal is figuring out which features don't matter. The two are sometimes mixed together too.

3More precisely

Regularization adds a term measuring the size of the values to the loss function and minimizes both together. Adding the squared sum is called L2; adding the sum of absolute values is called L1. The coefficient multiplied in when that term is added sets the strength of the fine, and unlike the model's own values, it isn't learned — a person sets it ahead of time.

In the broad sense, regularization is also used as an umbrella term for any technique that keeps a model from memorizing its data outright. Randomly resting some connections during training, or stopping training the moment scores start to slip, both fall under this wider meaning. Used in the narrow sense, though, regularization usually points specifically to fining the size of the values.

The analogy breaks down in one place. A pressure-cooker weight only acts the instant the pressure crosses its set line, but a fine is always applied a little, even while values are still small. There's no separate threshold that has to be crossed — the cost simply grows right alongside the value.

4Try it yourself

5Common misconceptions

  • It's easy to think this regularization is the same one that scales values into the 0-to-1 range, but actually it's a different device that fines the size of values — even the English names are different words.

  • It's easy to think a heavier fine always makes a model sturdier, but actually push it too far and the model can't learn what it needs to, so its score drops right along with it.

  • It's easy to think adding regularization makes overfitting disappear, but actually it only cuts down how much there is, and it needs to be paired with more data or a well-chosen stopping point.

7One-line summary

In shortRegularization is a weight that adds a cost every time a value tries to grow, steering a model toward a smooth answer instead of one that traces its data line for line.

Spotted an error or have a better analogy? Suggest an edit · Last updated2026-09-02