Pre-Norm and Post-Norm: Reposition is re-function
In the debris structure, Pre-Norm is often written as y = x+F(LN(x), and Post-Norm is written as y = LN(x+F(x).
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Write the order of calculation of the two types of debris
- Compare unicoded positions with small vectors
Suggested first
- Vector and Matrix Operations
- Counts and chain rules
The same components are arranged differently, not just code style changes
In the debris structure, Pre-Norm is often written as y = x+F(LN(x), and Post-Norm is written as y = LN(x+F(x). Both include the unipolation, main branch and additions, but the sequence determines the function and gradient path. The list of modules cannot be changed to a single order, assuming that the same weight can be loaded directly to the same model.
A minimal example highlights ordering. Input x=[1,3], branch F always returns [1,1], and LN ignores ε with identity affine parameters. Pre-Norm gives [2,4]. Post-Norm first obtains [2,4], then centers/scales to [−1,1]. Identical inputs, components and parameters already produce different outputs.
This constant branch is a teaching tool and does not represent a real level of attention. It helps to normalize isolation for the remnants and effects. Real F depends on input, which also changes the input distribution seen in F; The latter changes the statistics for the overall output of the disability. If the model is added to the end of the network and eventually normalized, it must also be counted in the complete structure.
Gradient analysis is also conducted by path. Pre-Norm has a direct x bypass, but the main branch gradient also passes through LN in a comparative manner; All Post-Norm output passes through the end LN and cannot be simply described as one plus main branch. This difference interacts with initialization, preheat and depth of learning, rather than being an isolated almighty option.
The paper studied the size of the unicoded position and gradient under a clear Transformer setting, and did not allow for all tasks Pre-Norm to be rolled out without preheating or always optimal. The comparison experiment should fix data, parameters, training budgets and other structures, and document learning rate plans; A single stabilization does not amount to an eventual higher quality.
Normalization also affects paths such as whether or not the bypass road remains direct and constant. When the weight of the transplant is the same as the parameter shape, the order of exchange changes the function and is not compatible with no error report merely by loading it. The small vector calculation can be reviewed directly by the mean variance. It is recommended that the configuration be drawn in whole blocks instead of just checking a few similar categories.
For the check weight conversion, a non-average symmetric input should be fixed and the random layer temporarily closed. If only zero vectors or constant features are used, reclassification may crush differences and make errors appear consistent in the tests.
This example, why is there no zero mean value for Pre-Norm output?
Normalization takes place in the main branch input, the residue is added to the difference and no more LN, so the output [2,4] is equal to 3.
Does it guarantee that the overall gradient doesn't fall?
Without assurances, branches may be offset and the gradient may be changed at the subsequent level and at the end of the target; There is still a need to look at the full range of aberrations.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.