Repository navigation
[tests] Regenerate the real-PG SFT goldens after #5757 - #5796
Conversation
#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.
|
@claude review |
|
Claude finished @tianyu-l's task in 1m 2s —— View job Verdict: Approve (one item to fix in the PR description first) -- see review |
There was a problem hiding this comment.
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
- 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 theIntegrationTestDefinitionattests/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) changedrenderer.py/tokenizer.pyand 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.
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.
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.
Summary (human-written)
Why
The Real PG integration suite (
8 GPU Integration (Real PG - full suite - features)) and the ROCm integration suite have failed thesftloss check on main since #5757 (899480301;a87db08eabefore it passed):#5757 renders
bos_token/eos_tokenin Hugging Face chat templates, an intended change to the SFT token stream. It regeneratedtests/assets/losses/fake_pg/a10g/sft.txtbut not the real-PG A10G and MI350X goldens.What changed
tests/assets/losses/real_pg/a10g/sft.txtandtests/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-resultwrites), read withscripts/loss_compare.py's own extraction from the uploadedintegration-8gpu-features-outputsartifacts:e6ca6d861). Step 1 matches the log's baseline (7.889825820922852, grad_norm 4.189799785614014).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
ciflow/real-pg) and ROCm (ciflow/rocm) integration suites.export_resultsrun of the integration workflow forsfton main (run 41760303504) exported a real-PG A10G golden identical to this one.Multi-GPU Unit Testsfails here with the_VisionEncoder ... named_preserve_dtype_paramserror that is also on main; [tests] Use torchtitan Modules in the FSDP CPU-offload test fakes #5795 fixes it.This PR was AI-assisted.