Read the equation
This expression averages squared components along the final feature axis and preserves that axis for broadcasting. It computes the second raw moment, not centered variance: the mean is not subtracted. That distinction is intentional for RMS normalization.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| hidden_states | Input feature vectors |
| variance | Locally named mean square |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
def forward(self, hidden_states):
input_dtype = hidden_states.dtype
hidden_states = hidden_states.to(torch.float32)
variance = hidden_states.pow(2).mean(-1, keepdim=True)
hidden_states = hidden_states * torch.rsqrt(variance +
self.variance_epsilon)
return self.weight * hidden_states.to(input_dtype)Exact original notation
variance = hidden_states.pow(2).mean(-1, keepdim=True)
Related builds
Sources & provenance
variance = hidden_states.pow(2).mean(-1, keepdim=True)
variance = hidden_states.pow(2).mean(-1, keepdim=True)
variance = hidden_states.pow(2).mean(-1, keepdim=True)
variance = hidden_states.pow(2).mean(-1, keepdim=True)