﻿# ONNX Runtime CUDA normalization: a rank-reduced scale can vary across rows

The 1.32 CUDA normalization repair handles lower-rank scale broadcasting; use distinct per-row scale patterns to expose a repeated-first-row error.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-cuda-rank-reduced-normalization-scale/
Language: en

ONNX Runtime 1.32.0 lists a correction for rank-reduced broadcast scales in CUDA LayerNormalization and RMSNormalization. The linked analysis explains a case where a valid lower-rank scale was treated as one repeated row. A CPU comparison therefore has value only when the input actually distinguishes those broadcast positions.

## Broadcastability includes axis alignment

A lower-rank tensor is interpreted relative to the input’s trailing dimensions. Rank inequality alone does not make it invalid or equivalent to a scalar scale. The PR describes mapping supported reduced shapes onto the existing CUDA broadcast path. A proposed test compares a reduced scale with its explicitly expanded equivalent, using the same values and normalization axis. Both should express the same operation without assuming identical physical storage.

## Uniform scale is a weak reproducer

If every broadcast row contains the same scale, repeating the first row can accidentally produce the intended answer. Give each relevant row a different pattern and include meaningful bias where supported. Check individual rows rather than only an aggregate norm. This makes an offset-selection error visible and separates it from ordinary reduction-order differences between CPU and CUDA, which can have a different numerical signature.

## Check both normalizers directly

Layer normalization and RMS normalization share related scale handling but compute different normalization statistics. A passing test for one should not automatically stand in for the other. Include the same broadcast shapes in both operators where the model uses them, with a trusted reference and documented tolerances. A model-level argmax is an additional integration signal, but cannot identify whether a small intermediate discrepancy is a layout error or expected arithmetic variation.

## Attribute the release change precisely

The release reports the CUDA broadcast correction, while the PR documents the original analysis and its own tests. This article does not claim those tests were rerun locally. A deployment check should confirm the installed binary, provider and actual scale ranks. The correction does not imply generic support for every possible broadcast layout on every provider, nor a universal speed change for normalization.

## Sources

- [ONNX Runtime v1.32.0 release](https://github.com/microsoft/onnxruntime/releases/tag/v1.32.0)
- [ONNX Runtime pull request #28971](https://github.com/microsoft/onnxruntime/pull/28971)

## Related reading

- [ONNX QuantizeLinear: the scale shape and axis define what is quantized together](/journal/fg2-onnx-quantize-linear-axis-scale-contract/)
- [ONNX Runtime provider order: graph partition priority is not request failover](/journal/fg2-onnxruntime-provider-priority-subgraph-partition/)
