Skip to content

[2/2] [OMNIML-6340] Add distributed GSQ calibration and restart - #3240

Draft
ajrasane wants to merge 1 commit into
ajrasane/gsq-nvfp4-weight-onlyfrom
ajrasane/gsq-distributed-calibration
Draft

ajrasane wants to merge 1 commit into
ajrasane/gsq-nvfp4-weight-onlyfrom
ajrasane/gsq-distributed-calibration

Conversation

@ajrasane

@ajrasane ajrasane commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: new feature

Add replicated data parallel GSQ calibration and restart checkpoints on top of #3173. This is the second PR in the series and intentionally targets ajrasane/gsq-nvfp4-weight-only so its diff contains only the extension.

round robin shard initializer and training splits separately
  -> synchronize initialization, Hessians and weighted gradients
  -> save shared layer state plus rank-local activations/metadata
  -> commit manifest after every rank completes the boundary
  -> resume with validated topology and configuration

Sample counts and logical batches are global; microbatches are per rank. Keep uneven tails and empty rank contributions. Reject non-replicated placement, custom subgroups and mismatched configurations, and coordinate rank-local failures before the next collective.

Restore single-process and multi-process GSQ restart support. Completed distributed checkpoints restore without data replay; copied state preserves shared native scale aliases. File-backed activation caches, linear reconstruction and streaming GSQ export remain excluded.

Usage

torchrun --standalone --nproc_per_node=2 examples/hf_ptq/gsq_distributed.py \
  --model /path/to/llama \
  --initializer-data initializer.pt --training-data training.pt \
  --checkpoint-dir /shared/checkpoints --output /shared/gsq.pth

The two data files contain long tensors shaped [global_sequences, sequence_length]. The example initializes WORLD, binds the local GPU, shards each split separately and writes the completed model on rank zero. On multiple nodes, supply matching rendezvous settings and shared checkpoint/output paths. Source model, tokenizer, datasets and ordering must remain unchanged on resume; the forward-loop API cannot identify them.

Testing

  • 157 focused CPU tests passed: GSQ recipes/configuration and existing configuration/layerwise regressions.
  • 55 focused GPU tests passed on the final stacked branch, including all 40 retained core/layerwise cases and 15 distributed/restart cases.
  • Real two-GPU tests cover GPTQ/max/MSE initialization, uneven and empty shards, exact replica agreement, invalid placement/subgroups, mismatched rank configuration, nonfinite-data rollback, interrupted forwards and checkpoint writes, exact resumed-state equality, completed distributed restore, native save/restore, and topology/configuration mismatch refusal. A single-process case verifies interrupted GSQ resume and native restore while preserving the generic completed-directory policy.
  • Applicable formatting, lint, security, license and RST hooks passed. Repository mypy passed with its normal hook flags targeting Linux. The parent PR's three recipe schemas passed the repository validator directly.
  • The parent PR documents a realistic-width single-decoder time/memory measurement; this follow-up makes no scaling-performance claim.

Quality gains, production scaling and actual cross-machine execution remain unverified. No evaluation campaigns or model downloads were submitted for this split.

All new commits contain SSH signatures that verify locally. GitHub currently reports unknown_key for the configured signing key, so their signatures are not shown as Verified there.

Before your PR is "Ready for review"

Follow Contributor guidelines and Security Best Practices. Commits are signed and signed off.

  • Is this change backward compatible?: ✅ — extends the unmerged GSQ feature; existing single-process checkpoint format remains supported.
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A — no new dependency or copied third-party source.
  • Did you write any new necessary tests?: ✅ — distributed behavior and restart tests are isolated from the core algorithm tests; single-process restart coverage verifies interrupted resume and native restore.
  • Did you update Changelog?: ✅ — separate concise entry under the existing unreleased Quantization section.
  • Did you get Claude approval on this PR?: ❌ — not requested in this task.

Additional Information

Merge order: #3173 first; then retarget this PR to main. The repository defers GPU/example/regression required checks for a PR targeting another feature branch. Focused GPU checks were therefore run directly on this branch; normal required CI must run after retargeting.

Merge danger: reversible source change. Shared layerwise checkpoint persistence and restore are the main regression surface. Multi-rank failures must reach the same collective boundaries before advancing the checkpoint manifest.

@copy-pr-bot

copy-pr-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
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