You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RMSNorm implementation in this codebase in wrong as it computes the RMS over the (T, D) dimensions instead of the (D) dimension. Assume input x is of shape (B, T, D).
The current code does this:
# x is (B, T, D).ff_rms=torch.linalg.norm(x, dim=(1,2)) *x[0].numel() **-.5# (B,).raw=x/ff_rms.unsqueeze(-1).unsqueeze(-1) # (B, 1, 1).
The RMSNorm implementation in this codebase in wrong as it computes the RMS over the
(T, D)
dimensions instead of the(D)
dimension. Assume input x is of shape(B, T, D)
.The current code does this:
The original RMSNorm is here - https://github.com/meta-llama/llama/blob/main/llama/model.py#L34-L77
The correct version using Frobenius norm would be:
Normalization should be per-token, not per-sequence.
The text was updated successfully, but these errors were encountered: