Concepts / Neural network capacity

Neural network capacity

The central distinction is simple: reducing network size changes the network's capacity, while weight regularization adds a penalty term to the loss function.

  • Programming

When Fitting Becomes Too Free

When a neural network overfits, a useful response is to limit how freely it can fit the training data. The source presents two ways to do this: reduce the network's size or add weight regularization. Both are used to help mitigate overfitting, but they act on different parts of the learning problem.

Key point

The central distinction is simple: reducing network size changes the network's capacity, while weight regularization adds a penalty term to the loss function.

Smaller networklower capacityTraining fitless freedomOverfittingmitigationpossible benefitLarger networkhigher capacityTraining fitmore freedomOverfitting riskpossible concernlimitscan mitigateallowscan increase
How are network size, representational capacity, training fit, and generalization connected as a model becomes larger or smaller?

Following Capacity Through the Model

Network capacity describes how much freedom a neural network has to fit data. In the source's mitigation idea, reducing the network's size decreases this capacity. A smaller network therefore has less freedom to fit the training data, which can help mitigate overfitting. The important point is not that every smaller network automatically performs better. The point is that reducing size limits the model in a way that may address excessive fitting.

Worked example

Two architectures, one mitigation goal

A learner suspects that a neural network is overfitting. Compare keeping a larger architecture with reducing its size.

  1. 1
    Start with the larger network

    The larger architecture has more network capacity and therefore more freedom to fit the training data.

  2. 2
    Reduce the network size

    Removing part of the architecture reduces network capacity. The model is now more limited in how freely it can fit the training data.

  3. 3
    Connect the change to overfitting

    Because the model's freedom has been limited, the size reduction can mitigate overfitting.

Result

Reducing network size is a capacity-based response to overfitting.

Original networklarger capacityFit training datamore freedomSmaller networkreduced capacityFit training dataless freedomcancan
What changes when layers or neurons are removed, and how can the smaller model reduce its ability to fit noise in the training data?

Changing the Objective

Weight regularization works differently from reducing network size. It keeps the network architecture as the setting being considered, but changes the loss function by adding a penalty term. The network is therefore evaluated using an objective that includes both its ordinary loss and an additional penalty associated with the weights. This gives the learning process an additional reason not to choose weights that incur a large penalty.

Original lossfit objectiveLoss functionoriginal objectiveOriginal lossfit objectiveModified lossfunctioncombined objectiveWeight penaltyadditional termdefinescontributesadds to
How does adding a weight penalty change the objective the network minimizes, and how does that discourage overly complex weights?

Two Routes to Less Overfitting

MitigationWhat changesHow to recognize it
Reduce network sizeThe network's size and capacityThe architecture is made smaller
Add weight regularizationThe loss functionA penalty term is added to the loss

Both techniques can help mitigate overfitting, but they act on different parts of the model-training setup.

Reduce network sizecapacity changesNetwork architecturesmaller modelWeightregularizationloss changesLoss functionpenalty addedchangeschanges
What is the difference between limiting the model's architecture and keeping the architecture while penalizing large weights?
Worked example

Classifying a proposed mitigation

Classify each proposal by asking whether it changes network capacity or the loss function.

  1. 1
    Proposal A

    Make the network smaller. This changes the network's size and therefore reduces its capacity.

  2. 2
    Proposal B

    Add a weight penalty to the loss. This changes the loss function rather than identifying the mitigation by a reduction in network size.

  3. 3
    Final classification

    Proposal A is network-size reduction. Proposal B is weight regularization.

Result

Check the object being changed: architecture means reduced capacity; loss means an added weight penalty.

Choosing a Response

Overfittinglimit free fittingWhat changes?architecture or lossNetwork sizecapacity decreasesReduce network sizecapacity-based mitigationLoss functionpenalty addedAdd weightregularizationloss-based mitigationclassifyarchitectureobjectivechoosechoose
How should a learner decide whether a proposed response reduces network size or adds weight regularization?
EASY

A model is overfitting. For each proposed response, identify whether it changes network capacity or changes the loss function: make the network smaller; add a penalty term for the weights.

Hints
  • Ask whether the architecture itself becomes smaller.
  • Look for the phrase penalty term and connect it to the loss function.

What do you think happens?

A proposed mitigation leaves the network architecture unchanged but adds a penalty term to the loss function. Which technique is it?

  • Reducing network size

  • Weight regularization

Reveal answer
Answer:

Weight regularization

The distinguishing feature is the added penalty term in the loss function. Reducing network size instead decreases the network's capacity.

  • Common mistake

    Treating reducing network size and weight regularization as the same technique.

    What it looks like

    Calling any overfitting mitigation a reduction in network capacity.

    Why it fails

    The two techniques act differently: one changes network size and capacity, while the other adds a penalty term to the loss function.

    Do this instead

    Classify the proposal by identifying whether it changes the architecture or the loss function.

  • Common mistake

    Describing weight regularization without mentioning the loss function.

    What it looks like

    Saying only that regularization makes a model simpler.

    Why it fails

    The defining source-grounded fact is that weight regularization adds a penalty term to the loss function.

    Do this instead

    State explicitly that the objective includes an added weight penalty.

  • Common mistake

    Assuming that reducing size means the model can no longer fit the training data.

    What it looks like

    Concluding that a smaller network cannot fit any training data.

    Why it fails

    The source says that reducing size decreases capacity and can mitigate overfitting; it does not say that fitting becomes impossible.

    Do this instead

    Describe the change as limiting how freely the network can fit the training data.

Key Takeaways

  1. 1
    Reducing network size decreases neural network capacity and can mitigate overfitting.
  2. 2
    Weight regularization adds a penalty term to the loss function.
  3. 3
    Network-size reduction changes the architecture; weight regularization changes the objective.
  4. 4
    To classify a mitigation, check whether it changes network capacity or the loss function.
  5. 5
    Both techniques limit how freely a network can fit training data, but they do so in different ways.

At a glance

  • Reducing a neural network's size reduces its capacity and can help mitigate overfitting.
  • Weight regularization changes the loss function by adding a penalty term.
  • The techniques are distinct: one changes the architecture, while the other changes the objective.
  • When classifying an overfitting response, identify whether it changes network capacity or the loss function.

Related concepts

More concepts starting with N