Avoid optimizer updates during low-precision initialization #8919
All Vouch review confidence checks passed
Residual risk 0.32 = Change Risk (0.55) × (1 − Review Confidence (0.41)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 528 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.375
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #8919"
general
weight: 0.35
Levius-Fubuki
Fixes #8910.
FP16/BF16 ZeRO-0 wrappers currently call
optimizer.step()with zero gradients during construction, advancing Adam counters and applying AdamW decay before training. Remove the synthetic updates from both wrappers and allocate lazy state on the first real update. Move torch Adagrad's eagerly created state onto the corresponding FP32 masters, preserving the supplied optimizer and group settings. Existing checkpoint counters are loaded unchanged.Device validation: 2 x NVIDIA GeForce RTX 3090 24 GB available, new cases use one GPU; driver 580.105.08, torch 2.12.1+cu130, CUDA 13.0, NCCL 2.29.7, Python 3.12.3. Baseline bf222a2a fails the new counter/initialization regression. With the fix:
New cases cover FP16/BF16 Adam/AdamW/FusedAdam with decay 0/0.1, plain FP32 update references, actual engine checkpoints before the first update and after 20 updates, continued training, two-group eager Adagrad, and both FusedLamb gradient APIs (counter/restore checks for LAMB). Tests explicitly disable clipping to isolate optimizer updates. Changed-file pre-commit, syntax and diff checks pass; independent spec/code reviews found no remaining issue.
A direct-wrapper CUDA measurement with 1,048,576 FP16 parameters, torch AdamW(lr=0.01, weight_decay=0.1), 3 repeats and 40 updates reproduces master 0.499500006 / step 1 after baseline construction versus 0.5 / step 0 with the fix. Median construction peak allocated memory is 24 MiB versus 8 MiB; overall training peak is 36 MiB for both. Allocation shifts to the first actual step. The short quadratic-loss trajectory falls 0.25→0.002882 baseline and 0.25→0.002622 fixed; these are different update semantics, not a convergence-quality comparison. Timing is noisy at this scale (recorded constructor/first/steady medians in the experiment artifacts); no throughput improvement or production-convergence claim is made.
Duplicate check found no open PR covering #8910. #8673 modifies mixed-precision FusedAdam updates but retains this constructor path. Dedicated BF16 and ZeRO 1/2/3 initialization were inspected and already avoid this synthetic step.
Unvalidated: Apex legacy Adam, other accelerators, offload, pipeline/tensor/MoE parallelism, cross-stage/world-size checkpoint conversion, generic prepopulated custom optimizer state. Adagrad frozen/zero-element state entries are a preexisting separate corner outside these trainable-parameter cases.
AI assistance (OpenAI Codex) was used for investigation, implementation and device tests. The human submitter confirmed manual diff review and test-result verification and authorized submission. Device tests above were executed on the requested server with Codex; no additional human test execution is asserted.
Review follow-up (1a372ef1): generalized Adagrad state promotion beyond
sumand added an engine regression for additional eager tensor state, unchanged counters/metadata, and a plain-torch update reference. On Apple M3/macOS ARM64, Python 3.12.13, torch 2.14.1, CPU/Gloo:TestAdagradLowPrecisionStatereports 1 passed, 1 skipped (FP16 unsupported). The BF16 regression fails before this follow-up and passes after it. Changed-file pre-commit, syntax and diff checks pass. The GPU results above were obtained on the original PR revision7d2a5573; CUDA tests were not rerun for this follow-up because the server is offline.Local recheck on 2026-10-30, unchanged head
1a372ef1: Apple M3/macOS 15.1 ARM64, Python 3.12.13, torch 2.14.1, CPU/Gloo.TestAdagradLowPrecisionStatereports 1 passed, 1 skipped (FP16 unsupported); all applicable changed-file pre-commit checks pass. These checks were executed with Codex. No additional human test execution or CUDA validation is asserted. The existing review thread remains open for reviewer confirmation.