Repository navigation
test(losses): de-flake test_cross_entropy_qwen3_vocab (batch 2 → 64) - #79
Merged
Merged
Conversation
random_normal/randint are unseeded, so the mean-reduced cross-entropy loss varied run-to-run. At batch_size=2 the spread around log(V)≈12.43 is ±0.71, so a high random target logit could push the batch mean below the 10.0 lower bound (or above 15.0) — surfaced on CI as "Loss should be > 10.0, got 9.881153". batch_size=64 shrinks the spread to ±0.13; a 2M-draw simulation keeps the loss in [11.8, 13.0] and never leaves the (10, 15) band. Vocab unchanged, so the large-vocab chunking path is still exercised. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Main CI intermittently fails on a single Rust unit test (most recently on the PR #78 merge commit, run
28209793148):It is unrelated to whatever PR happens to be merging — the test was last touched in #12 and only
convert.rschanged in #78. It is a pre-existing flaky test.Root cause
The test builds random logits/targets with no seed and asserts a tight band on the mean-reduced loss:
With
batch_size = 2, the loss is≈ 12.43 − N(0, 0.71)— a high random target logit occasionally drags the mean below10.0(the observed9.88is a ~3.5σ draw).Fix
Bump
batch_size2 → 64. The mean-reduction then concentrates the loss atlog(V), shrinking the spread from ±0.71 to ±0.13. Vocab is unchanged, so the large-vocab chunking path is still exercised.Verification (2,000,000-draw simulation of the exact loss model)
At batch=64 the loss stays in
[11.8, 13.0]across 2M draws — ~15σ from the10.0bound. (logsumexpconstant measured = 12.4313, matchingln(V)+0.5.)🤖 Generated with Claude Code
Note
Low Risk
Test-only change with no production or loss-implementation edits; slightly more work per test run from a larger batch.
Overview
Stabilizes
test_cross_entropy_qwen3_vocabinlosses_test.rsby raisingbatch_sizefrom 2 to 64 while keeping the Qwen3-sized vocab (151936) and the same(10.0, 15.0)loss band.The test still uses unseeded random logits/targets; with a tiny batch, a lucky target logit could drag the mean cross-entropy below 10.0 and fail CI. A larger batch tightens the mean-reduced loss around
log(vocab)so the assertion is reliable without changing what the test exercises (large-vocab / chunked cross-entropy path).Reviewed by Cursor Bugbot for commit 0225f73. Bugbot is set up for automated code reviews on this repo. Configure here.