Skip to content

test: disable classifier dropout in the tiny Qwen2 test checkpoint - #4000

Open
tigist-far wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
AlignmentResearch:fix/tiny-qwen2-value-head-dropout
Open

tigist-far wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
AlignmentResearch:fix/tiny-qwen2-value-head-dropout

Conversation

@tigist-far

Copy link
Copy Markdown

What does this PR do ?

Saves classifier_dropout: 0.0 into the tiny Qwen2 test checkpoint so the value-head tests train without HF's default 0.1 dropout, which made test_value_worker_train_decreases_loss flaky (about 1 failure in 20 runs).

Issues

#3999

Usage

Not applicable: test-asset change only.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally?
  • Did you add or update any necessary documentation?

Additional Information

Why the test was flaky. The regression value head is a Qwen2ForTokenClassification head. GenericForTokenClassification builds nn.Dropout(classifier_dropout) and falls back to 0.1 when the model config defines neither classifier_dropout nor hidden_dropout; Qwen2Config defines neither. The test trains three steps at lr=5e-6 on a fixed batch and asserts losses[-1] <= losses[0] + 1e-3. Over two steps the genuine change is about -2.6e-4, while the dropout noise per step has a standard deviation of about 6.4e-4, so the tolerance sits inside the noise.

Measured on the same 2-GPU environment, 100 runs each, one fresh process per run:

Before After
Failures 5 / 100 0 / 100
Runs where the loss rose over the two steps 38 0
Monotone decrease 21 / 100 100 / 100
Mean change over two steps -2.3e-4 -2.6e-4
Std. dev. of that change 6.9e-4 7.4e-5

The training signal is unchanged; only the noise is gone.

test_dtensor_value_worker.py::test_value_worker_train_decreases_loss fails
intermittently: 5 of 100 runs on a 2-GPU pod with the CI image. The
regression value head is a Qwen2ForTokenClassification head, and HF applies
its 0.1 default dropout to it because Qwen2Config defines neither
classifier_dropout nor hidden_dropout. The test compares losses across three
steps at lr 5e-6 on a fixed batch, where the genuine change (about -2.6e-4)
is smaller than the per-step dropout noise (sd about 6.4e-4), so the 1e-3
tolerance fails in a ~5% tail.

Save classifier_dropout: 0.0 into the tiny Qwen2 test checkpoint. Only
classification heads read the key, so its causal-LM consumers are unaffected,
and the checkpoint config is the one place the value can live:
from_pretrained ignores keyword overrides for attributes the config lacks.
With the loss a function of the parameters alone, the same 100-run series
passed 100 of 100 with a monotone decrease in every run (step sd about
3.7e-5); the full dtensor and Megatron value modules pass against the
changed asset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Tigist Diriba <tigist@far.ai>
@tigist-far
tigist-far requested a review from a team as a code owner September 4, 2026 18:57
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants