RMS Normalization

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2024 Mar 1 14:13
Editor
Edited
Edited
2025 May 30 22:3
Refs
Refs

LLaMa
,
Gemma

class RMSNorm(torch.nn.Module): def __init__(self, dim: int, eps: float = 1e-6): super().__init__() self.eps = eps self.weight = nn.Parameter(torch.ones(dim)) def _norm(self, x): return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps) def forward(self, x): output = self._norm(x.float()).type_as(x) return output * self.weight
notion image
 
 
dl.acm.org
 
 

Backlinks

Dia

Recommendations