Why Constant Weight Initialization Breaks Neural Network Training
Hard · Machine Learning · Data Scientist · Technical Screen
Prompt
Suppose you are training a multi-layer feed-forward neural network whose hidden units apply an element-wise nonlinearity f (for instance, Tanh, Sigmoid, or ReLU). After a code cleanup, a bug sets every weight matrix entry—along with every bias vector entry—to 0 before training starts.
Using a concrete two-layer network that maps input x to prediction y_hat via hidden weights W1, output weights W2, zero biases b1, b2, activation f, and standard gradient descent updates w = w - learning_rate * gradient:
- Derive mathematically what happens during the forward pass and backpropagation when all weights and biases start at
0, showing why the model fails to learn meaningful representations. - Define symmetry breaking and show why identically initialized hidden units can never diverge under deterministic gradient updates.
- Contrast how this initialization bug behaves across linear activations versus non-linear activations (
ReLU,Tanh, andSigmoid). - Recommend a principled initialization method (such as Glorot/Xavier or He/Kaiming initialization) and explain how it resolves both neuron symmetry and layer-to-layer variance scaling.
Scope & Expectations
- Write out the forward activations and chain-rule parameter gradients (
dL/dW2,dL/dh,dL/dW1) to distinguish total weight deadlock (f(0) = 0) from symmetric updates (f(0) != 0). - Prove by induction on
w = w - learning_rate * gradientthat identically initialized hidden units remain clones forever, collapsing anm-unit hidden layer to effective width1. - Compare rank-1 collapse in linear networks against lost non-linear capacity (such as inability to fit XOR) across
ReLU,Tanh, andSigmoid. - Justify fan-in / fan-out variance scaling (
XaviervsHe) so activations and gradients neither vanish nor saturate.
Step-by-step walkthrough
Picture the two-layer network and its update rules
To see mathematically why constant initialization fails, let us set up a concrete two-layer feed-forward neural network. Suppose an input vector
xwithdfeatures passes through one hidden layer ofmneurons and produces an output vectory_hatof sizek(deeper networks repeat the exact same pattern layer by layer):Input x Hidden layer (m neurons) Output y_hat (d features) z1 = W1 x + b1, h = f(z1) y_hat = W2 h + b2 x_1 ----W1[1,1]---> ( z1_1 -> h_1 = f(z1_1) ) ---W2[1,1]--\ \ / +--> y_hat_1 \/ / /\ / / \ / x_2 ----W1[2,2]---> ( z1_2 -> h_2 = f(z1_2) ) ---W2[1,2]--/Here are the building blocks in plain terms:
- Forward pass: computing the prediction
y_hatfrom the inputxstep by step from left to right. - Pre-activation (
z1): the weighted sumW1 x + b1entering each hidden neuron before the non-linearity, with shape(m,), whereW1has shape(m, d)andb1has shape(m,). - Activation function (
f): an element-wise function such as ReLU (max(0, z)), Sigmoid (1 / (1 + exp(-z))), Tanh (tanh(z)), or linear (z) that turnsz1into hidden activationsh = f(z1)of shape(m,). - Loss (
L): a single number measuring how wrongy_hatis compared to the true targety, such as squared errorL = 0.5 * ||y_hat - y||^2. - Backpropagation: applying the chain rule of calculus from right to left to compute each parameter's gradient (the rate of change
dL/dwtelling us how nudgingwchanges the loss).
Let
delta2 = dL/dy_hatbe the output error signal (for squared error0.5 * ||y_hat - y||^2,delta2 = y_hat - y; if the output layer also wrapsz2 = W2 h + b2in an output activationg, definedelta2 = dL/dz2and every formula below stays identical). Using*for element-wise multiplication on vectors:dL/dW2 = delta2 @ h^T entry [i, j] = delta2_i * h_j dL/db2 = delta2 entry [i] = delta2_i dL/dh = W2^T @ delta2 entry [j] = sum_i W2[i, j] * delta2_i delta1 = dL/dz1 = (W2^T @ delta2) * f'(z1) dL/dW1 = delta1 @ x^T entry [j, l] = delta1_j * x_l dL/db1 = delta1 entry [j] = delta1_jFor a single output (
k = 1), the gradient for a single hidden weightW1[j, l](connecting inputlto hidden neuronj) is a simple four-factor chain rule product:dL / dW1[j, l] = delta2 * W2[1, j] * f'(z1_j) * x_l output outgoing activation input error weight slope valueGradient descent then updates every weight and bias using
w = w - learning_rate * gradient. Two facts in those equations control everything that follows: 1. A layer's weight gradient equals (error signal at its output) times (activation entering it from below). 2. The error signal reaching a hidden neuronjis multiplied by the outgoing weights above it (W2[:, j]).- Forward pass: computing the prediction
Trace the forward pass when every weight and bias is zero
Now set every weight and bias to zero:
W1 = 0,b1 = 0,W2 = 0, andb2 = 0. For any input vectorx:z1 = 0 @ x + 0 = (0, 0, ..., 0) every hidden neuron receives 0 h_j = f(0) every hidden neuron outputs the exact same number f(0) y_hat = 0 @ h + 0 = (0, ..., 0) the network outputs 0 regardless of xDepending on
f,f(0)is either0(for ReLU, Tanh, and linear/identity) or non-zero (0.5for Sigmoid). Either way, the forward pass already exhibits two failures:- The prediction completely ignores
x. Every training example producesy_hat = 0. - Every hidden neuron is an identical clone. Neuron
1through neuronmcompute the exact same pre-activation0and the exact same activationf(0).
- The prediction completely ignores
Trace backpropagation and a two-step numeric example
Substitute
W1 = 0,b1 = 0,W2 = 0,b2 = 0, andh_j = f(0)into the backpropagation equations on Step 1:dL/db2 = delta2 non-zero whenever y_hat != y dL/dW2[i, j] = delta2_i * f(0) 0 if f(0) = 0; delta2_i * 0.5 for Sigmoid (same for every j!) dL/dh = W2^T @ delta2 = 0 ALWAYS 0 on Step 1 because W2 = 0 delta1 = 0 * f'(0) = 0 0 regardless of what f'(0) is dL/dW1 = 0, dL/db1 = 0 hidden layer weights and biases do not move at allNotice two critical subtleties:
- ReLU's kink at zero is not the culprit. Even though ReLU is non-differentiable at
z = 0(frameworks typically setReLU'(0) = 0),dL/dhis already0before multiplying byf'(0)becauseW2 = 0. Even whenf'(0) = 1(Tanh and linear),0 * 1 = 0. - Mutual deadlock when
f(0) = 0(ReLU, Tanh, linear).W2cannot get a non-zero gradient untilhbecomes non-zero, andW1, b1(which produceh) cannot get a non-zero gradient untilW2becomes non-zero. Neither layer ever unlocks the other! Onlyb2updates, soy_hat = b2converges to the best constant predictor (for squared error, the mean ofy), wheredL/db2summed over the dataset also becomes0. That is a saddle point (a point where all gradients are zero even though it is not a true minimum), and gradient descent, momentum, and Adam (0 / (0 + eps) = 0) remain stuck there forever.
Let us verify with a concrete two-step numeric trace: input
x = (1, 2), targety = 1,m = 2hidden neurons,k = 1linear output, learning ratelr = 0.1, and lossL = 0.5 * (y_hat - y)^2.Case A — Tanh or ReLU (
f(0) = 0):Step 1: z1 = (0, 0), h = (0, 0), y_hat = 0, delta2 = 0 - 1 = -1 dL/dW2 = (-1)*(0, 0) = (0, 0), dL/db2 = -1, dL/dh = (0, 0), dL/dW1 = 0 Update: W1 = 0, b1 = 0, W2 = (0, 0), b2 = 0 - 0.1*(-1) = 0.1 Step 2: z1 = (0, 0), h = (0, 0), y_hat = 0.1, delta2 = 0.1 - 1 = -0.9 dL/dW2 = (0, 0), dL/db2 = -0.9, dL/dh = (0, 0), dL/dW1 = 0 Update: W1 = 0, b1 = 0, W2 = (0, 0), b2 = 0.1 - 0.1*(-0.9) = 0.19Case B — Sigmoid (
f(0) = 0.5,f'(0) = 0.5 * (1 - 0.5) = 0.25):Step 1: z1 = (0, 0), h = (0.5, 0.5), y_hat = 0, delta2 = -1 dL/dW2 = (-1)*(0.5, 0.5) = (-0.5, -0.5), dL/db2 = -1 dL/dh = (0, 0) -> dL/dW1 = 0, dL/db1 = 0 Update: W2 = (0.05, 0.05), b2 = 0.1, W1 and b1 stay all 0 Step 2: z1 = (0, 0), h = (0.5, 0.5) y_hat = 0.05*0.5 + 0.05*0.5 + 0.1 = 0.15, delta2 = 0.15 - 1 = -0.85 dL/dW2 = (-0.85)*(0.5, 0.5) = (-0.425, -0.425), dL/db2 = -0.85 dL/dh = W2^T * (-0.85) = (-0.0425, -0.0425) delta1 = (-0.0425, -0.0425) * 0.25 = (-0.010625, -0.010625) dL/dW1 = delta1 @ [1, 2] = [[-0.010625, -0.02125], [-0.010625, -0.02125]] Update: W1 = [[0.0010625, 0.002125], [0.0010625, 0.002125]], b1 = (0.0010625, 0.0010625) W2 = (0.0925, 0.0925), b2 = 0.185With Sigmoid,
W2wakes up on Step 1 andW1wakes up on Step 2 — yet Row 1 and Row 2 ofW1are identical, and Entry 1 and Entry 2 ofW2are identical!- ReLU's kink at zero is not the culprit. Even though ReLU is non-differentiable at
Why identical neurons stay identical forever (symmetry breaking)
Suppose two hidden neurons
jandnin the same layer have identical incoming weights (W1[j, :] = W1[n, :]), identical biases (b1_j = b1_n), and identical outgoing weights (W2[:, j] = W2[:, n]). This holds at Step 0 for any constant initialization (0,0.25,-0.1, etc.). Then for every inputx:1. Equal forward outputs: z1_j = z1_n => h_j = f(z1_j) = f(z1_n) = h_n 2. Equal W2 gradients: dL/dW2[:, j] = delta2 * h_j = delta2 * h_n = dL/dW2[:, n] 3. Equal backprop signals: (dL/dh)_j = W2[:, j]^T delta2 = W2[:, n]^T delta2 = (dL/dh)_n delta1_j = (dL/dh)_j * f'(z1_j) = delta1_n 4. Equal W1 & b1 gradients: dL/dW1[j, :] = delta1_j * x^T = delta1_n * x^T = dL/dW1[n, :] dL/db1_j = delta1_j = delta1_nSumming gradients over any mini-batch preserves equality. Applying
w_new = w - learning_rate * gradientsubtracts the exact same gradient from equal starting weights:W1_new[j, :] = W1[j, :] - lr * g = W1[n, :] - lr * g = W1_new[n, :] W2_new[:, j] = W2[:, j] - lr * q = W2[:, n] - lr * q = W2_new[:, n]By mathematical induction, all
mneurons in the hidden layer stay identical after every training step. Per-parameter optimizers like momentum and Adam do not break the tie either, because their running averages start at0and receive identical gradients at every step.Why this ruins learning: If every row of
W1equals the same vectorr^T, everyb1_jequalsc, and every column ofW2equalsu, then allmhidden units compute the same scalarf(r^T x + c), and the network output collapses to:y_hat = sum_{j=1..m} u * f(r^T x + c) + b2 = (m * u) * f(r^T x + c) + b2A hidden layer of
m = 1,024neurons has the expressive power of a single neuron (m = 1)! Symmetry breaking means initializing neurons with different weights so they produce different activations, receive different gradients, and diverge during training to detect complementary features (edges, curves, thresholds, or hyperplanes). Because deterministic gradient descent preserves symmetry, symmetry must be broken at initialization.Compare linear vs. non-linear activation functions
How constant initialization fails depends on both
f(0)and whetherfis linear or non-linear:Activation f(0) f'(0) All-zero init (W = 0, b = 0) Non-zero constant init (W = c != 0) ---------- ---- ----- ------------------------------------- ---------------------------------------- Linear (z) 0 1 Deadlocked at 0; only b2 learns Trains, but W2 @ W1 has rank <= 1 Tanh 0 1 Deadlocked at 0; only b2 learns Collapses to 1 effective neuron per layer ReLU 0 0* Deadlocked at 0; only b2 learns Width 1; if c*sum(x) < 0, all units die Sigmoid 0.5 0.25 W2 moves Step 1, W1 Step 2; symmetric Collapses to 1 effective neuron per layer*(
ReLU'(0) = 0by convention in standard frameworks.)- Linear activations (
f(z) = z): Stacking linear layers always produces a linear mapy_hat = (W2 @ W1) x + (W2 @ b1 + b2). With all-zero weights,W1 = 0andW2 = 0is still a saddle point wheredL/dW1 = 0anddL/dW2 = 0, so onlyb2learns. With a non-zero constantc,W2 @ W1 = m * u @ r^Thas matrix rank at most 1 (all rows are multiples ofr^T). Ifk = 1(single scalar output), a linear modelw^T x + bonly needs rank 1, so it can still fit a plane; ifk > 1(multi-class or multi-target output), allkoutputs are forced to be scalar multiples of one shared projectionr^T x. - Non-linear activations (ReLU, Tanh, Sigmoid): The whole reason to use a wide hidden layer is to combine multiple non-linear features in different directions. Collapsing
munits into1unit destroys universal approximation. For example, XOR on{0, 1}^2((0,0)->0,(0,1)->1,(1,0)->1,(1,1)->0) is not linearly separable: becausetanhis strictly increasing,a * tanh(r1*x1 + r2*x2 + c) + bgiving equal outputs on(0,0)and(1,1)forcesr1 + r2 = 0, and equal outputs on(0,1)and(1,0)then forcesr1 = r2 = 0(a constant!). Thus a constant-initialized Tanh network can never solve XOR regardless of how wide it is.
- Linear activations (
Fix it with variance-scaled random initialization (Xavier and He)
To break symmetry, draw every weight independently from a zero-mean random distribution (biases
b1, b2can safely stay initialized to0, because distinct weight rows inW1and columns inW2already give every neuron distinct activations and gradients).Randomness alone is not enough — the scale (variance) of the random weights also matters. For one neuron summing
n_inindependent zero-mean weightsw_iof variancesigma^2against uncorrelated inputsh_iwith mean squareE[h^2]:z = sum_{i=1..n_in} w_i * h_i => Var(z) = n_in * sigma^2 * E[h^2]If
n_in * sigma^2is much smaller than1, activations and gradients shrink exponentially across layers; if much larger than1, they explode or saturate Tanh/Sigmoid into flat tails wheref'(z) ≈ 0:- Xavier / Glorot initialization (for Tanh, Sigmoid, or linear layers): Near
z = 0,tanh(z) ≈ zhas slope1, soE[h^2] ≈ Var(z_prev). Preserving forward activation variance requiressigma^2 = 1 / n_in; preserving backward gradient variance requiressigma^2 = 1 / n_out(wheren_outis the layer's output width). Xavier averages the two rates:- Normal form:
w ~ Normal(0, 2 / (n_in + n_out)) - Uniform form:
w ~ Uniform(-a, a)witha = sqrt(6 / (n_in + n_out))(sinceUniform(-a, a)has variancea^2 / 3).
- Normal form:
- He / Kaiming initialization (for ReLU and Leaky ReLU): ReLU zeroes out the negative half of a symmetric zero-mean distribution, cutting the mean square in half:
E[ReLU(z)^2] = 0.5 * Var(z). To keepVar(z)constant from layer to layer, He doubles the weight variance:- Normal form:
w ~ Normal(0, 2 / n_in)(standard deviationsqrt(2 / n_in)).
- Normal form:
For a
256 -> 256hidden layer, Xavier uses standard deviationsqrt(2 / 512) = 0.0625, while He usessqrt(2 / 256) ≈ 0.0884.- Xavier / Glorot initialization (for Tanh, Sigmoid, or linear layers): Near
Verify all three behaviors on XOR in NumPy
We can confirm all three behaviors directly in NumPy by training a two-layer Tanh network with
m = 4hidden neurons on XOR usingw = w - lr * gradient:import numpy as np X = np.array([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]) y = np.array([0.0, 1.0, 1.0, 0.0]) # XOR targets def train_xor(W1, w2, steps=5000, lr=0.5): """Train a 2-layer tanh network with linear output; loss = mean of 0.5 * (y_hat - y)^2.""" b1 = np.zeros(W1.shape[0]) b2 = 0.0 for _ in range(steps): hidden = np.tanh(X @ W1.T + b1) # forward hidden activations, shape (4, m) y_hat = hidden @ w2 + b2 # forward predictions, shape (4,) delta2 = (y_hat - y) / len(y) # dL/dy_hat averaged over batch delta1 = np.outer(delta2, w2) * (1 - hidden ** 2) # dL/dz1 using tanh'(z) = 1 - tanh(z)^2 W1 = W1 - lr * (delta1.T @ X) b1 = b1 - lr * delta1.sum(axis=0) w2 = w2 - lr * (hidden.T @ delta2) b2 = b2 - lr * delta2.sum() final_pred = np.tanh(X @ W1.T + b1) @ w2 + b2 loss = 0.5 * np.mean((final_pred - y) ** 2) return loss, W1 m = 4 loss_zero, W1_zero = train_xor(np.zeros((m, 2)), np.zeros(m)) print("All zeros: loss =", round(loss_zero, 4), "| W1 stayed 0:", np.allclose(W1_zero, 0)) loss_const, W1_const = train_xor(np.full((m, 2), 0.25), np.full(m, 0.25)) print("All 0.25: loss =", round(loss_const, 4), "| rows identical:", np.allclose(W1_const, W1_const[0])) rng = np.random.default_rng(0) a1, a2 = np.sqrt(6 / (2 + m)), np.sqrt(6 / (m + 1)) loss_xavier, W1_xavier = train_xor(rng.uniform(-a1, a1, (m, 2)), rng.uniform(-a2, a2, m)) print("Xavier init: loss =", round(loss_xavier, 4), "| rows identical:", np.allclose(W1_xavier, W1_xavier[0]))Running this script prints:
All zeros: loss = 0.125 | W1 stayed 0: True All 0.25: loss = 0.085 | rows identical: True Xavier init: loss = 0.0 | rows identical: FalseAll-zero initialization never moves
W1and predicts the constant mean0.5(0.5 * (0.5)^2 = 0.125). Constant0.25movesW1but keeps all 4 hidden neurons identical, getting stuck at0.085. Xavier initialization breaks symmetry so the 4 neurons specialize and fit XOR down to0.0loss.
Intuition & how it works
Imagine hiring a team of ten detectives to investigate a complex case, but giving every detective the exact same rulebook, feeding them the exact same clues, and sending all ten the exact same feedback memo every evening. Because they start identical and receive identical updates, all ten detectives stay carbon copies of one another forever — you pay for ten detectives and get the brainpower of one. Worse still, if every detective starts with a disconnected phone line to the chief (W2 = 0) and reports "nothing" (f(0) = 0), the chief receives nothing from them and sends zero feedback back down the line, so only the chief's default hunch (b2) ever changes.
Initializing every weight to 0 (or any constant c) feels clean and works fine in single-layer linear or logistic regression, which is why people accidentally try it in neural networks. In a multi-layer network, however, zero weights with zero-centered activations (f(0) = 0) trap the layers in a mutual zero-gradient deadlock, and any constant weight initialization fails to break symmetry between hidden neurons in the same layer. As a result, gradient descent updates every neuron in lockstep, collapsing a wide hidden layer into a single effective neuron.
Walk through a tiny network with input x = (1, 2), target y = 1, m = 2 hidden units, linear output y_hat = W2 h + b2, squared loss 0.5 * (y_hat - y)^2, and learning rate 0.1:
1. All-zero weights with ReLU or Tanh (f(0) = 0): On Step 1, both hidden units output h = (0, 0) and y_hat = 0 (error delta2 = -1). Output weight gradient dL/dW2 = delta2 * h = (0, 0) because h = 0, and hidden gradient dL/dh = W2^T * delta2 = (0, 0) because W2 = 0. Only b2 updates (0 -> 0.1 -> 0.19 -> ...), while W1, b1, and W2 stay 0 forever.
2. All-zero weights with Sigmoid (f(0) = 0.5): On Step 1, h = (0.5, 0.5) gives dL/dW2 = (-0.5, -0.5), moving W2 to (0.05, 0.05) while W1 stays 0. On Step 2, W2 is now non-zero, so error flows back and updates W1 — to two identical rows [[0.0010625, 0.002125], [0.0010625, 0.002125]]. Both hidden units remain clones forever.
3. Random Xavier weights: Neuron 1 and Neuron 2 start with different random weights, produce different activations h_1 != h_2, receive different backpropagated signals W2[1] * delta2 != W2[2] * delta2, and diverge to learn complementary features.
Key points
- Forward pass collapse: A pre-activation is the weighted sum
z = W x + bentering a neuron, and an activation functionf(z)is the non-linear curve applied toz. WhenW1 = 0, b1 = 0, W2 = 0, b2 = 0, every hidden neuron receivesz1_j = 0, outputs the same constanth_j = f(0), and producesy_hat = 0for every inputx. - Backpropagation deadlock (
f(0) = 0): Backpropagation is the chain-rule algorithm that propagates the loss derivative backward from the output to earlier layers. BecausedL/dW2 = delta2 * h^TanddL/dh = W2^T * delta2, having bothh = 0(ReLU, Tanh, linear) andW2 = 0makes every weight gradient zero at a saddle point (a flat spot in loss space where all derivatives are zero despite not being a minimum), leaving only the output biasb2able to learn. - Non-zero
f(0)still traps symmetry: For Sigmoid (f(0) = 0.5),W2updates on Step 1 andW1updates on Step 2 (and one layer deeper per step in deeper networks), but every neuron in a layer gets the exact same gradient. - Symmetry preservation by induction: If two neurons in a layer have equal incoming weights, biases, and outgoing weights, they compute equal forward activations and equal backward gradients, so
w = w - learning_rate * gradientkeeps them equal at every future step. A layer of widthmcollapses to width1:y_hat = (m * u) * f(r^T x + c) + b2. - Symmetry breaking: Symmetry breaking means initializing neurons with distinct (independent random) weights so they receive distinct gradients and specialize into different feature detectors; biases can safely start at
0. - Linear vs. non-linear impact: With linear activations (
f(z) = z), zero init still deadlocks all weights at0, while constantc != 0restricts the productW2 @ W1to rank at most 1 (its rows are all multiples of one vector, which bottlenecks multi-outputk > 1models). With non-linear activations, collapsingmneurons into1prevents learning non-linearly separable functions like XOR. - Variance-scaled random initialization: Xavier (Glorot) initialization (
Var(w) = 2 / (n_in + n_out)) keeps signal variance stable across Tanh, Sigmoid, and linear layers, while He (Kaiming) initialization (Var(w) = 2 / n_in) doubles the variance to compensate for ReLU zeroing out negative inputs.
Common mistakes
- Claiming "all weight gradients are always zero" for every activation: With Sigmoid,
f(0) = 0.5 != 0, sodL/dW2 = delta2 * 0.5is non-zero on Step 1 anddL/dW1becomes non-zero on Step 2. The universal failure across all activations is identical gradients across neurons (broken expressive capacity), with total weight freeze occurring specifically whenf(0) = 0. - Thinking only
0fails and0.01or0.25works: Any constantc != 0gives every hidden unit identical incoming and outgoing weights, so allmunits still update in lockstep as a single neuron forever. - Blaming ReLU's undefined derivative at
z = 0: Even if you defineReLU'(0) = 1(or use Tanh wheretanh'(0) = 1), the hidden error signalW2^T @ delta2is already0becauseW2 = 0. - Expecting Adam, momentum, or floating-point rounding to rescue training: Momentum and Adam initialize per-parameter buffers to
0and feed them identical gradients, keeping units identical. Deterministic matrix-multiply kernels run identical arithmetic across rows, and even non-deterministic GPU reductions only introduce tiny1e-7rounding noise rather than healthy feature diversity. - Using unscaled
Normal(0, 1)random weights: In a layer withn_in = 1,000unit-variance inputs,Normal(0, 1)weights produce pre-activations with standard deviationsqrt(1000) ≈ 31.6, immediately pushing Tanh and Sigmoid into saturation (flat regions where|z|is large andf'(z) ≈ 0, stalling learning).
Follow-up questions
- Does initializing every weight to a non-zero constant like 0.25 avoid the learning failure? Gradients are no longer zero, so weights do move, but the symmetry-by-induction proof still holds: every neuron in a hidden layer starts with identical incoming and outgoing weights, computes the same activation, and receives the exact same gradient update, collapsing each width-
mlayer into 1 effective neuron. For instance, withx = (1, 2),W1 = W2 = 0.25,b1 = b2 = 0, Tanh hidden units, and targety = 1, both hidden units computez1 = 0.75and both rows ofW1get the exact same gradient[-0.10178, -0.20356]. Worse, for wide inputs (dlarge),z = 0.25 * sum(x)grows large enough to saturate Tanh/Sigmoid (f'(z) ≈ 0) or, if negative on every sample, kill all ReLU neurons simultaneously ("dead ReLUs"). - Why do ReLU networks pair best with He initialization whereas Tanh networks favor Xavier initialization? Each initialization chooses
Var(w)so thatVar(z) = n_in * Var(w) * E[h^2]stays near1from layer to layer, which depends on how much the activation shrinksE[h^2]. Tanh and linear activations are symmetric around0with unit slope near the origin, soE[h^2] ≈ Var(z_prev)and Xavier'sVar(w) = 2 / (n_in + n_out)keeps forward and backward variance balanced. ReLU sets all negative values to0, halving the second moment (E[ReLU(z)^2] = 0.5 * Var(z_prev)), so He initialization doubles the variance toVar(w) = 2 / n_in; using Xavier on a deep ReLU network halves signal energy every layer (0.5^L), while using He on Tanh inflates activations toward saturation. - How does poor weight scaling cause vanishing or exploding signals as network depth grows? Across
Llayers, both forward activations and backpropagated gradients multiply one per-layer scaling factorrtogetherLtimes (r^L), turning a small mismatch into exponential decay (vanishing gradients, where early layers stop updating) or exponential blow-up (exploding gradients, where updates overflow toNaN). In a 50-layer width-256 ReLU network, each layer multiplies mean-square activation energy by256 * sigma^2 / 2: withsigma = 0.05(r = 0.32), root-mean-square activation shrinks to0.32^25 ≈ 4e-13, whereas withsigma = 0.10(r = 1.28), it explodes to1.28^25 ≈ 479, while He initialization (sigma = sqrt(2/256) ≈ 0.0884,r = 1) keeps it near1. Architectural tools like Batch Normalization / Layer Normalization (rescaling layer activations to zero mean and unit variance) and residual connections (x + F(x)skip paths that pass gradients straight through with slope1) greatly stabilize deep training, though random initialization is still required to break symmetry.
Follow-up questions
- Does initializing every weight to a non-zero constant like 0.25 avoid the learning failure?
- Why do ReLU networks pair best with He initialization whereas Tanh networks favor Xavier initialization?
- How does poor weight scaling cause vanishing or exploding signals as network depth grows?
Similar questions
- KV Cache Sizing and Prefill-Decode Disaggregation for LLM Inference
- Diagnosing Periodic GPU Utilization Drops in Distributed Training
- Low-Latency Tree Ensemble Inference
- Select Score Cutoff for Target Precision
- Payment Fraud Detection Under Class Imbalance and Drift
- Diagnosing and Fixing Overfitting in Supervised Learning