3.1.12 · D1Neural Network Fundamentals

Foundations — Weight initialization (Xavier, He)

2,195 words10 min readBack to topic

This page builds every symbol the parent note throws at you, from absolute zero. If you have never seen , , , or before — start here and read top to bottom. Each block gives you: plain words → the picture → why the topic needs it.


0. The picture the whole topic lives inside

Before any symbol, hold this image in your head: a stack of layers, each turning a list of numbers into a new list of numbers.

Figure — Weight initialization (Xavier, He)
  • The circles are neurons — each one holds a single number.
  • A whole column of circles is a layer — a list of numbers.
  • Every arrow carries a number from one neuron to the next, and each arrow has its own weight that scales what passes along it.

Everything below is a tool for answering ONE question: as numbers flow left-to-right through many layers, do they stay a healthy size, or do they blow up / die out?


1. A single number and a list of numbers (the vector)

Picture: a column of boxes, one number per box.

Why the topic needs it: each layer of the network is a vector — the parent note writes and , and those are vectors (whole layers of numbers), not single numbers. Before you can ask "does the layer explode?" you need to see a layer as a list you can measure.


2. Superscripts and subscripts — the address labels

Picture: a filing cabinet. The bracket-superscript names the drawer (which layer), the subscript names the folder inside (which item).

Why the topic needs it: the parent note constantly compares layer to layer ("variance stays constant across layers"). Without the address labels you can't say which layer's numbers you mean.


3. The weight, the input, and the summation

Picture: many arrows feeding one circle; each arrow scales its number, and the circle sums them.

Figure — Weight initialization (Xavier, He)
  • — the -th input number arriving on an arrow.
  • — the weight on that arrow (how strongly it counts).
  • — the pre-activation: the total the neuron receives before it decides its output.

Why the topic needs it: the final answers are literally and . Those symbols are just "count the arrows in" and "count the arrows out". The whole derivation is asking: if I add up scaled numbers, how big does the total get?


4. Expectation — the "average"

Picture: a dartboard with darts scattered around a bullseye. is the centre of mass of the dart cloud.

Figure — Weight initialization (Xavier, He)

Why the topic needs it: the parent note assumes weights and inputs are "zero-mean". This is why we set biases to and centre the random weights on . Many later simplifications (like ) are only true when the mean is zero — so this symbol earns the rest of the algebra.

See Variance and Expectation for the full toolkit; here we only need the two facts above.


5. Variance — the "how spread out" number

This is the star of the whole topic.

Picture: two dart clouds with the same centre — one tight (small variance), one splattered (big variance).

Figure — Weight initialization (Xavier, He)

Why "variance" and not just "size"? We can't track the exact value of every signal — it's random. But we can track how spread out the signal is, and spread is exactly what "explodes" or "vanishes". Variance is the right ruler because it obeys clean addition/multiplication rules for independent zero-mean numbers — the two rules the whole derivation leans on:

Why the topic needs it: the sum rule (variance of a sum = sum of variances) is only valid when the terms are independent — that's why the derivation states "assume i.i.d." out loud before using it.


6. The bell curve and the flat box

Picture: a smooth hill next to a flat-topped table , both symmetric about .

Why the topic needs it: the final formulas say "sample ". Now you know that's an instruction: pick each weight from a bell curve of that spread. The symbol means "is drawn from".


7. The activation — the neuron's decision

Picture: the pre-activation enters a shaped ramp; the output comes out reshaped.

See Activation Functions (ReLU, tanh, sigmoid) for their shapes. Here you only need: the activation decides how much variance survives to the next layer, and ReLU is the one that halves it.

Why the topic needs it: the choice of is why there are two different constants. tanh/sigmoid → Xavier; ReLU → He. The activation is the fork in the road.


8. Forward and backward — the two directions

Picture: two arrows on the same tower — a blue one flowing right (activations), an orange one flowing left (gradients).

Why the topic needs it: Xavier's "" is a compromise between the forward wish and the backward wish. You can't see why it averages two numbers until you know there are two directions to please. This is exactly the Vanishing and Exploding Gradients problem that init prevents.


Prerequisite map

Scalar and vector

Index labels w_i and layer l

Weighted sum z = sum w_i x_i

Fan-in n_in and fan-out n_out

Expectation and zero-mean

Variance and std dev sigma

Product rule and sum rule

Master eq Var z = n_in Var w Var x

Normal N and Uniform U recipes

Activation phi and ReLU

ReLU halves variance

Forward and backward passes

Two variance goals

Weight initialization Xavier He

Everything upstream feeds the parent topic Weight initialization. Batch Normalization and Deep Network Training Stability sit downstream — they build on this same variance idea.


Equipment checklist

Read each question, answer in your head, then reveal.

What does a subscript pick out, vs a bracketed superscript ?
= the -th item in a list; = the weights belonging to layer (an address, NOT a power).
What does the symbol literally tell you to do?
Multiply each by its and add all products together.
What is fan-in in one picture?
The number of arrows coming into a neuron = number of terms in its sum.
What does (zero-mean) mean as a dart cloud?
The cloud is centred exactly on — equally likely positive or negative.
In plain words, what does variance measure?
How spread out / jumpy the random values are around their average.
State the product rule and sum rule for independent zero-mean variables.
and .
Why is "independent (i.i.d.)" required before adding variances?
The sum rule only holds when terms don't influence each other.
What does instruct you to do?
Draw each weight from a bell curve centred at with variance .
What is the variance of a uniform ?
— the source of Xavier's "".
What does the activation do, and what makes ReLU special?
It reshapes the sum into the output ; ReLU zeroes negatives, throwing away half the variance.
Why do we track variance instead of the exact signal value?
The signal is random, but its spread is what explodes or vanishes — and variance has clean add/multiply rules.
Why does the derivation produce two goals ( and )?
One keeps the forward activations healthy, the other keeps the backward gradients healthy.