Repository navigation
Kaggle T4: describe the batched-generation expectation as a precision property, not a pending fix - #10377
Conversation
The comment above KNOWN_BATCHED_GENERATION_BREAKAGE, the failure message for a listed model that starts agreeing, and the test file's docstring all said the two models were "confirmed broken upstream" and talked about "the day #9708 is fixed". There is no fix coming. The disagreement is bf16 / fp16 rounding that depends on batch shape (SDPA kernel selection for masked versus unmasked input, prefill GEMM shape, RMSNorm rounding), it reproduces with plain transformers and unsloth never imported on every transformers release from 4.57.0 to 5.16.1, and float32 makes every batch size agree. The measurements and a standalone repro are on #9708. The strict expectation stays exactly as it was: a listed model that starts agreeing still fails, because agreement in bf16 means a kernel or the stack changed and that is worth hearing about. Only the words change, so the next reader does not spend a week looking for a bug that is a property of the arithmetic. No behaviour change; the existing tests cover both halves.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 074af0c7f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| f"{known}, and every batch size AGREED. That disagreement is bf16 " | ||
| f"rounding that depends on batch shape, so agreement means a kernel " |
There was a problem hiding this comment.
Report fp16 for the T4 failure path
When either listed model starts agreeing, this diagnostic runs from a payload that unconditionally loads the model with dtype = torch.float16 because the T4 has no bf16 support, so attributing the previous disagreement specifically to bf16 is false for the environment being reported. This can send whoever investigates the newly red leg toward the wrong precision path; the message should say fp16 or generically low-precision rounding.
Useful? React with 👍 / 👎.
| # transformers with unsloth never imported shows the same thing, every | ||
| # transformers release from 4.57.0 to 5.16.1 shows it, and float32 makes every | ||
| # batch size agree. The measurements and a standalone repro are on #9708. |
There was a problem hiding this comment.
Correct the impossible Transformers version range
This claims the listed models reproduce on every Transformers release starting at 4.57.0, but the repository's own Gemma 4 loader explicitly rejects versions below 5.5.0 (unsloth/models/loader.py, in the gemma4 dispatch). Consequently the stated range cannot have exercised unsloth/gemma-4-E2B-it as described, which undermines the evidence used to classify its disagreement as a permanent precision property; narrow the range per model or clarify that the older-version experiment used a different repro.
Useful? React with 👍 / 👎.
| f"rounding that depends on batch shape, so agreement means a kernel " | ||
| f"or the stack changed; work out what, then delete the entry rather " | ||
| f"than carry a stale expectation" |
There was a problem hiding this comment.
Do not infer a kernel change from decoded-text agreement
Agreement here only means the decoded greedy strings compare equal; it does not demonstrate that the batch-shape rounding disappeared. The same numerical differences can remain while the argmax stays unchanged, especially because this check runs on a newly trained adapter and an unpinned, potentially re-uploaded checkpoint. In that scenario this message incorrectly concludes that a kernel or stack changed and directs the reader to delete the expectation, which can make the next near-boundary output red again; require numerical evidence or describe agreement as a reason to investigate all inputs before deletion.
Useful? React with 👍 / 👎.
Summary
Follow-up to #10367. The comment above
KNOWN_BATCHED_GENERATION_BREAKAGE, the failure message for a listed model that starts agreeing, and the docstring oftest_known_upstream_breakage.pyall described gemma-4-E2B-it and Qwen3.5-2B as "confirmed broken upstream" and referred to "the day #9708 is fixed".There is no fix coming. As recorded on #9708, the disagreement between batch size 1 and a padded batch is bf16 / fp16 rounding that depends on batch shape: a padded batch takes a different SDPA kernel from a lone prompt, the prefill projections run at a different GEMM shape, and RMSNorm rounds differently on the result. It reproduces with plain transformers and unsloth never imported, on every transformers release from 4.57.0 to 5.16.1, and float32 makes every batch size agree.
Change
Words only. The strict expectation is unchanged: a listed model that starts agreeing still fails the leg, because agreement in bf16 means a kernel or the stack changed and that is worth hearing about. The message now says that instead of "if the upstream fix has landed".
No behaviour change.
python3 -m pytest tests/kaggle/test_known_upstream_breakage.py tests/kaggle/test_t4_payload_assertions.py -q: 145 passed.