Skip to content

fix(vlm): support packed THD Step3.7 pipeline training - #3572

Open
new-TonyWang wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
new-TonyWang:fix/step3p7-thd-pp-offload
Open

fix(vlm): support packed THD Step3.7 pipeline training#3572
new-TonyWang wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
new-TonyWang:fix/step3p7-thd-pp-offload

Conversation

@new-TonyWang

Copy link
Copy Markdown

Summary

  • add robust text-only THD packing support for Step3.7 VLM SFT, including malformed-row fallback and packed metadata propagation
  • make pipeline schedules preserve THD auxiliary inputs and scalar losses across pipeline stages
  • harden Step3.5/Step3.7 MoE paths for FSDP CPU offload and grouped expert execution
  • improve rank-aware metric/TensorBoard logging and distributed gradient utilities
  • extend Dion/Muon configuration for the low-memory stateless path
  • document the Step3.7 text THD packing workflow

Validation

  • focused unit suite covering datasets, VLM packing, pipeline helpers, THD utilities, Step3.5/Step3.7 model behavior, and optimizer configuration
  • 9 targeted test modules pass
  • end-to-end 8-GPU Step3.7 packed THD SFT completed 1,000 optimizer steps with PP4/EP2

Notes

The end-to-end validation used mu=0 for the stateless Muon path. This PR does not claim equivalent memory behavior for momentum Muon configurations.

@new-TonyWang
new-TonyWang requested review from a team and jgerh as code owners August 18, 2026 08:09
@copy-pr-bot

copy-pr-bot Bot commented Aug 18, 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.

@HuiyingLi

Copy link
Copy Markdown
Contributor

Thank you @new-TonyWang , could you please resolve the merge conflicts? Thank you!

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-customer Waiting on the original author to respond label Aug 18, 2026

@jgerh jgerh 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.

Completed tech pubs review of docs/STEP3P7_TEXT_THD_PACKING.md. Provided a few copyedits and formatting updates to better align with our style guide.

@@ -0,0 +1,63 @@
# Step-3.7 text SFT with THD packed sequences

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.

Note: The file naming convention for Markdown files is lowercase with hyphens (kebab-case). Please rename STEP3P7_TEXT_THD_PACKING.md to step3p7-text-thd-packing.md, and update any cross-references or index.md entries that point to it.

Suggested change
# Step-3.7 text SFT with THD packed sequences
# Step-3.7 Text SFT with THD Packed Sequences

@@ -0,0 +1,63 @@
# Step-3.7 text SFT with THD packed sequences

AutoModel's VLM packing pipeline can now consume tokenizer-aware datasets such

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.

Suggested change
AutoModel's VLM packing pipeline can now consume tokenizer-aware datasets such
NeMo AutoModel's VLM packing pipeline can now consume tokenizer-aware datasets such

AutoModel's VLM packing pipeline can now consume tokenizer-aware datasets such
as `ChatDataset` without re-tokenizing them through the multimodal processor.

## Data flow

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.

Suggested change
## Data flow
## Data Flow

concatenation and gives each document its own attention-mask ID and
zero-based position IDs.
5. `packed_sequence_thd_vlm_collater` emits `qkv_format: thd`, `seq_lens`, and
`seq_lens_padded`; Transformer Engine derives `cu_seqlens` from these values.

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.

Suggested change
`seq_lens_padded`; Transformer Engine derives `cu_seqlens` from these values.
`seq_lens_padded`. Transformer Engine derives `cu_seqlens` from these values.


## Config

Smoke config:

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.

Suggested change
Smoke config:
Use the following smoke config:

examples/vlm_finetune/stepfun/step3p7_single_node_8xh200_text_sft_offload_8k_thd_packed_bs32_smoke.yaml
```

Full-data config:

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.

Suggested change
Full-data config:
Use the following full-data config:

examples/vlm_finetune/stepfun/step3p7_single_node_8xh200_text_sft_offload_8k_thd_packed_bs32_train.yaml
```

Key settings:

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.

Suggested change
Key settings:
The key settings are:


`local_batch_size` counts packs, not original conversations.

## Validation evidence

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.

Suggested change
## Validation evidence
## Validation Evidence

had shape `(4, 8192)`, and a multi-document pack emitted sequence lengths
`[7377, 312, 191, 136]`.

GPU forward/backward/optimizer validation must be performed only after the

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.

Suggested change
GPU forward/backward/optimizer validation must be performed only after the
Perform GPU forward, backward, and optimizer validation only after the

@HuiyingLi

Copy link
Copy Markdown
Contributor

Thank for the PR @new-TonyWang . Looks like there are a lot of things happening in this PR. Would you mind splitting it into several manageable pieces? e.g. I see thd+pp support with step37, cpu offload, dion related, dataset related etc. Thank you so much appreciate it!

@new-TonyWang

Copy link
Copy Markdown
Author

@jgerh @HuiyingLi Thank you all, bro! This PR isn鈥檛 finished yet. I鈥檒l resolve the merge conflicts, run more compatibility tests, and improve the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request waiting-on-customer Waiting on the original author to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants