Weights and biases are the numbers a network actually learns. Every other setting you choose is in service of finding good values for these two.
One input, weight w = 2.0, bias b = 0. At x = 0.5 you get z = 1.0 — the neuron fires.
Now set b = −1.5 and leave everything else alone: z = 1.0 − 1.5 = −0.5. Same input, same weight, opposite decision. The bias moved the threshold from x > 0 to x > 0.75.
This is why a bias is not optional detail. It is the difference between "is this input positive?" and "is this input above the level that actually matters?"
Without a bias, the weighted sum is zero whenever every input is zero, so the decision boundary is forced through the origin. That is a severe restriction: a neuron that should fire only when its input exceeds 5 cannot express that threshold at all, because it has no way to shift its output independently of the inputs.
The bias supplies exactly that freedom. In y = wx + b, w tilts the line and b slides it — and the same is true in a thousand dimensions, where the weights orient a hyperplane and the bias offsets it from the origin. One extra parameter per neuron buys the ability to place the boundary anywhere rather than only through a single fixed point.
A fully connected layer with nin inputs and nout outputs has one weight per connection plus one bias per output neuron:
parameters = (nin × nout) + nout
For 784 inputs and 128 outputs that is 784 × 128 + 128 = 100,480. The biases are 128 of them — about 0.1% of the total, which is why they are cheap enough to always include and why regularisation normally skips them.
Notice the weight count is a product. Doubling either the input or the output size doubles the parameters; doubling both quadruples them. That quadratic growth is why wide layers dominate a network’s memory footprint.
Training changes nothing about the network except these numbers. The architecture, the activations and the connections are all fixed before the first step; gradient descent only ever adjusts weights and biases.
That is worth holding onto, because it clarifies what a trained model is: a specific set of values for these parameters. Saving a model saves the weights and biases. Transfer learning reuses another model’s weights and biases. A randomly initialised network and a fully trained one differ in no other respect.
One input, weight w = 2.0, bias b = 0. At x = 0.5 you get z = 1.0 — the neuron fires.
Now set b = −1.5 and change nothing else: z = 1.0 − 1.5 = −0.5. Same input, same weight, opposite decision.
The bias moved the threshold. Before, the neuron fired whenever x > 0; now it fires whenever x > 0.75. That is the difference between asking "is this input positive?" and "is this input above the level that actually matters?"
Which is why a bias is not an optional detail. A network without biases can only draw boundaries through the origin, and almost no real decision boundary passes through the origin.
Weights are the multipliers on the connections between units. A layer taking 100 inputs into 50 units has a 100×50 weight matrix — 5,000 numbers, one for every input-output pair.
Biases are one number per unit — 50 in that layer — added after the weighted sum.
z = w · x + b
Both are learned. Everything else you set — the number of layers, the learning rate, the batch size — is in service of finding good values for these two.
A useful proportion: biases are a tiny fraction of a network's parameters. A layer with 100 inputs and 50 units has 5,000 weights and 50 biases, so about 1%. They are cheap and they matter.
In a single-layer model, a weight's magnitude is interpretable: a large positive coefficient on "smoking" means smoking pushes the prediction up. That reading is why logistic regression survives in regulated settings.
In anything deeper, it breaks down. A feature's influence is spread across many paths, and a small first-layer weight can still matter enormously downstream through amplification in later layers. Reading a single weight as feature importance in a deep network is unreliable, and integrated gradients or SHAP are the tools that do the job properly.
Two things that are worth reading from trained weights:
Wildly different magnitudes across features is almost always a symptom of unscaled inputs, not a finding. If one feature is measured in thousands and another in decimals, the network compensates with tiny and huge weights, and gradient descent struggles to move both usefully. Scale the inputs instead.
The distribution of weight magnitudes tells you whether regularisation is doing anything. A histogram concentrated near zero with a few large values is what weight decay produces.
Wildly different weight magnitudes are almost always a symptom of unscaled inputs rather than a real finding. If one feature is measured in thousands and another in decimals, the network compensates with tiny and huge weights, and gradient descent struggles to move both usefully. Scale the inputs instead.Reading a single weight as feature importance is unreliable in anything deeper than one layer. In a multi-layer network a feature's influence is spread across many paths, and a small first-layer weight can still matter enormously downstream.
Weights decide direction and strength; the bias decides where the threshold sits.
There are two standard cases where a bias is omitted.
Before batch normalisation. Normalisation subtracts the mean, which cancels any constant the previous layer added. So a convolution followed by batch normalisation has a redundant bias, and reference implementations write bias=False. It saves parameters and changes nothing.
In some attention projections, where recent language models drop biases from the query/key/value projections and sometimes from the feed-forward layers as well — they turn out to contribute little at scale, and removing them simplifies the model slightly.
Otherwise, keep the bias. The default in every framework includes it for good reason.
At initialisation, weights are small random values and biases are zero. Random weights break the symmetry between units — identical weights would mean identical gradients and units that never differentiate. Biases can start at zero because the weights already differ.
During training, both are updated by the same rule:
w ← w − η ∂L/∂w b ← b − η ∂L/∂b
The gradient with respect to a weight includes the input value (∂z/∂w = x), so a feature that is always near zero produces near-zero gradients and its weight barely moves. The gradient with respect to a bias is just the upstream gradient (∂z/∂b = 1), so biases update regardless of the input scale — another reason they train reliably.
One deliberate exception to zero-initialised biases: setting the final bias of a binary classifier to the log-odds of the positive class makes the model start out predicting the base rate, which noticeably speeds up early training on imbalanced data.
A layer is a matrix and a vector. This counts them for a real architecture, then moves single values to watch what they control.
How many parameters does a layer have? inputs × units weights plus units biases.
Why initialise weights randomly but biases to zero? Random weights break symmetry between units; once they differ, zero biases cause no problem.
Can weights be negative? Yes, and roughly half will be. A negative weight means the feature counts against that unit's activation.
Should biases be regularised? No. Weight decay is normally applied to weights only — biases carry no capacity worth penalising.
What does a weight of zero mean? That the connection is effectively unused. L1 regularisation produces exactly zero weights; L2 produces small but non-zero ones.
Do biases increase capacity? Not in the sense of expressiveness across features, but they let every boundary sit where the data requires rather than through the origin — which is a large practical difference.
Say the answer out loud before you reveal it — recalling it is what makes it stick, and rereading it is not.
Without scrolling back — what is the one-line takeaway from this module?
What does this module say about “What each one does geometrically”?
What does this module say about “A concrete example”?
Weights and biases are the numbers a network actually learns. Every other setting you choose is in service of finding good values for these two.