Skip to content

[nn]: add shared masked diffusion training objectives - #6569

Merged
kiseki-zj merged 4 commits into
mainfrom
codex/diffusion-objectives-2d2
Dec 2, 2026
Merged

kiseki-zj merged 4 commits into
mainfrom
codex/diffusion-objectives-2d2

Conversation

@kiseki-zj

@kiseki-zj kiseki-zj commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Add reusable masked-diffusion training objectives for LLaDA and LLaDA2. The helpers sample per-sequence mask probabilities, preserve prompt and padding boundaries, and keep LLaDA's inverse-probability weighted per-answer loss separate from dFactory's unweighted same-position masked-token cross entropy.

Provide a dense block-diffusion correctness baseline with doubled noisy/clean inputs, repeated position IDs, and attention masks that prevent answer leakage. This builds directly on the adapters already merged into main; it does not include the Ouro training PR or development scripts/logs.

Tests compare the helpers against pinned official formulas and dFactory reference functions, including logits, loss, parameter gradients, and updates through native ShardFormer policies. Only the 60 source-independent objective tests are registered in CPU CI; the tiny model integration tests require cached pinned model sources.

Merge main at da3df39e to include the upstream benchmark worker teardown fix. Rename Gemma4 GPU test modules to avoid collisions with their CPU counterparts, update batch paths, and add bounded retries for address-in-use failures in Gemma4 and ZeRO checkpoint tests. Numerical failures are not retried. The single-rank worker lifecycle regression uses a per-test file rendezvous to avoid TCP port-allocation races.

Validation

  • Development container: PyTorch 2.13.0+cu130, Transformers 5.17.0, CPU FP32 model execution.
  • On main-based PR contents: 148 passed, no skips — 76 diffusion tests and 72 existing remote-model adapter regression tests.
  • Revalidated after merging main on 2026-11-25: 148 objective/model regression cases passed with no skips; 7 GPU CI regression cases and 84 CI helper tests passed.
  • Repository pre-commit checks passed.
  • Same-layout block references verify AdamW updates; independent sequential-block references verify outputs, gradients, and SGD updates without relaxing tolerances.

Current GitHub Actions results are shown in the PR checks.

The final single-rank rendezvous change passed all 9 worker cleanup and Gloo callback regressions under PyTorch 2.5.1+cpu, plus applicable pre-commit checks.

Scope

This completes the shared 2D2 objective baseline. Original-weight training, GPU BF16 model execution, distributed/offload acceptance, and LLaDA2-specific editing or insertion/deletion objectives remain separate work. The dense block mask is a correctness baseline, not a long-sequence optimization.

@kiseki-zj
kiseki-zj requested a review from a team as a code owner November 18, 2026 10:08
Include the upstream benchmark worker teardown fix, give Gemma4 GPU tests unique module names, and use bounded address-in-use retries for Gemma4 and ZeRO checkpoint tests.
Use a per-test FileStore for the single-rank lifecycle regression so port allocation races cannot fail before the cleanup checks. Preserve real process group initialization, error propagation and barrier assertions.
@kiseki-zj
kiseki-zj enabled auto-merge (squash) December 2, 2026 07:47
@kiseki-zj
kiseki-zj merged commit c4509c3 into main Dec 2, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants