Agent skill · NVIDIA
nemo-mbridge-perf-sequence-packing
Validate and use packed sequences and long-context training in Megatron-Bridge, including offline LLM packing, collate-time VLM packing, Energon online packing, and CP constraints.
What it needs
About 6k tokens when loaded.
What this skill does
Sequence Packing Skill For stable background and recommendation level, see: @docs/training/packed-sequences.md @skills/nemo-mbridge-perf-sequence-packing/card.yaml Enablement Offline packed SFT for LLM finetuning: Choose the offline pack length For text-only LLM SFT and PEFT verification, start with an 8192-token offline pack when the model context limit, memory, and model-family support allow it. Benchmark pack lengths at equal token slots per optimizer step: For example, 2K/GBS32, 4K/GBS16, and 8K/GBS8 each expose 65,536 token slots per step. Longer packs aggregate more source examples into each physical MBS1 row and can reduce gradient accumulation and per-step overhead. They also increase activation memory and may expose kernel-width constraints, so select the largest measured configuration that fits rather than assuming longer is always faster. Offline packing requires MBS1. Require globalbatchsize % dataparallelsize == 0 and globalbatchsize >= dataparallelsize; an 8K/GBS8 workload therefore needs DP no larger than 8. Keep model.seqlength, dataset.seqlength, and packedsequencesize equal, use a fresh packed-data output root after changing any of them, and inspect the resolved post-setup configuration. Equal token slots do not make different pack lengths numerically identical: the longer target changes truncation and pack membership. Rerun finite-loss, no-skip/NaN, and convergence sentinels before replacing verified evidence. For finetuning with CP enabled: Use the same alignment formula for SFT and PEFT. It produces 1 for TP1/CP1 with SP disabled and 4 for TP4/CP1 with SP enabled. Offline packing does not derive the value automatically, so pin it explicitly and rebuild packed data after a topology change. If a dispatcher or kernel requires a fixed final token width: Choose packedsequencesize to satisfy the kernel multiple. For example, HybridEP with a 128-token combine chunk requires a width divisible by 128. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills NVIDIA/nemo-mbridge-perf-sequence-packing