LLaMA (Touvron et al., 2023) replaces LayerNorm with RMSNorm, a simpler normalization that rescales by the root mean square without subtracting the mean. It is cheaper and performs about as well.
Implement rmsnorm(x, g, eps), dividing each row by its root mean square and multiplying by the gain g.
Compute the mean of squares over the last axis, take the square root with eps, divide, then multiply by g.
No results yet
Run your code to check it against the examples, or submit to run every test.