Weight Initialization
How to set weights before training: Xavier, He, orthogonal initialization, and more.
Data-dependent InitializationData-dependent initialization passes a small number of training images through the network before training and corrects the weights and biases using the measured statistics. By equalizing the output channels of each layer and the learning speed of every layer, it produces initial values that train well regardless of layer type, even without normalization layers.
FixupFixup is an initialization method that sets the last layer of each residual branch to 0 and initializes the other layers smaller according to depth, so that deep residual networks can be trained stably without normalization layers such as batch normalization. Even a 10,000-layer residual network trained with the same learning rate as with normalization.
GradInitGradInit sets the scale of initial values by multiplying each block of randomly initialized weights by a factor and briefly learning those factors so that the loss after one update step with the training optimizer is as small as possible. It can be used without deriving a formula for each architecture, and it trained a 1,202-layer ResNet as well as a Post-LN Transformer without warmup.
He (Kaiming) InitializationHe initialization draws weights from a distribution with variance 2/n so that, in networks using ReLU, the magnitude (variance) of the signal is preserved as layers are stacked.
LeCun InitializationLeCun initialization draws weights from a distribution with standard deviation 1/√(number of inputs) and, combined with normalized inputs and the recommended sigmoid, keeps the output of each unit on the order of 1. Training can start in the range where the activation function does not saturate.
LSUVLSUV is an initialization method that, after initializing the weights with orthogonal matrices, passes real data through the network and divides the weights layer by layer from the input side so that each layer's output variance is 1. Without deriving formulas for each activation function or layer type, it makes very deep, thin networks trainable in a single training run.
MetaInitMetaInit is an initialization method that tunes the size of each layer's weight matrix by gradient descent to minimize the "gradient quotient", which measures how much the gradient changes after one update step. It is determined from random data without training data, and produces initial values that train well even for deep networks without normalization layers, regardless of architecture or activation function.
Mimetic InitializationMimetic initialization builds the self-attention weights of a Transformer from random numbers and the identity with formulas, so that the query–key product is close to the identity matrix and the value–output projection product is close to the negative identity matrix. Imitating the structure of pre-trained ViT weights, it raised accuracy by up to over 5% on CIFAR-10 when training ViT from scratch on small image datasets without pre-training.
Orthogonal InitializationOrthogonal initialization initializes each layer's weights with a random orthogonal matrix so that signals are transmitted with the same factor in every direction. It has been shown that in deep linear networks, training time barely increases as layers are added.
ReZeroReZero multiplies the transformation of each layer with a residual connection by a learnable scalar initialized to 0, so that the whole network is the identity map at the start of training. In the Transformer, it trained up to 128 layers without layer normalization or learning rate warmup, and a 12-layer model converged 56% faster than the original Transformer.
SkipInitSkipInit multiplies the end of the branch of each residual block in a residual network by a single learnable scalar initialized to 0. With a one-line change it reproduces how batch normalization brings early residual blocks close to the identity map, and it can train a 1,000-layer residual network without normalization layers.
T-FixupT-Fixup is an initialization method that makes Transformers trainable without layer normalization or learning rate warmup by initializing the attention value and output projections, the MLP weights, and the input embeddings smaller according to the number of layers. Encoder and decoder could each be made as deep as 200 layers, and machine translation BLEU also exceeded the original Transformer.
Xavier (Glorot) InitializationXavier initialization sets the weight variance to 2/(number of inputs + number of outputs) so that the magnitudes of forward activations and backward gradients change little as layers are stacked. It speeds up training of deep networks that use Tanh and similar functions.
