LLaMA-style norm, simpler than LayerNorm
Medium FundamentalsImplement Root Mean Square Layer Normalization โ the normalization used in LLaMA, Gemma, etc.
• Do NOT use any built-in norm layers
• Normalize over dim=-1
• Must support autograd
Implement the function below. Use only basic PyTorch operations.
Use this code to debug before submitting.
Try solving it yourself first! Click below to reveal the solution.
For interactive practice with auto-grading, run TorchCode locally:pip install torch-judge then use check("rmsnorm")
LLaMA-style norm, simpler than LayerNorm