Optimization

Weight Initialization: Xavier, He & muP

How to pick weight scales so activations/gradients stay stable: Xavier/Glorot, He/Kaiming, and width-scaling ideas like muP.

status: reviewimportance: importantdifficulty 3/5math: undergraduateread: 14mprediction probe

Concept Structure

Weight Initialization: Xavier, He & muP

01Intuition

Start with the picture, metaphor, or geometric mechanism.

02Math

Make the objects explicit and connect them with notation.

03Code

Mirror the equations with runnable implementation details.

04Interactive Demo

Commit a prediction against the code witness.

2prerequisites
1next concepts
1related links

Learner Contract

What this page should let you do.

You are here becauseHow to pick weight scales so activations/gradients stay stable: Xavier/Glorot, He/Kaiming, and width-scaling ideas like muP.

This Optimization concept is the current object: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.

By the end4/4 sections ready | code witness expected | prediction probe

Explain the mechanism, trace the main notation, and answer the prediction probe against the code witness.

Do this firstIntuition

Read the intuition before the notation; the math should name a mechanism you already felt.

Test the linkUse the prediction probe to commit to the mechanism before moving on.Then continue to Scaling Laws & Emergent Abilities

Claim/source review status

Claim review not recorded

No structured claim checks yet; source metadata is not enough to establish support.Metadata-derived; review may be AI-assisted. Not a human certification.
Claims0/0 reviewed
Sources0 cited
Codeattached
Demoplanned
Reviewednot recorded
Updatedpage 2026-06-29

Object flow

4/4 sections readyAsk about thisResearch room
ConceptWeight Initialization: Xavier, He & muPOptimization
Local snapshot ready
concept:optimization/weight-initialization
01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

Section prompt

Initialization is the starting geometry of learning.

If weights are too small, signals shrink as they pass through layers and gradients vanish. If weights are too large, activations and gradients explode and training becomes unstable.

Good initializations aim to keep the "scale" of information roughly constant as it flows forward (activations) and backward (gradients).

Two classics:

  • Xavier/Glorot: good for tanh/sigmoid-like activations.
  • He/Kaiming: good for ReLU-like activations (because ReLU zeros out about half of inputs).

Modern scaling work adds another layer: you want hyperparameters to transfer as width changes. muP is one way to parameterize networks so you can tune on a small model and scale up with fewer surprises.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

Section prompt

Consider a linear layer h=Wxh = Wx where xRninx\in\mathbb R^{n_{in}} has i.i.d. components with Var(xi)=σ2\mathrm{Var}(x_i)=\sigma^2. Assume WijW_{ij} are i.i.d. with mean 0 and variance Var(Wij)=v\mathrm{Var}(W_{ij}) = v.

Then each output coordinate is a sum of ninn_{in} terms, so:

Var(hj)ninvσ2.\mathrm{Var}(h_j) \approx n_{in}\,v\,\sigma^2.

To keep variance stable across layers (Var(hj)σ2\mathrm{Var}(h_j) \approx \sigma^2), set:

v1nin.v \approx \frac{1}{n_{in}}.

This motivates Xavier-like scaling. For ReLU, roughly half the mass is zeroed, so to keep variance stable you use about twice the variance:

Var(Wij)2nin.\mathrm{Var}(W_{ij}) \approx \frac{2}{n_{in}}.

muP (Maximal Update Parameterization) extends this idea to updates: scale parameters and learning rates with width so that update magnitudes stay comparable across model sizes.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

Section prompt
import numpy as np

rs = np.random.RandomState(0)

def run(depth=20, width=512, scale=1.0, relu=True):
    x = rs.randn(width)
    vars = []
    for _ in range(depth):
        W = rs.randn(width, width) * (scale / np.sqrt(width))
        x = W @ x
        if relu: x = np.maximum(x, 0)
        vars.append(float(x.var()))
    return vars

for name, scale in [("too small", 0.3), ("xavier-ish", 1.0), ("too large", 3.0)]:
    v = run(scale=scale)
    print(name, "var@layer1", round(v[0], 3), "var@layer20", round(v[-1], 3))
04

04

Interactive Demo

Use the authored prediction probe to test the mechanism without a live widget.

Section prompt

Prediction check: before running the witness, rank too small, xavier-ish, and too large by their expected layer-20 variance. Then change relu=False and see how the activation choice changes the initialization scale that feels stable.

After The First Pass

Turn the concept into an inspected object.

Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.

Mechanism Storyboard

See the idea move before the page explains it

How to pick weight scales so activations/gradients stay stable: Xavier/Glorot, He/Kaiming, and width-scaling ideas like muP.

Demo notes open01 / Intuition
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Weight Initialization: Xavier, He & muP should make visible.

Visual Inquiry

Make the image answer a mathematical question

How to pick weight scales so activations/gradients stay stable: Xavier/Glorot, He/Kaiming, and width-scaling ideas like muP.

4/4 stages readyDemo notes connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Weight Initialization: Xavier, He & muP easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

Source gapNo canonical references are listed yet.

Add source metadata before treating this page as source-grounded.

Claim Review

How to pick weight scales so activations/gradients stay stable: Xavier/Glorot, He/Kaiming, and width-scaling ideas like muP.

StatusSubstantive claim review pending

Source IDs and witness objects are attached for review; they are not proof by themselves.

SourcesNo references

Add source metadata before claiming support.

Witnesses3 local objects

Use equation, code, and demo objects to check whether the source support is operational.

Practice Loop

Try the idea before it explains itself

How to pick weight scales so activations/gradients stay stable: Xavier/Glorot, He/Kaiming, and width-scaling ideas like muP.

Readiness0/3 checks ready
Predict

Before touching the demo, predict one visible change that should happen in Weight Initialization: Xavier, He & muP.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Object research drawerClose
ConceptWeight Initialization: Xavier, He & muPOptimization

Research Room

Attach the question to an exact object

Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptOptimization

Weight Initialization: Xavier, He & muP

Anchored question

What is the smallest example that makes Weight Initialization: Xavier, He & muP click without losing the math?

Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays locally in this browser for concept:optimization/weight-initialization.

No local draft saved.
Evidence to inspect
  • Definition, prerequisite, and contrast concept links
  • The equation or code witness that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Grounded AI handoff

I am working in Continuous Function's research reading room. Object: concept - Weight Initialization: Xavier, He & muP Object key: concept:optimization/weight-initialization Context: Optimization Anchor id: concept/concept-notebook/optimization/weight-initialization Open question: What is the smallest example that makes Weight Initialization: Xavier, He & muP click without losing the math? Evidence to inspect: - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.

Open source object
concept/concept-notebook/optimization/weight-initialization concept:optimization/weight-initialization