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:

  1. 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.
  2. Define symmetry breaking and show why identically initialized hidden units can never diverge under deterministic gradient updates.
  3. Contrast how this initialization bug behaves across linear activations versus non-linear activations (ReLU, Tanh, and Sigmoid).
  4. 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 * gradient that identically initialized hidden units remain clones forever, collapsing an m-unit hidden layer to effective width 1.
  • Compare rank-1 collapse in linear networks against lost non-linear capacity (such as inability to fit XOR) across ReLU, Tanh, and Sigmoid.
  • Justify fan-in / fan-out variance scaling (Xavier vs He) so activations and gradients neither vanish nor saturate.

Step-by-step walkthrough

  1. 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 x with d features passes through one hidden layer of m neurons and produces an output vector y_hat of size k (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_hat from the input x step by step from left to right.
    • Pre-activation (z1): the weighted sum W1 x + b1 entering each hidden neuron before the non-linearity, with shape (m,), where W1 has shape (m, d) and b1 has 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 turns z1 into hidden activations h = f(z1) of shape (m,).
    • Loss (L): a single number measuring how wrong y_hat is compared to the true target y, such as squared error L = 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/dw telling us how nudging w changes the loss).

    Let delta2 = dL/dy_hat be the output error signal (for squared error 0.5 * ||y_hat - y||^2, delta2 = y_hat - y; if the output layer also wraps z2 = W2 h + b2 in an output activation g, define delta2 = dL/dz2 and 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_j
    

    For a single output (k = 1), the gradient for a single hidden weight W1[j, l] (connecting input l to hidden neuron j) 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        value
    

    Gradient 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 neuron j is multiplied by the outgoing weights above it (W2[:, j]).

  2. 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, and b2 = 0. For any input vector x:

    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 x
    

    Depending on f, f(0) is either 0 (for ReLU, Tanh, and linear/identity) or non-zero (0.5 for Sigmoid). Either way, the forward pass already exhibits two failures:

    • The prediction completely ignores x. Every training example produces y_hat = 0.
    • Every hidden neuron is an identical clone. Neuron 1 through neuron m compute the exact same pre-activation 0 and the exact same activation f(0).
  3. Trace backpropagation and a two-step numeric example

    Substitute W1 = 0, b1 = 0, W2 = 0, b2 = 0, and h_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 all
    

    Notice two critical subtleties:

    • ReLU's kink at zero is not the culprit. Even though ReLU is non-differentiable at z = 0 (frameworks typically set ReLU'(0) = 0), dL/dh is already 0 before multiplying by f'(0) because W2 = 0. Even when f'(0) = 1 (Tanh and linear), 0 * 1 = 0.
    • Mutual deadlock when f(0) = 0 (ReLU, Tanh, linear). W2 cannot get a non-zero gradient until h becomes non-zero, and W1, b1 (which produce h) cannot get a non-zero gradient until W2 becomes non-zero. Neither layer ever unlocks the other! Only b2 updates, so y_hat = b2 converges to the best constant predictor (for squared error, the mean of y), where dL/db2 summed over the dataset also becomes 0. 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), target y = 1, m = 2 hidden neurons, k = 1 linear output, learning rate lr = 0.1, and loss L = 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.19
    

    Case 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.185
    

    With Sigmoid, W2 wakes up on Step 1 and W1 wakes up on Step 2 — yet Row 1 and Row 2 of W1 are identical, and Entry 1 and Entry 2 of W2 are identical!

  4. Why identical neurons stay identical forever (symmetry breaking)

    Suppose two hidden neurons j and n in 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 input x:

    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_n
    

    Summing gradients over any mini-batch preserves equality. Applying w_new = w - learning_rate * gradient subtracts 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 m neurons 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 at 0 and receive identical gradients at every step.

    Why this ruins learning: If every row of W1 equals the same vector r^T, every b1_j equals c, and every column of W2 equals u, then all m hidden units compute the same scalar f(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) + b2
    

    A hidden layer of m = 1,024 neurons 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.

  5. Compare linear vs. non-linear activation functions

    How constant initialization fails depends on both f(0) and whether f is 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) = 0 by convention in standard frameworks.)

    • Linear activations (f(z) = z): Stacking linear layers always produces a linear map y_hat = (W2 @ W1) x + (W2 @ b1 + b2). With all-zero weights, W1 = 0 and W2 = 0 is still a saddle point where dL/dW1 = 0 and dL/dW2 = 0, so only b2 learns. With a non-zero constant c, W2 @ W1 = m * u @ r^T has matrix rank at most 1 (all rows are multiples of r^T). If k = 1 (single scalar output), a linear model w^T x + b only needs rank 1, so it can still fit a plane; if k > 1 (multi-class or multi-target output), all k outputs are forced to be scalar multiples of one shared projection r^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 m units into 1 unit 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: because tanh is strictly increasing, a * tanh(r1*x1 + r2*x2 + c) + b giving equal outputs on (0,0) and (1,1) forces r1 + r2 = 0, and equal outputs on (0,1) and (1,0) then forces r1 = r2 = 0 (a constant!). Thus a constant-initialized Tanh network can never solve XOR regardless of how wide it is.
  6. 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, b2 can safely stay initialized to 0, because distinct weight rows in W1 and columns in W2 already 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_in independent zero-mean weights w_i of variance sigma^2 against uncorrelated inputs h_i with mean square E[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^2 is much smaller than 1, activations and gradients shrink exponentially across layers; if much larger than 1, they explode or saturate Tanh/Sigmoid into flat tails where f'(z) ≈ 0:

    • Xavier / Glorot initialization (for Tanh, Sigmoid, or linear layers): Near z = 0, tanh(z) ≈ z has slope 1, so E[h^2] ≈ Var(z_prev). Preserving forward activation variance requires sigma^2 = 1 / n_in; preserving backward gradient variance requires sigma^2 = 1 / n_out (where n_out is 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) with a = sqrt(6 / (n_in + n_out)) (since Uniform(-a, a) has variance a^2 / 3).
    • 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 keep Var(z) constant from layer to layer, He doubles the weight variance:
      • Normal form: w ~ Normal(0, 2 / n_in) (standard deviation sqrt(2 / n_in)).

    For a 256 -> 256 hidden layer, Xavier uses standard deviation sqrt(2 / 512) = 0.0625, while He uses sqrt(2 / 256) ≈ 0.0884.

  7. 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 = 4 hidden neurons on XOR using w = 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: False
    

    All-zero initialization never moves W1 and predicts the constant mean 0.5 (0.5 * (0.5)^2 = 0.125). Constant 0.25 moves W1 but keeps all 4 hidden neurons identical, getting stuck at 0.085. Xavier initialization breaks symmetry so the 4 neurons specialize and fit XOR down to 0.0 loss.

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 + b entering a neuron, and an activation function f(z) is the non-linear curve applied to z. When W1 = 0, b1 = 0, W2 = 0, b2 = 0, every hidden neuron receives z1_j = 0, outputs the same constant h_j = f(0), and produces y_hat = 0 for every input x.
  • Backpropagation deadlock (f(0) = 0): Backpropagation is the chain-rule algorithm that propagates the loss derivative backward from the output to earlier layers. Because dL/dW2 = delta2 * h^T and dL/dh = W2^T * delta2, having both h = 0 (ReLU, Tanh, linear) and W2 = 0 makes 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 bias b2 able to learn.
  • Non-zero f(0) still traps symmetry: For Sigmoid (f(0) = 0.5), W2 updates on Step 1 and W1 updates 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 * gradient keeps them equal at every future step. A layer of width m collapses to width 1: 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 at 0, while constant c != 0 restricts the product W2 @ W1 to rank at most 1 (its rows are all multiples of one vector, which bottlenecks multi-output k > 1 models). With non-linear activations, collapsing m neurons into 1 prevents 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, so dL/dW2 = delta2 * 0.5 is non-zero on Step 1 and dL/dW1 becomes 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 when f(0) = 0.
  • Thinking only 0 fails and 0.01 or 0.25 works: Any constant c != 0 gives every hidden unit identical incoming and outgoing weights, so all m units still update in lockstep as a single neuron forever.
  • Blaming ReLU's undefined derivative at z = 0: Even if you define ReLU'(0) = 1 (or use Tanh where tanh'(0) = 1), the hidden error signal W2^T @ delta2 is already 0 because W2 = 0.
  • Expecting Adam, momentum, or floating-point rounding to rescue training: Momentum and Adam initialize per-parameter buffers to 0 and feed them identical gradients, keeping units identical. Deterministic matrix-multiply kernels run identical arithmetic across rows, and even non-deterministic GPU reductions only introduce tiny 1e-7 rounding noise rather than healthy feature diversity.
  • Using unscaled Normal(0, 1) random weights: In a layer with n_in = 1,000 unit-variance inputs, Normal(0, 1) weights produce pre-activations with standard deviation sqrt(1000) ≈ 31.6, immediately pushing Tanh and Sigmoid into saturation (flat regions where |z| is large and f'(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-m layer into 1 effective neuron. For instance, with x = (1, 2), W1 = W2 = 0.25, b1 = b2 = 0, Tanh hidden units, and target y = 1, both hidden units compute z1 = 0.75 and both rows of W1 get the exact same gradient [-0.10178, -0.20356]. Worse, for wide inputs (d large), 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 that Var(z) = n_in * Var(w) * E[h^2] stays near 1 from layer to layer, which depends on how much the activation shrinks E[h^2]. Tanh and linear activations are symmetric around 0 with unit slope near the origin, so E[h^2] ≈ Var(z_prev) and Xavier's Var(w) = 2 / (n_in + n_out) keeps forward and backward variance balanced. ReLU sets all negative values to 0, halving the second moment (E[ReLU(z)^2] = 0.5 * Var(z_prev)), so He initialization doubles the variance to Var(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 L layers, both forward activations and backpropagated gradients multiply one per-layer scaling factor r together L times (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 to NaN). In a 50-layer width-256 ReLU network, each layer multiplies mean-square activation energy by 256 * sigma^2 / 2: with sigma = 0.05 (r = 0.32), root-mean-square activation shrinks to 0.32^25 ≈ 4e-13, whereas with sigma = 0.10 (r = 1.28), it explodes to 1.28^25 ≈ 479, while He initialization (sigma = sqrt(2/256) ≈ 0.0884, r = 1) keeps it near 1. 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 slope 1) greatly stabilize deep training, though random initialization is still required to break symmetry.

Follow-up questions

Similar questions

More Tower interview questions

All 3 Tower questions →