# Sigmoid-gated RMSNorm (`sigmoid_gated_rms_norm`) | ServingStudio Kernel Library

RMS-normalize each row, scale by a learned weight and multiply by sigmoid of a gate row.

Each row of x is RMS-normalized, scaled by a learned per-feature weight and multiplied elementwise by sigmoid(g), where g is a gate tensor of the same shape. Linear-attention output norms use it per head: m counts tokens times heads and hidden is the head dimension. Statistics and gating are computed in FP32 and the output is rounded to the input dtype.

Category: Normalization; group: RMSNorm. Interactive page: https://servingstudio.cs.washington.edu/kernels.html?kind=sigmoid_gated_rms_norm. All kernel kinds: https://servingstudio.cs.washington.edu/kernels.md.

## Formula

- `y = (x / √(mean(x²) + 1e−5) · weight) · sigmoid(g)`
- `FLOPs = 6·m·hidden + 2·m`
- `bytes = (3·m·hidden + hidden)·bytes(dtype)`
- `TFLOPS = FLOPs / time`
- `GB/s = bytes / time`

## How it is measured

GPU kernel time from CUPTI activity records, averaged over repeated launches in one capture. The L2 cache is flushed before each launch, so the numbers are cold-cache times. vllm_fla_triton counts the layer_norm_gated_fwd_kernel launch. Allocation and the output check against an FP32 reference run before timing.

## Caveats

- The FLA wrapper writes the output into x (out_dtype None), as the production call does.
- GB/s counts logical input and output bytes.

## Arguments

| Argument | Type | Unit | Meaning |
| --- | --- | --- | --- |
| `m` | number | rows | Rows normalized, e.g. tokens times heads for a per-head norm. |
| `hidden` | number | elements | Features normalized within each row. |
| `dtype` | dtype |  | Element type of the input, gate, weight and output. |

## Metrics

- Time (`time_ms`, ms)
- Throughput (`tflops`, TFLOPS)
- Memory bandwidth (`memory_bandwidth_gbps`, GB/s)
- Energy (`energy_j`, J)

## Backends

- `vllm_fla_triton`: FLA's rms_norm_gated with activation='sigmoid' (vLLM's FusedRMSNormGated.forward_cuda): one Triton launch. dtypes `bf16`, any CUDA GPU. Source: https://github.com/vllm-project/vllm/blob/main/vllm/third_party/flash_linear_attention/ops/kda.py

## Measured rows

50 rows in all.

| GPU | Backend | Precision | Rows |
| --- | --- | --- | --- |
| NVIDIA B200 | `vllm_fla_triton` | `bf16` | 50 |

## Used by these deployments

- [GLM-5.3-Flash NVFP4: ServingStudio design: DP attention, KDA TP groups, fused EP MoE, DFlash speculative decoding](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_nvfp4_dp_attn_kda_tp_fused_ep_moe_dflash2.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_nvfp4_dp_attn_kda_tp_fused_ep_moe_dflash2`)
- [GLM-5.3-Flash NVFP4: vLLM, DP attention, EP MoE](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_dp_attn_ep_moe.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_dp_attn_ep_moe`)
- [GLM-5.3-Flash NVFP4: vLLM, DP attention, EP MoE, DFlash speculative decoding](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_dp_attn_ep_moe_dflash2.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_dp_attn_ep_moe_dflash2`)
- [GLM-5.3-Flash NVFP4: vLLM, TP attention, EP or TP MoE](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_kda_dsa_moe.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_kda_dsa_moe`)
- [GLM-5.3-Flash NVFP4: vLLM, PP](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_pp_kda_dsa_moe.md) (`GLM-5.3-Flash-NVFP4/glm53_flash_vllm_nvfp4_pp_kda_dsa_moe`)
- [GLM-5.3-Flash: vLLM, DP attention, EP MoE](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash/glm53_flash_vllm_fp8_dp_attn_ep_moe.md) (`GLM-5.3-Flash/glm53_flash_vllm_fp8_dp_attn_ep_moe`)
- [GLM-5.3-Flash: vLLM, TP attention, EP or TP MoE](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash/glm53_flash_vllm_fp8_kda_dsa_moe.md) (`GLM-5.3-Flash/glm53_flash_vllm_fp8_kda_dsa_moe`)
- [GLM-5.3-Flash: vLLM, PP](https://servingstudio.cs.washington.edu/models/GLM-5.3-Flash/glm53_flash_vllm_fp8_pp_kda_dsa_moe.md) (`GLM-5.3-Flash/glm53_flash_vllm_fp8_pp_kda_dsa_moe`)

## API

- This kind: https://servingstudio.cs.washington.edu/api/public/v1/kernels/sigmoid_gated_rms_norm
- Measured rows: https://servingstudio.cs.washington.edu/api/public/v1/kernels/sigmoid_gated_rms_norm/rows (filter by any column, such as `?gpu=NVIDIA%20H200`; `format=csv` for CSV)
- Configs the public deployments ask of it: https://servingstudio.cs.washington.edu/api/public/v1/kernels/sigmoid_gated_rms_norm/configs

## Torch reference

What the kind computes, as Torch code (`profiling/runners/norm/sigmoid_gated_rms_norm_reference.py` in ServingStudio Sim):

```python
"""Torch semantics for the sigmoid-gated RMSNorm: y = rmsnorm(x) * weight * sigmoid(g)."""

from __future__ import annotations

import torch

__all__ = ["sigmoid_gated_rms_norm_reference"]

EPSILON = 1e-5


def sigmoid_gated_rms_norm_reference(
    x: torch.Tensor,
    g: torch.Tensor,
    weight: torch.Tensor,
) -> torch.Tensor:
    """``x`` and gate ``g`` are ``[M, hidden]``, ``weight`` is ``[hidden]``.

    Statistics, the affine scale and the sigmoid gate are computed in FP32 and the
    result is rounded to ``x.dtype`` (vLLM's ``FusedRMSNormGated.forward_native``
    with activation="sigmoid", eps 1e-5). Inputs are not mutated.
    """
    if x.ndim != 2 or g.shape != x.shape or weight.shape != (x.shape[-1],):
        raise ValueError(f"x {tuple(x.shape)}, g {tuple(g.shape)}, weight {tuple(weight.shape)}")
    x_fp32 = x.float()
    rstd = torch.rsqrt(x_fp32.square().mean(dim=-1, keepdim=True) + EPSILON)
    return (x_fp32 * rstd * weight.float() * torch.sigmoid(g.float())).to(x.dtype)
```

---

This page as Markdown: https://servingstudio.cs.washington.edu/kernels/sigmoid_gated_rms_norm.md. A guide to the whole site for AI agents: [llms.txt](https://servingstudio.cs.washington.edu/llms.txt).
