Fix MPS GPT-2 NaNs and T5Gemma2 beam expansion #2155
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 198 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.317
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2155"
general
weight: 0.35
jordimas
Fix two inference regressions reported with GPT-2 and T5Gemma2 on MPS.
precise::tanhfor Metal tanh and tanh-GELU. The fast-math implementation can return NaNs for large finite inputs, including through fused bias and GEMM activation epilogues.Regression tests cover large finite tanh/GELU inputs, including fused epilogues, and a padded batch with
beam_size=2on CPU and MPS. The attention test compares packed and unpacked memory on the first step and with cached encoder projections on the next step. Both regressions fail against the unmodified upstream library.Validation on an Apple M1:
jordimas/t5gemma-2-270m-270m: eight padded inputs of lengths 185, 166, 178, 348, 233, 200, 293 and 110,beam_size=2, maximum output length 64. Two runs per device completed with finite scores and valid tokens. CPU and MPS tokens matched for all eight inputs.The T5Gemma2 reproduction uses the unchanged upstream converter and no new masking code. Masking, FP16 rescaling and converter changes are tracked separately in draft #2157.
Fixes #2153
Fixes #2154