Skip to content

[tests] Regenerate the real-PG SFT goldens after #5757 - #5796

Merged
tianyu-l merged 1 commit into
mainfrom
regen-sft-real-pg-goldens
Nov 4, 2026
Merged

tianyu-l merged 1 commit into
mainfrom
regen-sft-real-pg-goldens

Conversation

@tianyu-l

@tianyu-l tianyu-l commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary (human-written)

Why

The Real PG integration suite (8 GPU Integration (Real PG - full suite - features)) and the ROCm integration suite have failed the sft loss check on main since #5757 (899480301; a87db08ea before it passed):

[sft] AssertionError: 7.889825820922852 != 7.887711524963379 : loss mismatch at step 1   # A10G
[sft] AssertionError: 7.890093803405762 != 7.887524604797363 : loss mismatch at step 1   # MI350X

#5757 renders bos_token/eos_token in Hugging Face chat templates, an intended change to the SFT token stream. It regenerated tests/assets/losses/fake_pg/a10g/sft.txt but not the real-PG A10G and MI350X goldens.

What changed

  • tests/assets/losses/real_pg/a10g/sft.txt and tests/assets/losses/real_pg/mi350x/sft.txt: steps 1-10 regenerated; headers unchanged.

Numerics

The new values are the full-precision TensorBoard metrics of the failing main runs' baseline training (the same values loss_compare.py --export-result writes), read with scripts/loss_compare.py's own extraction from the uploaded integration-8gpu-features-outputs artifacts:

  • A10G: run 41746280593 (e6ca6d861). Step 1 matches the log's baseline (7.889825820922852, grad_norm 4.189799785614014).
  • MI350X: the ROCm run on 73c4ebdac. Step 1 matches the log's baseline (7.890093803405762, grad_norm 4.189815998077393).

The commits between #5757 and those runs (#5572, #5787, #5776, #5774, #5779, #5741, #5786) do not change SFT numerics.

Testing

  • CI: Real PG (ciflow/real-pg) and ROCm (ciflow/rocm) integration suites.
  • A manual export_results run of the integration workflow for sft on main (run 41760303504) exported a real-PG A10G golden identical to this one.
  • Multi-GPU Unit Tests fails here with the _VisionEncoder ... named_preserve_dtype_params error that is also on main; [tests] Use torchtitan Modules in the FSDP CPU-offload test fakes #5795 fixes it.

This PR was AI-assisted.

#5757 renders bos/eos in Hugging Face chat templates, which changes the
SFT token stream. It regenerated the fake-PG A10G golden but not the
real-PG A10G and MI350X ones, so the Real PG and ROCm integration
suites fail the sft loss check on main.
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 4, 2026
@tianyu-l tianyu-l added ciflow/real-pg Run the full 8-GPU Real PG integration suite ciflow/rocm labels Nov 4, 2026
@tianyu-l

tianyu-l commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@claude review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 4, 2026
@claude

claude Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @tianyu-l's task in 1m 2s —— View job


Verdict: Approve (one item to fix in the PR description first) -- see review

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: Approve -- please address the item below before merging. This finishes the golden regeneration that #5757 left incomplete. The numbers are consistent with the logs the description cites.

What this PR does. #5757 started rendering bos_token/eos_token in HF chat templates, which is meant to change the SFT token stream. That PR updated only fake_pg/a10g/sft.txt. This PR updates the other two sft goldens that features.py:1197 (tests/assets/losses/{execution_mode}/{gpu_arch}/sft.txt) resolves to: real_pg/a10g and real_pg/mi350x. After this, all three sft.txt files in the repo reflect the new token stream. No other suite or backend has an SFT golden. sft_multiturn has no golden file, so nothing else is left stale.

Example.

step 1 (A10G, FSDP=2)   loss                 grad_norm
before (golden)         7.887711524963379    4.176631927490234
CI on main since #5757  7.889825820922852    4.189799785614014   <- loss check fails
after (golden)          7.889825820922852    4.189799785614014

Must fix

  1. PR description: the "Summary (human-written)" section is empty. Per CONTRIBUTING.md, the author fills it in (one line is enough here, e.g. "Regenerate real-PG SFT goldens missed by #5757").
Details
  • Headers (config: llama3_debugmodel_sft, ngpu: 2, FSDP=2) are unchanged and still match the IntegrationTestDefinition at tests/integration_tests/features.py:1191-1199.
  • Step-1 loss and grad_norm match the failing values quoted in the description for both A10G and MI350X. As with the old goldens, A10G and MI350X agree to about 1e-3, which fits a data-only change on both backends rather than a backend-specific drift.
  • #5757 (899480301) changed renderer.py/tokenizer.py and regenerated only the fake-PG golden, so these files were stale from that commit on.

Not verified: steps 2-10 were taken from the CI artifacts the description cites. I could not re-extract them here. The pending ciflow/real-pg and ciflow/rocm runs on this PR will confirm them.

@tianyu-l
tianyu-l merged commit 2124d73 into main Nov 4, 2026
@tianyu-l
tianyu-l deleted the regen-sft-real-pg-goldens branch November 4, 2026 05:04
felipemello1 pushed a commit that referenced this pull request Nov 5, 2026
Conflicts resolved so main's new behavior and this PR's sum-then-scale design both hold:
- #4819 (FLOPs per input batch): the graphable forward/backward returns (loss, metrics) and
  forward_backward builds ForwardBackwardResult with num_flops; kept, with this PR's single-argument
  _run_forward_backward. The core, GraphTrainer and TorchFT trainers keep main's FLOPs reduction and
  this PR's loss logging (sums divided by the step's loss tokens). TorchFT averages FLOPs over the
  replicas when ft_pg is set, also without DP or CP.
- #5779 (max_context_length from the model config): preprocess_inputs drops max_context_length and
  keeps aux_loss_denominators.
- #5563 (ChunkedLossWrapper keeps caller FSDP policies): main's chunked loop, without the count
  argument. test_chunked_loss_fsdp.py: losses are sums; the test divides gradients once by the loss
  tokens before comparing, as optim_step does.
- #5757/#5796 (SFT data change): sft.txt goldens taken from main; regenerated from CI next.
felipemello1 pushed a commit that referenced this pull request Nov 5, 2026
Main's SFT data change (#5757/#5796) set the step-1 loss token count to
N = 8080 (real PG) and 4066 (fake PG). Main rounds 1/N to bf16 at the
logits, this PR divides the fp32 gradients by N once. Step-1 loss is
bitwise; step-1 grad norm moves by fp32(1/N)/bf16(1/N):
- real_pg/a10g: 4.189800 -> 4.182507 (x0.99826), run 41978609975 job 127083279813
- real_pg/mi350x: 4.189816 -> 4.182497 (x0.99825), run 41978590756 job 127083230002
- fake_pg/a10g: 4.005685 -> 4.003838 (x0.99954), run 41978607830 job 127083270741
Values copied from each job's "Baseline metrics in import file format" block;
the "#" header lines are kept and the "# config:" lines match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/real-pg Run the full 8-GPU Real PG integration suite ciflow/rocm CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants