Skip to content

Recapture the control leg reference against the fixed loss normalisation - #9569

Merged
danielhanchen merged 2 commits into
mainfrom
ci/recapture-control-reference
Aug 30, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
ci/recapture-control-reference

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The committed trace was captured on 2026-08-14 with unsloth 2026.8.12. Run
32607621452 failed the band check against it, and the drift is real and
reproducible rather than noise: control and canary produced byte-identical step
tables and each was bitwise reproducible across two fresh processes.

ROOT CAUSE: unsloth-zoo #1066 (117e6ce, 2026-08-16). It fixed
num_items_in_batch double-removing boundaries that were already masked, which
INFLATED the loss and the gradients before the fix. The reference predates it,
so the old numbers are the inflated ones and the new ones are correct.

The evidence that this is the loss FUNCTION and not optimisation drift is step

  1. It is computed before any optimizer update, on identical initial weights,
    identical data and the same seed, and it moves by the same -7.1% as steps 2
    through 7. Nothing about optimisation can change a value computed before the
    first update.

step loss old -> new (delta) grad_norm old -> new (delta)
1 10.3222 -> 9.5849 -7.1% nan -> nan
2 10.4956 -> 9.7459 -7.1% nan -> nan
3 9.9563 -> 9.2452 -7.1% nan -> nan
4 10.3892 -> 9.6471 -7.1% 48.648 -> 45.160 -7.2%
5 5.0523 -> 4.7021 -6.9% 47.511 -> 44.132 -7.1%
6 1.7538 -> 1.6209 -7.6% 30.542 -> 28.807 -5.7%
7 1.7620 -> 1.6451 -6.6% 54.547 -> 52.899 -3.0%
8 0.1764 -> 0.1840 +4.3% 17.216 -> 20.127 +16.9%
9 1.7956 -> 1.5582 -13.2% 48.852 -> 45.124 -7.6%
10 0.0871 -> 0.1230 +41.2% 11.202 -> 12.340 +10.2%

The uniform ~-7% over steps 1-7 is the deflation; the larger swings at 8-10 are
that offset compounding through a run whose later steps sit near zero, where a
small absolute change is a large relative one.

WHAT THIS BLESSES, stated plainly rather than buried: recapturing makes the
post-#1066 behaviour the new baseline. That is the right call only because the
drift is a fix landing rather than a regression, and step 1 is the evidence for
which of the two it is. A reader who disagrees has both sets of numbers above.

Captured per references/README.md "Capturing one", from run 32620007634
(dispatched with skip_reference_band=true, verdict pass, all 4 payloads
passed), kernel danielhanchen/unsloth-t4-ci-17c2db2a. Selected by
label == "control": that run's reports[0] is canary, which is exactly the trap
the README warns about.

Everything the band check compares before it looks at a number is unchanged:
max_steps 10, batch_size 2, grad_accum 1, max_seq_length 512, lr 0.001, lora
r16/alpha32, adamw_8bit, unsloth gradient checkpointing, dataset_digest
847095f5... (verified against the committed canary_dataset.jsonl with the
payload's own dataset_digest(), not a hand-rolled hash), Tesla T4, sm_75, torch
2.10.0+cu128, transformers 5.5.0, trl 0.24.0, CUDA 12.8. The only environment
axis that moves is unsloth 2026.8.12 -> 2026.8.19.

Two fields gain a value they did not have. init_loss_scale was None and is now
0.0, which is the argument's actual default -- the old file predates the flag,
so check_reference was listing it under config_unchecked and comparing nothing.
resolved_checkpoint was None and now names
unsloth/qwen2.5-0.5b-instruct-unsloth-bnb-4bit. Both are strictly more that the
band check now verifies.

The committed trace was captured on 2026-08-14 with unsloth 2026.8.12. Run
32607621452 failed the band check against it, and the drift is real and
reproducible rather than noise: control and canary produced byte-identical step
tables and each was bitwise reproducible across two fresh processes.

ROOT CAUSE: unsloth-zoo #1066 (117e6ce, 2026-08-16). It fixed
num_items_in_batch double-removing boundaries that were already masked, which
INFLATED the loss and the gradients before the fix. The reference predates it,
so the old numbers are the inflated ones and the new ones are correct.

The evidence that this is the loss FUNCTION and not optimisation drift is step
1. It is computed before any optimizer update, on identical initial weights,
identical data and the same seed, and it moves by the same -7.1% as steps 2
through 7. Nothing about optimisation can change a value computed before the
first update.

  step   loss  old -> new      (delta)    grad_norm  old -> new      (delta)
     1   10.3222 ->  9.5849     -7.1%     nan     -> nan
     2   10.4956 ->  9.7459     -7.1%     nan     -> nan
     3    9.9563 ->  9.2452     -7.1%     nan     -> nan
     4   10.3892 ->  9.6471     -7.1%     48.648  -> 45.160        -7.2%
     5    5.0523 ->  4.7021     -6.9%     47.511  -> 44.132        -7.1%
     6    1.7538 ->  1.6209     -7.6%     30.542  -> 28.807        -5.7%
     7    1.7620 ->  1.6451     -6.6%     54.547  -> 52.899        -3.0%
     8    0.1764 ->  0.1840     +4.3%     17.216  -> 20.127       +16.9%
     9    1.7956 ->  1.5582    -13.2%     48.852  -> 45.124        -7.6%
    10    0.0871 ->  0.1230    +41.2%     11.202  -> 12.340       +10.2%

The uniform ~-7% over steps 1-7 is the deflation; the larger swings at 8-10 are
that offset compounding through a run whose later steps sit near zero, where a
small absolute change is a large relative one.

WHAT THIS BLESSES, stated plainly rather than buried: recapturing makes the
post-#1066 behaviour the new baseline. That is the right call only because the
drift is a fix landing rather than a regression, and step 1 is the evidence for
which of the two it is. A reader who disagrees has both sets of numbers above.

Captured per references/README.md "Capturing one", from run 32620007634
(dispatched with skip_reference_band=true, verdict pass, all 4 payloads
passed), kernel danielhanchen/unsloth-t4-ci-17c2db2a. Selected by
label == "control": that run's reports[0] is canary, which is exactly the trap
the README warns about.

Everything the band check compares before it looks at a number is unchanged:
max_steps 10, batch_size 2, grad_accum 1, max_seq_length 512, lr 0.001, lora
r16/alpha32, adamw_8bit, unsloth gradient checkpointing, dataset_digest
847095f5... (verified against the committed canary_dataset.jsonl with the
payload's own dataset_digest(), not a hand-rolled hash), Tesla T4, sm_75, torch
2.10.0+cu128, transformers 5.5.0, trl 0.24.0, CUDA 12.8. The only environment
axis that moves is unsloth 2026.8.12 -> 2026.8.19.

Two fields gain a value they did not have. init_loss_scale was None and is now
0.0, which is the argument's actual default -- the old file predates the flag,
so check_reference was listing it under config_unchecked and comparing nothing.
resolved_checkpoint was None and now names
unsloth/qwen2.5-0.5b-instruct-unsloth-bnb-4bit. Both are strictly more that the
band check now verifies.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e48af9285a

ℹ️ 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".

"source_kernel": "danielhanchen/unsloth-t4-ci-e3c6661f"
"resolved_checkpoint": "unsloth/qwen2.5-0.5b-instruct-unsloth-bnb-4bit",
"resolved_revision": "10413c288cb9629acdf60b3e0229f3ba75efe413",
"source_kernel": "danielhanchen/unsloth-t4-ci-17c2db2a"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the reference provenance documentation

After this recapture, references/README.md still says the committed trace came from kernel unsloth-t4-ci-e3c6661f and records a final loss of 0.0871, while this file now identifies unsloth-t4-ci-17c2db2a and ends at 0.1230; pins/control.txt and the trajectory example in legs.py also retain the old provenance and metrics. Because the README explicitly presents those values as the current trace and treats the kernel slug as the audit hook, anyone investigating or recapturing the baseline will be directed to the wrong run and numeric rationale. Update the accompanying provenance and measured-value documentation with this reference.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit c7e1a13 into main Aug 30, 2026
1 of 19 checks passed
@danielhanchen
danielhanchen deleted the ci/recapture-control-reference branch August 30, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant