Normalization Layers
About
The d9d.module.block.normalization package implements normalization layers.
RMSNorm
RMSNorm implements Root Mean Square Layer Normalization.
It uses a custom Triton kernel for the forward and backward passes, so it requires a GPU supported by Triton.
It supports zero-centered scaling weights (zero_centered=True). They are initialized to 0, and the kernel scales by weight + 1.
Kernel Benchmarks (bf16, H100)
Forward, Hidden Size = 128

Forward, Hidden Size = 256

Forward, Hidden Size = 1024

Forward, Hidden Size = 4096

Forward, Hidden Size = 7168

Backward, Hidden Size = 128

Backward, Hidden Size = 256

Backward, Hidden Size = 1024

Backward, Hidden Size = 4096

Backward, Hidden Size = 7168

Usage
API Reference
d9d.module.block.normalization
Normalization layers.
RMSNorm
Bases: Module, ModuleLateInit
Root Mean Square Layer Normalization (RMSNorm) layer.
Normalizes the input over its last dimension by its root mean square and applies learnable scaling weights. The weights can optionally be zero-centered.
References
__init__(hidden_size, eps=1e-06, zero_centered=False)
Constructs the RMSNorm object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hidden_size
|
int
|
Size of the normalized last dimension. |
required |
eps
|
float
|
Small value added to the variance for numerical stability. |
1e-06
|
zero_centered
|
bool
|
If |
False
|
forward(x)
reset_parameters()
Resets module parameters.