# Why Does Weight Initialisation Matter?

> Why the starting size of a neural network's random weights decides whether a deep model learns at all, and how Glorot and He rules fix it, for your AI interview.

**In short:** Weight initialisation sets how big the random starting weights in a neural network should be. Too large and sigmoid units get stuck at 0 or 1, too small and the signal fades, so a deep network can stall from the first step. Glorot and He rules pick a size that keeps signals steady through the layers.

AI and LLM interview question Q438, Classic ML and deep-learning basics. Advanced, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/why-does-weight-initialisation-matter

## Say it in 30 seconds

Weight initialisation is choosing how big the random starting weights in a neural network should be. Too big, and the sigmoid units get stuck at 0 or 1, so they pass almost no learning signal back. Too small, and the signal fades layer by layer, so every input looks the same. I pick a rule that fits the activation: Glorot for tanh, He for ReLU. It is a small choice that decides whether a deep network learns at all.

## Say it in 2 minutes

A neural network is a stack of layers, and every connection has a weight, a number that scales the signal passing along it. Before training, those weights start as random numbers. Weight initialisation is the rule for how big those numbers should be. It sounds like a small detail, but it decides what the first pass through the network does.

If the numbers are too large, each unit's sum swings far from zero, and a sigmoid squashes it to 0 or 1. A unit stuck there passes almost no learning signal back. If the numbers are too small, every unit gives nearly the same answer, and the differences between inputs fade layer by layer. Either way, a deep network can stall right at the start.

Glorot and He rules size the range from each layer, so signals keep a steady size through the layers. I use Glorot for tanh units, and He for ReLU units. On a 40-layer claims model I would also log each layer's spread on one batch before training, so a bad start shows up in minutes instead of three days of wasted runs.

When I explain this in an interview, I give the rule, the reason it works, and how I would check it in a real run. That shows I think about the whole network as well as the model code.

## What is weight initialisation, in plain words?

A neural network is a stack of layers. Each layer multiplies its inputs by weights, which are just numbers that say how much each signal counts, adds the results up, and passes the total through an activation. The activation is a small rule that squashes or reshapes the sum.

Before training starts, the weights are filled with random numbers. Weight initialisation is the rule for how big those random numbers should be. In 2010, Glorot and Bengio asked why training deep networks from random starts had gone so badly. Their study began with the activation functions, the rules that squash each unit's sum.

Think of a claims desk where each clerk adds a note to a file and passes it on. If every note doubles the pile, the file is unreadable by the fifth desk. If every note is tiny, nothing useful is left by the tenth. How big the first notes are decides which of these happens.

The same thing happens in a real model. A 12-layer network that triages insurance claims starts with random weights. A bad scale can leave it stuck from the first step, with the loss, the score that says how wrong the model is, barely moving.

- **Weight:** A number on a connection that scales the signal passing along it.
- **Layer:** One step in the stack: a set of units that all read the same inputs.
- **Sigmoid:** An activation that squashes any number into a value between 0 and 1.
- **Saturated:** Stuck near the top or bottom of its range, so a small change in the input makes almost no difference.
- **Gradient:** The learning signal that tells each weight which way to move, and by how much, during training.

## What goes wrong when the starting scale is wrong?

A signal travels forward through the layers, and the learning signal, the gradient, travels back. Both need a sensible size to survive the trip. Glorot and Bengio tested sigmoid units and found they are a poor fit for a deep network started at random. Its mean value can push the top hidden layer into saturation.

- **Too large: Units pinned at 0 or 1.** Sums swing far from zero, the sigmoid squashes them flat, and almost no learning signal gets back through.
- **Too small: Every unit says much the same.** Outputs crowd around the middle, so differences between inputs fade and later layers cannot tell cases apart.
- **Right scale: Signal survives each layer.** Sums stay where the sigmoid still responds, and the gradient keeps a usable size on the way back.

*Diagram, What the starting scale does to a signal: A starting scale that is too large, too small, or sized to the layer sends a signal three different ways. A range that is too large pins units at 0 or 1, one that is too small lets the signal fade, and a scale sized to the layer keeps it steady.*
1. A range that is too large makes the first sums swing wide.
2. A range that is too small keeps every sum near zero.
3. A rule sized to the layer keeps sums in a useful middle range.
4. Wide sums push sigmoid units to 0 or 1, where they learn almost nothing.
5. Tiny sums give near-identical outputs, so later layers see no difference.
6. The learning signal keeps a steady size through the layers.

> "We find that the logistic sigmoid activation is unsuited for deep networks with random initialization because of its mean value, which can drive especially the top hidden layer into saturation." (Glorot and Bengio, 2010)

Glorot and Bengio also found that a saturated unit can climb out again by itself, but only slowly. That slow climb explains the flat stretches, called plateaus, that training sometimes shows at the start, so a long flat start is one possible sign of a poor scale.

## What does a small run of 12 layers show?

This is a small sketch, not a real model. It builds 12 sigmoid layers, each 100 units wide, and feeds the same kind of random input through them. It tries three starting ranges and prints the spread (how far apart the outputs sit from their average) of each layer's outputs, plus the share of units stuck at 0 or 1. The numbers are made up for the sketch, so the pattern is what matters.

```python
# A 12-layer stack of sigmoid units, 100 wide: a made-up claims-triage network before training.
import math
import random

random.seed(7)
WIDTH, DEPTH = 100, 12

def sigmoid(z):
    return 1 / (1 + math.exp(-z))

def spread(values):
    mean = sum(values) / len(values)
    return math.sqrt(sum((v - mean) ** 2 for v in values) / len(values))

def run(limit):
    # Each starting weight is a random number between -limit and +limit.
    x = [random.uniform(-1, 1) for _ in range(WIDTH)]
    for layer in range(DEPTH):
        w = [[random.uniform(-limit, limit) for _ in range(WIDTH)] for _ in range(WIDTH)]
        x = [sigmoid(sum(wi * xi for wi, xi in zip(row, x))) for row in w]
        if layer in (0, 5, 11):
            stuck = sum(1 for v in x if v < 0.01 or v > 0.99) / WIDTH
            print(f"  layer {layer + 1:2}: spread {spread(x):.4f}, stuck at 0 or 1: {stuck:.2f}")

for label, limit in [("Too large (1.0)", 1.0), ("Glorot-sized (0.17)", 0.17), ("Too small (0.01)", 0.01)]:
    print(label)
    run(limit)
```

Output:

```text
Too large (1.0)
  layer  1: spread 0.3829, stuck at 0 or 1: 0.17
  layer  6: spread 0.3751, stuck at 0 or 1: 0.19
  layer 12: spread 0.3915, stuck at 0 or 1: 0.21
Glorot-sized (0.17)
  layer  1: spread 0.1221, stuck at 0 or 1: 0.00
  layer  6: spread 0.1294, stuck at 0 or 1: 0.00
  layer 12: spread 0.1339, stuck at 0 or 1: 0.00
Too small (0.01)
  layer  1: spread 0.0087, stuck at 0 or 1: 0.00
  layer  6: spread 0.0067, stuck at 0 or 1: 0.00
  layer 12: spread 0.0070, stuck at 0 or 1: 0.00
```

The too-large start leaves about one unit in five stuck at 0 or 1 in every layer. The too-small start is already tiny after layer 1 and stays there, so every unit gives nearly the same answer. The Glorot-sized range, about 0.17 for 100 inputs and 100 outputs, keeps a steady spread through all twelve layers, with nothing stuck.

> **Tip:** In an interview, say the numbers are illustrative. The point is that the scale decides whether the signal survives at all.

## Which scale rule should you pick?

Two named rules cover most cases. Glorot's rule sets the random range so the signal keeps a steady size through the layers. The PyTorch documentation (PyTorch is a widely used library for building neural networks) says the method is also known as Glorot initialisation, and that it is described in Glorot and Bengio's 2010 paper.

- **Glorot: For tanh.** Tanh squashes any number into a value between -1 and 1. Glorot's rule keeps the signal at a steady size through tanh units.
- **He: For ReLU-style units.** Sized for units that zero out negative sums, so the signal does not fade away layer by layer.

He's rule comes from the 2015 paper by Kaiming He and colleagues. It is built for rectifier units, the ReLU family that turns every negative sum into zero.

> "we derive a robust initialization method that particularly considers the rectifier nonlinearities" (He and colleagues, 2015)
>
> "Choosing 'fan_in' preserves the magnitude of the variance of the weights in the forward pass." (PyTorch documentation)

> **Tip:** Match the rule to the activation, then check the numbers. A good rule does not fix a bad learning rate, so test the start and the training settings together.

### How would you debug a 40-layer model whose loss will not move?

Imagine a claims-triage team whose 40-layer model sits on the same loss for three days. This is the order I check things in.

1. **Log each layer on one batch:** Before training, record how spread out each layer's outputs are and how many sit at 0 or 1. It takes seconds and shows the start.
2. **Match the rule to the activation:** Tanh units: Glorot. ReLU units: He. A mismatch is the first thing to fix.
3. **Check the gradients at both ends:** If the gradients near the input are tiny next to the ones at the output, the signal is dying on the way back.
4. **Change one thing at a time:** Re-run with a single change and compare the loss curves, so you know which fix actually worked.
5. **Add normalisation if it still stalls:** A normalisation layer rescales each layer's numbers during training, so a poor start hurts less. See the batch normalisation answer.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: the random starting scale decides whether signals and gradients survive the layers.
- [ ] Too large saturates units; too small makes the signal fade.
- [ ] Glorot for tanh, He for ReLU, and the reason for each.
- [ ] Starting all weights equal is a trap: identical neurons learn the same thing.
- [ ] Normalisation layers reduce how fragile the start is.
- [ ] Checking each layer's numbers before blaming the data.

**Common traps**

- Trap: "Any small random numbers will do." Better: The size matters, not just the randomness. Too small and too large both stall a deep network.
- Trap: "Start every weight at zero." Better: Identical neurons get identical updates and never learn different things. Random values break that tie.
- Trap: "Initialisation is a detail you can ignore." Better: It decides whether the first steps move at all, so a stuck run often starts here.

## Can you spot the problem?

**Spot the problem:** A claims-triage team sets up its 30-layer network like this. Which setup breaks learning?

A. ReLU layers, He-scaled random weights
B. Output layer with no activation, Glorot-scaled random weights
C. ReLU layers, every weight set to 0
D. Tanh layers, Glorot-scaled random weights

**Answer:** C. With every weight at 0, neurons in a layer get identical updates and never learn different features. The other three are workable: ReLU with He scale, an output layer with no activation and Glorot scale, and tanh with Glorot scale.

**Quick check:** A 40-layer sigmoid network starts with a weight range far too large. What do you most likely see?

A. Units stuck at 0 or 1 that pass on almost no learning signal
B. Every unit giving the same output, so inputs look alike
C. Faster learning, since the signals are bigger
D. No change, because only inference is affected

**Answer:** A. Large starting weights push sigmoid units to their flat ends, where they learn almost nothing. The same units would not learn faster from bigger signals, and inference is not the part that breaks.

## Can you answer these from memory?

**Flash cards**

- **What is weight initialisation?** Choosing how big the random starting weights should be before training.
- **What goes wrong if weights are too large?** Sigmoid units saturate at 0 or 1 and pass almost no learning signal back.
- **What goes wrong if they are too small?** Signals fade layer by layer, so later layers see inputs as nearly the same.
- **Glorot or He?** Glorot for tanh units. He for ReLU-style rectifiers.
- **Why not start every weight at zero?** Identical neurons get identical updates. Random values break that symmetry.
- **How do you check the start?** Log each layer's spread and stuck share on one batch before training.

## Likely follow-up questions

- Q426 Vanishing and exploding gradients? https://designervenkat.online/interview/ai/vanishing-and-exploding-gradients
- Q427 What is batch normalisation? https://designervenkat.online/interview/ai/what-is-batch-normalisation
- Q418 What is backpropagation? https://designervenkat.online/interview/ai/what-is-backpropagation
- Q417 What does the learning rate do? https://designervenkat.online/interview/ai/what-does-the-learning-rate-do
- Q415 What is gradient descent? https://designervenkat.online/interview/ai/what-is-gradient-descent

## Learn it in depth

- [Back propagation: who is to blame?](https://designervenkat.online/learn/machine-learning/backpropagation)
