Chapter 05 of 16: Combine little calculations

Why build a network of little calculators?

Arun MalikSeriesAIFoundations
Table of Contents
Builds on chapter 4. Specific dependencies are in the concept map.

One multiplier and one packing allowance cannot describe every kitchen delay. Perhaps a second sandwich adds little work until the toaster is full. We need a model that can represent bends and combinations.

One small calculation

A neural network is a model made of connected numerical operations with learned parameters. A unit, sometimes called a neuron, combines input values with weights and usually applies a transformation to the result.

Consider two invented inputs, 2 and 1. Give them weights 3 and minus 1, and add a bias of 0. The weighted sum is 2 × 3 + 1 × (−1) + 0 = 5. There is no feeling, intention, or tiny person inside this unit. “Neuron” is a historical name, not evidence that it works like a whole biological brain.

UnitToy unit with zero bias: 2 × 3 + 1 × (−1) = 5. ReLU leaves 5 unchanged; for an input sum of −2, it would output 0.21× 3× −15Sum, add bias, transform
Toy unit with zero bias: 2 × 3 + 1 × (−1) = 5. ReLU leaves 5 unchanged; for an input sum of −2, it would output 0.

An activation function transforms a unit's combined value before it passes onward. A simple example, ReLU, returns zero for a negative input and leaves a positive input unchanged. It turns 5 into 5 and minus 2 into 0.

That bend matters. Stacking only linear weighted sums would still behave like one linear calculation. Nonlinear activations let the network represent more varied relationships.

Put calculations in stages

A layer is a stage of processing in a network. An input layer receives the starting values. Hidden layers produce intermediate values. An output layer produces values used for the answer.

“Hidden” means between input and output, not deliberately secret. Imagine a preparation line: one station combines ingredients, another transforms the mixture, and a later station portions it. In a network, the material moving between stations is numbers.

LayersConnections carry numerical values between stages. Weights set connection strengths; activations transform values. The drawing is not a biological brain.InputsHiddenOutputs
Connections carry numerical values between stages. Weights set connection strengths; activations transform values. The drawing is not a biological brain.

Deep learning uses multiple layers to build useful representations. A photo model might develop combinations that respond to edges and shapes. But we should not assume each layer has one neat human job, or label a unit “apple understanding” just because a drawing would look simpler that way.

A floor plan and its settings

Architecture is the arrangement of operations and connections in a model. Learned weights are the fitted settings within that arrangement. Two networks can have the same architecture and different weights, just as two identical mixers can be set differently.

Architecture affects what can be computed and how expensive it is. Training data and optimization affect what the network actually learns. Counting layers or parameters alone cannot tell us which model will suit a particular task.

How earlier layers receive a correction

Backpropagation calculates how the loss depends on parameters throughout a network by passing derivative information backward through its operations. Derivatives describe how a small change in one value affects another.

If the final timing estimate is wrong, the training process needs information about earlier weights too. Backpropagation works backward through the calculation to find those sensitivities; an optimizer then uses them to update parameters. It does not simply tell every unit that it was wrong by the same amount.

The forward calculation produces the prediction. The backward calculation helps training change the model. Ordinary inference does not need to retrain the network for every order.

BackwardTraining computes a forward result, then propagates derivative information backward. An optimizer uses that information to update parameters.InputLayersLossForward calculationBackward sensitivities
Training computes a forward result, then propagates derivative information backward. An optimizer uses that information to update parameters.
Does adding layers automatically fix bad examples?

No. A larger network can still learn misleading patterns or memorize examples. The next chapter asks how to find out whether its learning carries over to new cases.