Variance-Preserving Weight Initialization
Track signal scale through a random linear layer and derive why a weight variance should depend on the number of incoming features.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Independent centered terms add their second moments
For \(z=\sum_{i=1}^n w_i x_i\), assume independent centered weights with common variance \(\sigma_w^2\), independent of inputs with common second moment \(q\). Then \(\mathbb E[z^2]=n\sigma_w^2q\), because the cross terms vanish. Choosing \(\sigma_w^2\) on the order of \(1/n\) keeps the preactivation scale similar as the input width changes.
A nonlinearity changes the next layer’s input scale
For a symmetric preactivation distribution, ReLU preserves half the second moment, since one side is replaced by zero. A variance choice around \(2/n\) compensates under that simplified forward model. Actual gradients, dependencies and different input and output widths can change the design. Residual connections provide a separate path across deep networks. Gradient clipping limits unusually large updates after gradients are computed.[1]