Files
Zhehao Hu 073eceb541 launcher: clean up the Qwen3-8B DFlash2 streaming example (#2932)
### What does this PR do?

Type of change: New example

Problem: The Day-0 speculative-decoding workflow copies
`hf_streaming_dflash2.yaml` as its streaming template, but the example
floats on `vllm/vllm-openai:latest` (training) and `:nightly` (smoke
test) and writes its export to a fixed `/scratchspace/export`. A run
can't be reproduced, and its smoke test can't be re-run against an
earlier export. It also trains on 16-token blocks, while vLLM ignores
the checkpoint's `block_size` and serves DFlash2 with a block of 1 +
`NUM_SPEC_TOKENS`: 8, with the `NUM_SPEC_TOKENS=7` that task_2 sets.

Fix: Pin `vllm/vllm-openai:v0.31.0` by its multi-arch index digest
(linux/amd64 and linux/arm64; contains vllm#52816 for DFlash2) for
training and the smoke test, route the training checkpoints and the
drafter export through `global_vars.output_dir`, and train on block 8.

- `dflash.dflash_block_size=8` (was the recipe's 16), the block task_2
serves with `NUM_SPEC_TOKENS=7`. Block 8 also matches the library
default and the published DFlash2 drafters, and an ablation found no
acceptance-length cost (see Testing).
- Training output, `EXPORT_PATH`, and the smoke test's `DRAFT_MODEL` all
go through `global_vars.output_dir`, so one override moves producer and
consumer together. The smoke test writes `SMOKE_JSON` to its own
`/scratchspace`, so a rerun against an earlier export never replaces
that experiment's verdict.
- `TRITON_CACHE_DIR` keeps the launcher's default, the shared
`/cicd/triton-cache`, as on main. A node-local cache is opt-in: launch
with `TRITON_CACHE_DIR=/tmp/triton-cache`, as the header's third Usage
line shows.
- `dflash2.md` follows the new export path and notes that
`dflash_block_size` and `NUM_SPEC_TOKENS` change together.

### Usage

```bash
uv run launch.py --yaml examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml --yes
# rerun only the smoke test against an earlier experiment's export; its verdict lands in this experiment
uv run launch.py --yaml examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml \
    pipeline.global_vars.output_dir=/cicd/<experiment_id>/dflash2 \
    pipeline.task_0.skip=true pipeline.task_1.skip=true --yes
# Slurm with enroot < 4.0: run both vLLM tasks from a .sqsh built from the pinned digest
uv run launch.py --yaml examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml \
    pipeline.task_1.slurm_config.container=/path/to/vllm.sqsh \
    pipeline.task_2.slurm_config.container=/path/to/vllm.sqsh --yes
# opt-in node-local Triton cache instead of the launcher's shared /cicd/triton-cache
TRITON_CACHE_DIR=/tmp/triton-cache uv run launch.py \
    --yaml examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml --yes
```

### Testing

- On main (a8939992aa): launcher unit suite 241 passed, including the
new rerun test; the example resolves with --to-yaml; the pre-commit
hooks and markdownlint pass; the skill reference tests pass.
- GPU, hf_streaming_dflash2.yaml on OCI-JHB (GB300, aarch64, enroot
4.1.2): block 8, shortened to training.max_steps=1000 (16K sequences),
with output_dir=/scratchspace/dflash2_check and a node-local
`TRITON_CACHE_DIR=/tmp/triton-cache` (set in the YAML then; the opt-in
launch override now). 1 serve node (TP=4) + 1 trainer node (4-rank DDP):
1000 steps in 448 s, loss 9.41 → 2.37 (step 50 → 1000). The export has
DFlash2DraftModel and block_size 8. Smoke test (`NUM_SPEC_TOKENS=7`):
pass, mean AL 1.723 (gate 1.2, 8/8 prompts).
- Smoke-only rerun against that export
(output_dir=/cicd/<experiment_id>/dflash2_check, task_0 and task_1
skipped): pass, mean AL 1.723, served from
/cicd/<experiment_id>/dflash2_check/export. This ran before `SMOKE_JSON`
moved to `/scratchspace`, so it still overwrote the original verdict;
the new unit test covers the fix.
- Image: pyxis pulled the pinned digest on JHB (imported docker image:
vllm/vllm-openai:v0.31.0@sha256:c1c9f6fd…), but half of the direct pulls
failed with a Docker Hub 401 after enroot skipped the auth step, which
it does for tag references too. The passing runs above used a squashfs
imported from the same digest. Only arm64 ran; the amd64 entry was
checked with docker buildx imagetools inspect.
- Block-size ablation (OCI-JHB, GB300, dev budget, same data): run on
the online DFlash2 example, which this PR doesn't change, at block 8
against block 16. Bench AL 1.751/1.746/1.747 vs 1.753/1.759/1.758 at
C=1/8/32; speedup 1.40/1.41/1.18 vs 1.41/1.39/1.33 (one repeat; the C=32
gap comes from both arms' TPS moving); greedy exact match 0.956 vs
0.963. Loss and accuracy aren't comparable across block sizes (block 8
averages over fewer, easier positions).

### Before your PR is "*Ready for review*"

Make sure you read and follow [Contributor
guidelines](https://github.com/NVIDIA/Model-Optimizer/blob/main/CONTRIBUTING.md)
and your commits are signed (`git commit -s -S`).

Make sure you read and follow the [Security Best
Practices](https://github.com/NVIDIA/Model-Optimizer/blob/main/SECURITY.md#security-coding-practices-for-contributors)
(e.g. avoiding hardcoded `trust_remote_code=True`, `torch.load(...,
weights_only=False)`, `pickle`, etc.).

- Is this change backward compatible?: ❌ (the streaming example only; no
library or launcher code changes. Its export moves from
`/scratchspace/export` to `/scratchspace/dflash2/export`, so a
smoke-only rerun against an export from the previous layout uses
`output_dir=/cicd/<experiment_id>`; training checkpoints stay in
`/scratchspace/dflash2`. Its vLLM image is now pinned by digest, which
Slurm pulls only with enroot >= 4.0; older sites point both vLLM tasks'
`slurm_config.container` at a `.sqsh` built from the same digest, as the
example header shows. Both are recorded in `CHANGELOG.rst`.)
- If you copied code from any other sources or added a new PIP
dependency, did you follow guidance in `CONTRIBUTING.md`: N/A
- Did you write any new necessary tests?: ✅
`test_vllm_smoke_test.py::test_smoke_only_rerun_keeps_the_original_verdict`:
builds task_2 through the launcher's own `global_vars` interpolation and
the `/scratchspace` and `/cicd` mounts, then checks that a rerun failing
before vLLM starts leaves the earlier experiment's verdict intact,
writes its own verdict to its own `/scratchspace`, and records the
earlier export as its draft.
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
✅ 0.50.0 Backward Breaking Changes: the new export path and the `.sqsh`
route for enroot < 4.0.
- Did you get Claude approval on this PR?: ❌ - not yet run


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
* Updated the DFlash2 streaming guide and launcher example to use a
configurable output directory for training artifacts and the exported
drafter, defaulting to `/scratchspace/dflash2` (export path:
`/scratchspace/dflash2/export`).
* Clarified that the smoke-test result remains at
`/scratchspace/smoke_check.json`, regardless of the selected output
directory.
* Documented the required alignment between checkpoint and vLLM serving
block sizes.
* Added guidance on pinned vLLM images, multi-architecture support, and
node-local Triton caching. Pulling the pinned image through Slurm
requires enroot 4.0 or later; older versions can use a `.sqsh` image
built from the pinned digest.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Zhehao Hu <zhehaoh@nvidia.com>
2026-12-03 14:06:10 -08:00
..