LayerNorm and RMSNorm
Implement forward and backward passes for two Transformer normalization layers. A free ML coding interview task on NudgeCode: write it in Python and check it with tests in your browser. Hard · Normalization, LayerNorm, RMSNorm.
Implement forward/backward for LayerNorm and RMSNorm over the last dimension, with arbitrary leading dimensions. Return (y, dx, dw, db) and (y, dx, dw); do not use autograd. LayerNorm uses population variance; RMSNorm has no mean subtraction or bias.