Skip to content

feat(megatron): add sampled Flux weight-state audit - #985

Merged
gphuang merged 2 commits into
fix/megatron/energon-resume-statefrom
feat/megatron/issue220-option9-weight-summary
Aug 13, 2026
Merged

feat(megatron): add sampled Flux weight-state audit#985
gphuang merged 2 commits into
fix/megatron/energon-resume-statefrom
feat/megatron/issue220-option9-weight-summary

Conversation

@gphuang

@gphuang gphuang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Tracks Issue #220, Task 9 Option 9.

Add an opt-in Flux audit that records deterministic rank-zero parameter samples after selected completed training iterations. This lets early MXFP4, FP8, and BF16 forks compare model drift without extra full optimizer checkpoints or changes to Torch RNG state.

  • Sample after the model forward so overlapped distributed-optimizer gathers have refreshed every parameter buffer.
  • Record per-parameter shape, dtype, finite counts, sampled moments, and SHA256.
  • Publish one strict JSON file per completed iteration using atomic, no-overwrite semantics; identical restarts are idempotent and conflicting output fails closed.
  • Skip validation and synthetic warmup, and explicitly record completed-iteration, next-iteration, forward-counter, and microbatch coordinates.

Test plan

  • Changed modules compile with py_compile
  • git diff --check
  • CI formatting and dependency checks
  • Targeted audit-marker tests in the pinned v26.5 container
  • Real Megatron wrapper smoke verifies post-gather step-5,120 and step-8,192 snapshots

@gphuang

gphuang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Verdict: weight-audit review passed

Ready to merge at 21ae58d01b73f6be990f4837a3efa98e275d67b4. The review found no remaining blockers.

  • Iteration coordinates now use Megatron's optimizer state, independent of changing or replayed microbatches.
  • Impossible terminal selections fail on every rank before model collectives; sampling remains after parameter-refresh hooks.
  • Atomic restart handling is type-strict: identical payloads are idempotent, while changed weights or provenance fail closed.
  • Checks: pinned Black formatting, py_compile, focused CPU harnesses, clean diff, and all available CI passed.

@gphuang
gphuang marked this pull request as ready for review August 13, 2026 11:57
@gphuang gphuang closed this Aug 13, 2026
@gphuang gphuang reopened this Aug 13, 2026
@gphuang
gphuang force-pushed the feat/megatron/issue220-option9-weight-summary branch from 7c9e625 to d96f19a Compare August 13, 2026 15:59
@gphuang

gphuang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Verdict: ready to merge

Full base-to-head review found no blocking findings after the TP validation fix and public-history sanitization.

  • Lint, dependency review, Docker build, JAX, Torch, coverage, and docs checks passed.
  • TP=1, TP>1 validation participation, broadcast dtype, replay identity, and atomic publication contracts were reviewed.
  • No credentials or internal infrastructure identifiers remain in the rewritten branch history.

@gphuang
gphuang force-pushed the feat/megatron/issue220-option9-weight-summary branch from d96f19a to ef6ce5b Compare August 13, 2026 17:05
@gphuang
gphuang merged commit eb95743 into fix/megatron/energon-resume-state Aug 13, 2026
6 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.

1 participant