We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Normalization step 4 of 6
Easy
Research
RMSNorm
Implement RMSNorm from “Root Mean Square Layer Normalization” (Zhang & Sennrich, 2019).
RMSNorm is a simpler alternative to LayerNorm used in LLaMA, Gemma, and other modern LLMs. It normalizes by the root mean square without centering:
$$\text{RMSNorm}(x) = \frac{x}{\text{RMS}(x) + \epsilon} \cdot \gamma$$
where $\text{RMS}(x) = \sqrt{\frac{1}{d} \sum_{i=1}^{d} x_i^2}$
Input:
-
x: shape(batch, d) -
gamma: shape(d,)— learnable scale parameter -
eps: float, small constant (default 1e-6)
Output: Tensor of shape (batch, d).
Loading visualization…
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.