Weight Initialization & Learning Rate Tips

Deep Learning with Keras and TensorFlow 8 min min read Updated: Nov 16, 2026 Intermediate
Weight Initialization & Learning Rate Tips
Intermediate Topic 3 of 8

Why Do Starting Weights Matter?

Weights begin as random numbers. If they are too big, the signals explode as they move through the layers. If they are too small, the signals vanish. Both stop the network from learning. A good initializer chooses random values with a scale that suits the layer.

Common Initializers

InitializerBest withNotes
glorot_uniformSigmoid, tanh, softmaxKeras default for Dense layers
he_normal / he_uniformReLU and variantsRecommended for ReLU networks
random_normalExperimentsYou choose the standard deviation
zerosBiasesNever use zeros for all weights
python from keras import layers, initializers layers.Dense(128, activation="relu", kernel_initializer="he_normal") layers.Dense( 128, activation="relu", kernel_initializer=initializers.RandomNormal(stddev=0.05), bias_initializer="zeros" )

Vanishing and Exploding Gradients

  • Vanishing gradient: gradients become tiny in early layers, so those layers barely learn. Common with sigmoid and tanh in deep networks
  • Exploding gradient: gradients become huge and the loss turns into NaN

Ways to fix them: use ReLU, use He initialization, add batch normalization, use residual connections and clip gradients.

python opt = keras.optimizers.Adam(learning_rate=0.001, clipnorm=1.0) # gradient clipping

Finding a Good Learning Rate

  1. Start with 0.001 for Adam and 0.01 for SGD.
  2. If the loss does not move, try 10 times bigger.
  3. If the loss jumps or becomes NaN, try 10 times smaller.
  4. Use a schedule or ReduceLROnPlateau to lower it during training.
python for lr in [0.1, 0.01, 0.001, 0.0001]: model = build_model() model.compile(optimizer=keras.optimizers.Adam(lr), loss="sparse_categorical_crossentropy", metrics=["accuracy"]) h = model.fit(x_train, y_train, epochs=3, validation_split=0.1, verbose=0) print(lr, round(h.history["val_accuracy"][-1], 4))
Reproducible results: Set seeds to get similar results every run: keras.utils.set_random_seed(42).

Conclusion

Good initialization and a sensible learning rate are two cheap ways to make training smoother. Use He initialization with ReLU and try a few learning rates.

Quick Summary: Glorot for sigmoid or tanh, He for ReLU. Tune the learning rate by trying values that differ by a factor of 10.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators