Skip to content

Fix incorrect stats for bf16 params in parameter_overview#380

Open
uvikas wants to merge 1 commit intogoogle:mainfrom
uvikas:bf16_param_overview
Open

Fix incorrect stats for bf16 params in parameter_overview#380
uvikas wants to merge 1 commit intogoogle:mainfrom
uvikas:bf16_param_overview

Conversation

@uvikas
Copy link

@uvikas uvikas commented Mar 24, 2026

For bfloat16 parameters, accumulating over large tensors produces numerically incorrect results due to bf16 limited precision (~3 significant digits).

A (768,) LayerNorm scale initialized to all 1.0 in bf16 is reported as mean=0.334 std=0.408 instead of mean=1.0 std=0.0. A (768, 768) weight matrix shows ~20x underestimated std.

Upcasts arrays to float32 to compute stats. Reported dtype in the overview table remains the original dtype e.g. bfloat16.

@google-cla
Copy link

google-cla bot commented Mar 24, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant