Skip to content

[1/4] launcher: clean up the Qwen3-8B DFlash2 streaming example - #2932

Open
Zhehao-Hu wants to merge 5 commits into
mainfrom
zhehaoh/launcher-dflash2-examples
Open

Zhehao-Hu wants to merge 5 commits into
mainfrom
zhehaoh/launcher-dflash2-examples

Conversation

@Zhehao-Hu

@Zhehao-Hu Zhehao-Hu commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

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 (a893999): 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 and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (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?: ✅ 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

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.
    • Clarified that the smoke-test result remains at /scratchspace/smoke_check.json, regardless of the selected output directory.
    • Documented the required alignment between the checkpoint block size and the vLLM serving block size.
    • Added guidance on pinned vLLM images, multi-architecture support, node-local Triton caching, and using .sqsh images with older enroot versions.

@copy-pr-bot

copy-pr-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Qwen3-8B DFlash2 streaming example now derives training and export paths from a shared output directory and uses a pinned vLLM image for both tasks. Documentation describes the related block-size and enroot settings. Smoke-test coverage checks reruns against prior experiment results.

Changes: DFlash2 streaming launcher

Layer / File(s) Summary
Configure DFlash2 paths and serving
tools/launcher/examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml, skills/modelopt-speculative-decoding/references/algorithms/dflash2.md, CHANGELOG.rst
The example derives training and export paths from a shared output directory and uses the same pinned vLLM image for both tasks. The documentation describes block-size matching, enroot requirements, the .sqsh fallback, and the smoke-test result path.
Validate smoke-test reruns
tools/launcher/tests/test_vllm_smoke_test.py
The smoke-test helper uses the effective SMOKE_JSON setting. A regression test checks that an invalid rerun preserves an earlier passing verdict and writes an invalid_config verdict for the rerun.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: h-guo18

Merge Risk: Minimal · up to 0bc9c

This updates an example launcher configuration, its documentation and a regression test. The changelog flags the enroot 4.0 requirement and the export-path change. No concrete merge-blocking risk was found.

Security architecture risk: Low · up to 0bc9c

Smoke-only reruns keep their verdict separate from the earlier run, and both jobs use the same pinned image. The remaining risk is that selecting an earlier experiment also redirects training and export writes there if training is accidentally left enabled. Older clusters need the documented local-image fallback.

Retained concerns

  • Low · architecture · inferred: The override for consuming a prior experiment’s export also changes the producer’s write destination. If task_1 is not skipped and the job can write to that directory, training can modify prior checkpoints and, after successful training, export into the prior experiment. The base example’s fixed producer paths kept those writes in the current experiment. Explicitly skipping training prevents this producer path; isolating the verdict does not protect the export.
Security review details

Security Blast Radius

  • inferred — The added overwrite exposure is bounded by the submitting job’s ability to select an output directory and write to it. The change does not itself grant filesystem permission or establish cross-tenant reachability.

Trust Boundaries and Controls

  • inferred — For a separate smoke-only experiment, the recipe keeps verdict deletion and publication on the new run’s scratch mount. This is destination separation for the verdict, not a read-only mount or a permission boundary around the earlier experiment.

Resilience and Maintainability Implications

  • inferred — The unchanged verdict writer removes the old result before writing a replacement directly. Separate experiment scratch paths contain that behavior to each run, but interruption or concurrent execution targeting the same verdict path can leave a missing or incomplete result.

Hardening Proposals

  • proposed — Give smoke-only reruns a draft-source override that does not change training destinations, or reject prior-experiment output paths while training is enabled.
Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the Qwen3-8B DFlash2 streaming example, which is the main subject of the changeset. The changeset pins images to a digest, moves training and export output to output_dir, sets dflash_b…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns Passed The security anti-pattern check passes. The PR changes four files: CHANGELOG.rst, skills/modelopt-speculative-decoding/references/algorithms/dflash2.md, tools/launcher/examples/Qwen/Qwen3-8B/hf_stream…
Full details: Title check

Explanation

The title names the Qwen3-8B DFlash2 streaming example, which is the main subject of the changeset. The changeset pins images to a digest, moves training and export output to output_dir, sets dflash_block_size to 8, and keeps SMOKE_JSON in the rerun's own scratchspace. The title's 'clean up' wording is broad and does not name these specific changes, but it refers to a real part of the change and the title is not vague. The [1/4] prefix signals a multi-part series.

Full details: Security Anti-Patterns

Explanation

The security anti-pattern check passes. The PR changes four files: CHANGELOG.rst, skills/modelopt-speculative-decoding/references/algorithms/dflash2.md, tools/launcher/examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml, and tools/launcher/tests/test_vllm_smoke_test.py. A grep of every added line in the reviewed diff found no torch.load, numpy.load, allow_pickle, trust_remote_code, eval(), exec(), nosec, pickle, or weights_only. No pyproject.toml or requirements*.txt file changed, so criterion 6 does not apply. The only Python change is the test file. Its new test reads the example YAML, builds a SandboxPipeline, and calls subprocess.run with a list argument, which the listed criteria do not cover. No criterion is triggered.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3c815f8 and 0bc9cfe.

Files selected for processing: 4

  • CHANGELOG.rst
  • skills/modelopt-speculative-decoding/references/algorithms/dflash2.md
  • tools/launcher/examples/Qwen/Qwen3-8B/hf_streaming_dflash2.yaml
  • tools/launcher/tests/test_vllm_smoke_test.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from 3ac8822 to 9a9b3cc Compare October 22, 2026 17:59
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch 2 times, most recently from 2370f99 to efc7bce Compare October 22, 2026 22:09
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch 2 times, most recently from 390e821 to a2d6478 Compare October 23, 2026 00:09
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch from efc7bce to 82d5b56 Compare October 23, 2026 00:09
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from a2d6478 to dbddd39 Compare October 23, 2026 04:51
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch from 82d5b56 to 8a2bd57 Compare October 23, 2026 04:51
Zhehao-Hu added a commit that referenced this pull request Oct 23, 2026
…strict (#2839)

> **[1/8] Day-0 speculative-decoding readiness flow.** Merge in order 1
→ 8. Base: `main`.
> Series: [1/8] #2839 (this) · [2/8] #2930 · [3/8] #2931 · [4/8] #2932 ·
[5/8] #2933 · [6/8] #2934 · [7/8] #2935 · [8/8] #2936

### What does this PR do?

Type of change: Bug fix


[common/check_regression.py](https://github.com/NVIDIA/Model-Optimizer/blob/main/tools/launcher/common/check_regression.py)
gates DFlash-family training runs on final loss and accuracy. Four
things stopped that gate from catching a bad run:

1. **It read the wrong checkpoint on long runs.** `find_trainer_state()`
sorted `checkpoint-*` as strings, so `checkpoint-8000` ranked after
`checkpoint-12000` and an older checkpoint's metrics were checked. Any
run whose saved steps differ in digit count was affected; the ~92K-step
full DFlash2 recipe in `hf_online_dflash2.yaml` saves every 4000 steps.
It now sorts by step number.
2. **An unreadable run passed.** With thresholds set, a missing
`trainer_state.json`, or one with no training logs, only warned and
exited 0. An empty threshold variable (`MAX_FINAL_LOSS=""`) crashed on
`float('')`.
3. **A regression never failed the job.** `dflash_online_training.sh`
runs the check as `check_regression.py … || true`, so Slurm reports
`COMPLETED` even when the log says `REGRESSION`. The verdict also
existed only as log text.
4. **A crashed run was still graded.** The script's `ERR` trap only
records a failure, so after a failed `accelerate launch` it went on to
export and run the check, and a checkpoint that survived the crash could
pass.

Changes:

- `check_regression.py`:
  - Sorts checkpoints by step number.
- Fails when thresholds are set but there are no metrics to check,
including a `trainer_state.json` of the wrong shape. An empty threshold
variable counts as unset. A threshold that isn't a finite number (`7,0`,
`nan`) fails as `METRICS_MISSING`.
- A NaN or infinite value for a metric that has a threshold fails as
`TRAIN_REGRESSION`.
- Takes `--json <path>` and writes `{pass, failure_class, trainer_state,
metrics, thresholds, messages}` as strict JSON (non-finite metrics as
`null`). `failure_class` is `null`, `TRAIN_REGRESSION` or
`METRICS_MISSING`. The verdict is serialized before the file is opened,
so a failure can't leave a truncated file.
- Its existing log lines (`=== Regression Check (…) ===`, `PASS:` /
`REGRESSION:`, `Regression check PASSED`) are unchanged, so existing log
readers keep working. A failure now also prints `Regression check
FAILED`.
- `dflash_online_training.sh` writes the verdict to
`${OUTPUT_DIR}/regression_check.json`, next to the exports.
`REGRESSION_STRICT=1` drops the `|| true`, so a regression fails the
task through the existing `ERR` trap and `exit_handler`. **The default
(`0` or unset) is unchanged (warn only)**, so the other examples with
possibly uncalibrated thresholds don't start failing. Any other value
fails the task at startup, before installing or training.
- `dflash_online_training.sh` also skips export and the check when
training fails, still reporting the failure like any `ERR`-trap failure,
and removes an old `regression_check.json` first thing, so no early exit
can leave an earlier run's verdict behind.
- `examples/Qwen/Qwen3-8B/hf_online_dflash2.yaml`:
  - Sets `REGRESSION_STRICT: "1"`.
- Recalibrates `MAX_FINAL_LOSS` from 5.0 to 7.0. The 5.0 was inherited
from `hf_online_dflash.yaml`, whose own reference curve only drops below
5.0 at step ~2500 of a 12.5K-step run. DFlash2 adds a selector loss term
and this example stops at 2000 steps, so 5.0 fails every healthy run.
`MIN_FINAL_ACC` stays at 0.15.
- The `speculative-decoding` skill's `dflash.md` and `dflash2.md`
describe the new gate: judge a run by `regression_check.json`, the two
failure classes, strict mode, and DFlash2's 7.0 threshold.

### Usage

```bash
MAX_FINAL_LOSS=7.0 MIN_FINAL_ACC=0.15 \
  python3 common/check_regression.py /scratchspace/dflash2_bs16 --json /scratchspace/dflash2_bs16/regression_check.json
echo $?   # 0 pass, 1 regression or nothing to check
```

```yaml
environment:
  - MAX_FINAL_LOSS: "7.0"
  - REGRESSION_STRICT: "1"   # fail the training task on a regression
```

### Testing

- `tools/launcher/tests/test_check_regression.py`: 4 new test functions
(13 cases). Run against `main`'s `check_regression.py`, 17 of the file's
18 cases fail:
- `test_latest_checkpoint_is_chosen_by_step_number` guards the
string-sort bug.
  - `test_empty_threshold_var_is_unset` guards the `float('')` crash.
- `test_cli_exit_code_and_json_verdict` is parametrized over a missing
`trainer_state.json`, a truncated one, two of the wrong shape, a NaN
loss, an unchecked infinite metric, a regression and a pass. Each case
checks the exit code and parses the verdict as strict JSON, so it covers
the missing-metrics hole and the `--json` contract.
- `test_invalid_threshold_writes_failed_verdict` covers `7,0`, `nan` and
`inf`.
- `tools/launcher/tests/test_dflash_online_training.py` (5 cases) runs
the real script in a sandbox: stubbed `pip`, `nvidia-smi`, `accelerate`,
exporter and `torch`, a checkpoint, and an old passing verdict. Each
case asserts the exact exit code. Against `main`'s script, all 5 fail:
- A failing launch leaves no verdict and exits 1; a succeeding one
grades the checkpoint and exits 0 with no `ERR`-trap error.
- With a checkpoint over the threshold, `REGRESSION_STRICT=1` exits 1
and `0` exits 0, both writing `TRAIN_REGRESSION`.
- `REGRESSION_STRICT=true` exits 1 without launching training and leaves
no verdict.
- Full launcher suite on this commit: `uv run --with pytest python3 -m
pytest tests/`, 183 passed.
- `dflash_online_training.sh`: `bash -n` passes.
- **GPU (OCI-JHB, GB300, global batch 8):** five 2000-step runs of this
example with this change passed the strict gate. Final loss was
6.37–6.71 and accuracy 0.167–0.177, against 7.0 / 0.15. The calibration
run that motivated 7.0 (before this change) finished at 6.51 / 0.181.
The seed-to-seed spread puts the loss margin at about 4%; see the
variance note under Additional Information.
- Not run: the strict-failure path and a real training crash on GPU
(covered by the sandbox test above).

### 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?: ✅ (strict mode is opt-in; log
output unchanged)
- 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?: ✅
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: ❌ - not yet run

### Additional Information

- Part of the Day-0 speculative-decoding workflow: the `specdec-release`
skill ([8/8]) gates training on `regression_check.json`, so it needs a
verdict it can read and a job state that reflects it.
- **Why not reuse `day0-release/scripts/gate_run.py`?** The two sit at
different layers and check different things, so their schemas stay
independent on purpose:
- `gate_run.py` is an agent-side gate for an *evaluation* run. It reads
a run summary the agent builds from NEL output, and checks per-task
status, sample counts and judge errors. None of that exists for a
training run.
- `check_regression.py` runs *inside* the Slurm training task, on rank
0, and its verdict decides the task's exit status in strict mode. It
reads `trainer_state.json` against thresholds from the launcher YAML,
and has to work for launcher users who never load a skill. A launcher
script importing a skill script would also invert the dependency: skills
drive the launcher, not the other way round.
- The skill-side counterpart of `gate_run.py` for training is
`specdec-release/scripts/gate_train.py` ([6/8] #2934). It reads
`regression_check.json` and returns the day-0 gate shape (`{pass,
failure_class, detail, …}`), with `failure_class` from the shared triage
vocabulary. That is the adapter layer, so `check_regression.py` doesn't
need to match `gate_run.py`.
- What the two share is the convention: a boolean `pass`, and a
`failure_class` that is `null` on a pass. The launcher emits only
`METRICS_MISSING` and `TRAIN_REGRESSION`, and `gate_train.py` treats any
other value as `TRAIN_REGRESSION`, so the launcher can add detail fields
without breaking the gate.
- Other Qwen3-8B examples share the inherited `MAX_FINAL_LOSS: "5.0"`
(`hf_online_domino.yaml`, `hf_online_lilicorr.yaml`). They are left
unchanged and non-strict because there is no calibration run for them.
- Variance: a seed-1 retrain landed at loss 6.705, 4.2% under the 7.0
floor. Accuracy has more headroom (11%). Recalibrating from more seeds
is planned for the release gates, not this PR.


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

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Training runs with an output directory now produce a regression-check
verdict file reporting whether configured quality thresholds passed.
* Regression checks account for missing or invalid metrics and select
checkpoints by numeric step.

* **Bug Fixes**
* Failed training no longer proceeds to checkpoint export or regression
checks.
* Strict mode fails the task when regression checks fail; invalid
strict-mode values stop the run before training starts.

* **Documentation**
* Updated DFlash2 guidance and example settings for the final-loss
threshold and strict-mode behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Zhehao Hu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from dbddd39 to 6d46dab Compare October 23, 2026 21:24
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch from 8a2bd57 to 5b20c8d Compare October 23, 2026 21:24
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from 6d46dab to d217cd2 Compare October 23, 2026 21:35
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch from 5b20c8d to 406058d Compare October 23, 2026 21:35
Zhehao-Hu added a commit that referenced this pull request Oct 23, 2026
…ction (#2930)

> **[2/8] Day-0 speculative-decoding readiness flow.** Merge in order 1
→ 8. Base: `main` ([1/8] has merged).
> Series: [1/8] #2839 (merged) · [2/8] #2930 (this) · [3/8] #2931 ·
[4/8] #2932 · [5/8] #2933 · [6/8] #2934 · [7/8] #2935 · [8/8] #2936

### What does this PR do?

Type of change: Bug fix

The vLLM smoke test (`common/specdec/vllm_smoke_test.sh`) is the serving
check after draft training. It had six problems:

1. **It could serve the wrong checkpoint.** `ar_eval_mtbench.sh` and
`vllm_smoke_test.sh` picked the newest checkpoint by sorting on a
dash-separated field of the **whole path**, so a dash in a parent
directory (e.g. `/data/my-drafts/...`) picked the wrong one.
`quantize_drafter.sh` had a third, different sort. The smoke test also
ignored `exported-checkpoint-final`.
2. **Every throughput figure printed `?`.** Timing used `bc`, which the
vLLM image doesn't have.
3. **A drafter that never speculated passed.** With
`MIN_ACCEPTANCE_LENGTH` set, a vLLM log with no acceptance length only
warned.
4. **The acceptance length covered only the last few seconds.** It came
from the log's "Mean acceptance length" line, which covers only vLLM's
last logging interval.
5. **The verdict existed only as log text.**
6. **The server wait was fixed at 180 s.** Qwen3.8-27B with a DFlash2
drafter takes longer to start on GB300 (torch.compile, kernel JIT, CUDA
graph capture, GDN warmups), so every smoke attempt stopped at
`server_timeout`. The script's exit then tore the container down
mid-warmup, and the engine's next exec failed with a ptxas ENOENT that
read like the cause.

Changes:

- `service_utils.sh`: new `latest_checkpoint <dir> <prefix>`. It returns
`<dir>/<prefix>final` if present, else the highest numeric step, keyed
on the directory's own name. It replaces the three ad hoc sorts in
`ar_eval_mtbench.sh`, `vllm_smoke_test.sh` and `quantize_drafter.sh`.
- `vllm_smoke_test.sh`:
- Prefers `exported-checkpoint-final`, as `quantize_drafter.sh` already
did.
  - Times prompts with shell arithmetic and `python3` instead of `bc`.
- Computes the mean acceptance length over the whole run from vLLM's
cumulative `/metrics` counters: 1 +
`spec_decode_num_accepted_tokens_total` /
`spec_decode_num_drafts_total`.
- With `MIN_ACCEPTANCE_LENGTH` set, fails when no speculative drafts
were recorded.
- Fails loudly if `service_utils.sh` is missing (it used to be optional,
so the failure surfaced as a misleading `draft_missing`). Only a missing
file is fatal: `source` returns the status of the file's last command, a
rank-0 append that fails outside a launcher working directory.
- `SERVER_TIMEOUT` sets the server wait in seconds (default 180) and
appears in the timeout reason.
- Checks `MIN_ACCEPTANCE_LENGTH` (a finite number), and
`NUM_SPEC_TOKENS` and `SERVER_TIMEOUT` (positive integers without
leading zeros, since `NUM_SPEC_TOKENS` goes into vLLM's JSON config),
before any work, and fails with `stage: invalid_config` and a reason
naming the value. Both checks run after the `EXIT` trap is set, so even
these failures replace any earlier `SMOKE_JSON`.
- Optional `SMOKE_JSON=<path>` writes the verdict on every exit:
`{stage, pass, reason, method, target, draft, num_speculative_tokens,
prompts passed/failed, tokens, average tok/s, mean_acceptance_length,
min_acceptance_length}`. `stage` says how far it got (`invalid_config`,
`starting`, `draft_missing`, `server_died`, `server_timeout`, `serving`,
`completed`), so a downstream gate can tell "not servable" from "below
the floor". The file's parent directory is created if needed, and it is
strict JSON (a non-numeric value is written as `null`). The mean
acceptance length is checked against the floor and written at full
precision; only the log rounds it.

### Usage

```yaml
task_2:
  script: common/specdec/vllm_smoke_test.sh
  environment:
    - HF_MODEL_CKPT: <<global_vars.hf_model>>
    - DRAFT_CKPT_DIR: <<global_vars.output_dir>>      # newest export, final preferred
    - SPEC_METHOD: "dflash"
    - NUM_SPEC_TOKENS: "7"
    - MIN_ACCEPTANCE_LENGTH: "1.5"
    - SMOKE_JSON: <<global_vars.output_dir>>/smoke_check.json
    - SERVER_TIMEOUT: "900"                            # optional; default 180 s
```

### Testing

- `tools/launcher/tests/test_service_utils.py`: `latest_checkpoint` with
a dash in a parent directory, `final` winning over steps, numeric rather
than string order, and no checkpoint at all (3 cases).
- `tools/launcher/tests/test_vllm_smoke_test.py` runs the script as rank
0 from a directory with no `modules/` (stubbed `pip` and `nvidia-smi`),
up to the paths that stop before vLLM starts (6 cases). Against the
script without these fixes, all 6 fail:
  - It reaches `draft_missing` rather than stopping at `source`.
- `MIN_ACCEPTANCE_LENGTH` of `1,5` or `nan`, `NUM_SPEC_TOKENS` of `x` or
`08` and `SERVER_TIMEOUT=15m` each fail as `invalid_config` with a
strict-JSON `SMOKE_JSON`. Before, `NUM_SPEC_TOKENS=x` crashed in the
`EXIT` trap and wrote no JSON.
- `bash -n` on all four scripts. Launcher unit suite on this commit: 192
passed.
- **GPU (OCI-JHB, GB300, vLLM v0.31.0)**, through
`hf_online_dflash2.yaml`'s smoke task ([4/8]) and one smoke-only
submission, six runs in all:
- `latest_checkpoint` picked `exported-checkpoint-final` in every
training run.
- Per-prompt tok/s printed (e.g. 335 tok/s average), 8/8 prompts passed.
- Mean acceptance length 1.68–1.79 against the 1.5 floor;
`smoke_check.json` written each time.
- **GPU, Qwen3.8-27B + DFlash2 (same cluster and image):** four smoke
runs at the old fixed 180 s each wrote `smoke_check.json` with `stage:
server_timeout`. A fifth with `SERVER_TIMEOUT=900` passed at AL 1.76.
- Not run on GPU:
- the `server_died` and no-drafts failure paths. They exit through the
same `write_smoke_json` trap as the passing path;
- creating `SMOKE_JSON`'s parent directory. A smoke-only run hit the
missing directory before this was added; the rerun used an existing
directory.

### 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?: ✅ (`SMOKE_JSON` is optional. With
`MIN_ACCEPTANCE_LENGTH` set, a run with no speculative drafts now fails
instead of passing; that was the bug.)
- 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?: ✅ (`latest_checkpoint`; the
smoke script itself is validated on GPU as above)
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: ❌ - not yet run

### Additional Information

- The `specdec-release` skill's `gate_smoke.py` ([6/8]) reads
`SMOKE_JSON`.



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

## Summary by CodeRabbit

* **Improvements**
* Checkpoint selection now prefers a `final` checkpoint, or otherwise
chooses the highest-numbered checkpoint.
* Smoke tests validate numeric settings, use a configurable server
timeout, and report run results, failure reasons, and performance
metrics in an optional JSON file.
* Acceptance-length checks now use cumulative draft and accepted-token
counts; prompt failures and unmet acceptance thresholds result in a
failed test.
* **Tests**
* Added coverage for checkpoint selection and smoke-test configuration
failures.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Zhehao Hu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from d217cd2 to 84467d2 Compare October 28, 2026 00:21
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch 3 times, most recently from 31492d3 to 63cd8b7 Compare October 29, 2026 03:44
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from 5a934fc to c4bd17a Compare October 29, 2026 03:55
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch from 63cd8b7 to c94c6c9 Compare October 29, 2026 04:53
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from c4bd17a to 1a782b1 Compare October 29, 2026 04:53
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash-reexport branch from 1a782b1 to abe2e9f Compare October 29, 2026 04:59
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch 2 times, most recently from 3c3c72e to 59191c0 Compare October 29, 2026 21:43
Zhehao-Hu added a commit that referenced this pull request Nov 4, 2026
…raining (#2931)

> **[3/8] Day-0 speculative-decoding readiness flow.** Merge in order 1
→ 8. Base: `main` ([1/8] and [2/8] have merged).
> Series: [1/8] #2839 (merged) · [2/8] #2930 (merged) · [3/8] #2931
(this) · [4/8] #2932 · [5/8] #2933 · [6/8] #2934 · [7/8] #2935 · [8/8]
#2936

### What does this PR do?

Type of change: Bug fix

After training, `dflash_online_training.sh` exports each saved
checkpoint, but it skipped any `exported-checkpoint-*` directory that
already existed. Two cases left a bad export in place:

1. **An export interrupted mid-write was never redone.** A preempted or
timed-out job left a directory with weights and no `config.json`, or an
empty or truncated one (the exporters open it before serializing), and
every later run skipped it.
2. **A resumed run kept the previous `exported-checkpoint-final`,** even
though training had moved on.

Changes:
- **Completion check:** an export counts as done only when its
`config.json` parses to a non-empty object. Both writers
(`DFlashExporter.export` and `DFlashFSDP2ShardedSDExportCallback`) write
it after the weights, so a valid config means the export finished.
- **Scratch export and rollback:** each export is written to `<dir>.tmp`
and published only on success, so readers never see a partial export.
The previous export is set aside as `<dir>.old` until the new one is in
place: a failed export or publish keeps it, and the next run restores it
if a job stopped mid-swap. `latest_checkpoint` ignores both suffixes.
- **Sharded checkpoints:** the full-HF exporter cannot load FSDP2
shards, so an incomplete export of a sharded checkpoint is skipped with
a warning, not re-exported. If it is the newest checkpoint and no
current final export will be served, the task fails: otherwise
`latest_checkpoint` would serve an older draft than the one the
regression check graded.
- **Final export:** `exported-checkpoint-final` is exported only when
the root model was saved no earlier than the newest checkpoint, and
redone when `modelopt_state.pth` is newer than its `config.json`.
Otherwise `latest_checkpoint` would serve an obsolete final over the
newest step, so it is removed once the newest step's export is complete.

### Usage

No new options. Re-running or resuming a training task now repairs
partial or stale exports.

### Testing

- `bash -n` passes. Launcher unit suite on this commit: 229 passed.
- `test_dflash_online_training.py` runs the real script on seeded output
dirs: absent, empty, truncated and valid configs; an incomplete sharded
newest export beside a leftover obsolete final (the task fails), and an
incomplete sharded export beside a complete newest export or a current
final (the task passes); stale, current and obsolete final exports,
including whether `latest_checkpoint` then serves the final or the
newest step; a failed export or publish that keeps the old final; a run
stopped mid-swap; and a repeat run that exports nothing new. The
failed-publish, mid-swap recovery and selective-FSDP cases fail on the
previous commit.
- **GPU (OCI-JHB, GB300):** four fresh 2000-step
`hf_online_dflash2.yaml` runs exported `checkpoint-2000` and `final`
through this path as first posted (before the review fixes), and the
smoke test served the result each time. Not rerun on GPU since.
- Not run on GPU: the repair paths themselves (an interrupted export, or
a stale `final` after a resume). The sandbox tests cover the decisions
they make.

### 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?: ✅
- 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?: ✅
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: ❌ - not yet run

### Additional Information

- The `specdec-release` skill ([8/8]) freezes and benchmarks
`exported-checkpoint-final`, so a stale or partial `final` would be
measured as the new drafter.


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

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Model exports are now checked for completeness before they’re
accepted, helping prevent incomplete or invalid exports from being
treated as ready.
* Interrupted exports can be recovered, and existing usable exports are
preserved when a replacement fails.
* Checkpoint and final exports are reused or refreshed based on whether
they’re complete and current. Incomplete exports from sharded
checkpoints are ignored.
* Export or recovery failures now stop processing instead of reporting
success.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Zhehao Hu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Base automatically changed from zhehaoh/launcher-dflash-reexport to main November 4, 2026 18:06
The Day-0 speculative-decoding workflow copies this example as its
streaming template, but it floats on vllm/vllm-openai:latest and :nightly
and writes its export to a fixed /scratchspace path, so a run can't be
reproduced or its smoke test re-run against an earlier export. It also
trains on 16-token blocks, while vLLM serves DFlash2 with a block of
1 + num_speculative_tokens and ignores the checkpoint's block_size.

- Pin vllm/vllm-openai:v0.31.0 (multi-arch, contains vllm#52816 for
  DFlash2) for training and the smoke test.
- Route every artifact path through global_vars.output_dir (training
  output, EXPORT_PATH, the smoke test's DRAFT_MODEL and SMOKE_JSON), so one
  override moves the producer and its consumer together.
- Train with dflash_block_size 8, the block vLLM serves with the smoke
  test's NUM_SPEC_TOKENS 7. A dev-budget ablation on the online example
  gave the same acceptance length at block 8 and 16 (1.75 at concurrency
  1/8/32), and 8 matches the library default and the published DFlash2
  drafters.
- Set TRITON_CACHE_DIR node-local.
- Update dflash2.md for the streaming example's new export path, and note
  that dflash_block_size and NUM_SPEC_TOKENS change together.

Signed-off-by: Zhehao Hu <[email protected]>
@Zhehao-Hu
Zhehao-Hu force-pushed the zhehaoh/launcher-dflash2-examples branch from 59191c0 to c456ded Compare November 19, 2026 18:57
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.66%. Comparing base (a893999) to head (0bc9cfe).
⚠️ Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2932      +/-   ##
==========================================
- Coverage   79.44%   78.66%   -0.78%     
==========================================
  Files         721      731      +10     
  Lines       81563    85207    +3644     
==========================================
+ Hits        64795    67029    +2234     
- Misses      16768    18178    +1410     
Flag Coverage Δ
regression 14.95% <ø> (-0.01%) ⬇️
unit 64.74% <ø> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zhehao-Hu Zhehao-Hu changed the title [4/8] launcher: clean up the Qwen3-8B DFlash2 launcher examples [1/4] launcher: clean up the Qwen3-8B DFlash2 streaming example Nov 19, 2026

@cjluo-nv cjluo-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review (gpt-6.1-sol) — DM the bot to share feedback.

Changes requested: the Docker Hub image references omit the immutable digests required by CONTRIBUTING.md.

Needs action:

  • Pin both vLLM containers in hf_streaming_dflash2.yaml to the same multi-architecture manifest digest; see the inline comment.
  • Validate a short streaming train → export → smoke run with the pinned image and an overridden output directory, plus a smoke-only rerun; record results in the PR's Testing section.

- training.training_seq_len=4096
# The recipe trains 16-token blocks, but vLLM serves DFlash2 with a block of
# 1 + NUM_SPEC_TOKENS (7 in task_2) and ignores the checkpoint's block_size.
# Train on that block, and change both together.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot comment.

[P2] Exercise the changed streaming runtime before treating testing as N/A. The reported block-size ablation uses hf_online_dflash2.yaml, which never runs this RDMA producer or the streaming export/smoke pipeline. I checked test_examples_resolve.py (YAML structure only), test_vllm_smoke_test.py (stops before vLLM starts), and the connector GPU tests (synthetic scheduler/cache inputs); none verifies this pinned image through these tasks. Please run a shortened task_1 → task_2 integration check at block 8 with a nondefault output directory, then rerun task_2 against that export and record the smoke JSON/acceptance result. This targets the image/connector/export contract without requiring another full convergence ablation or tests that merely assert YAML constants.

CONTRIBUTING.md asks for Docker Hub images to be pinned by digest. Pin
both vLLM tasks to v0.31.0's multi-arch index digest, which covers
linux/amd64 and linux/arm64, and note in the header that pulling by
digest under Slurm needs enroot 4.0 or later.

Signed-off-by: Zhehao Hu <[email protected]>

@cjluo-nv cjluo-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review (gpt-6.2-sol) — DM the bot to share feedback.

Changes requested: the documented smoke-only rerun overwrites the original experiment’s verdict.

Needs action:

  • Write task_2’s SMOKE_JSON under the current experiment’s /scratchspace; use global_vars.output_dir only to locate the draft on a smoke-only rerun.
  • Add a launcher regression check that a smoke-only rerun leaves the original verdict intact and writes its own verdict, including on failure.
  • Document the same-digest .sqsh override for both vLLM tasks on Slurm with enroot < 4.0, and note the new direct-pull requirement in the compatibility checklist.

No action needed:

  • ✔️ Both prior critical findings are addressed: both tasks use the same multi-arch digest, and the author reports a block-8 streaming train → export → smoke run and a smoke-only rerun using that digest’s ARM64 squashfs (mean acceptance length 1.723 in both).
  • Source review against main; exact base SHA unavailable. GPU runs were not independently repeated.

The documented smoke-only rerun points global_vars.output_dir at an
earlier experiment's /cicd/<experiment_id>/dflash2 to reuse its export,
but task_2 also wrote SMOKE_JSON there. vllm_smoke_test.sh deletes
SMOKE_JSON before it starts, so a failed rerun erased the earlier PASS.

- Write SMOKE_JSON to the run's own /scratchspace; output_dir now only
  locates the draft.
- Test that the documented rerun, failing before vLLM starts, leaves
  the earlier verdict intact.
- Document running both vLLM tasks from a .sqsh built from the pinned
  digest on Slurm sites with enroot < 4.0.

Signed-off-by: Zhehao Hu <[email protected]>

@cjluo-nv cjluo-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review (gpt-6.2-sol) — DM the bot to share feedback.

Changes requested: the smoke-only rerun now writes to the right place, but the regression test does not check either experiment’s actual verdict path.

Needs action:

  • 💬 The new regression test covers the earlier output_dir mistake — exercise the launcher’s real interpolation and verify the prior verdict, the new failure verdict, and the resolved draft path. See inline.
  • 💬 The YAML now documents both .sqsh overrides — update the PR’s compatibility checklist for enroot < 4.0 and remove the stale claim that SMOKE_JSON follows output_dir.
  • ✂️ Compress dflash2.md by giving the full streaming export path once and using Success markers to point to the smoke verdict.

No action needed:

  • ✔️ Resolved: matching immutable image pins, reported ARM64 train→export→smoke and smoke-only runs, verdict isolation in the YAML, and the older-enroot workaround in the example.
  • The _run helper change enables path overrides without weakening existing assertions. Source review against main; exact base SHA unavailable and tests not independently rerun.

value = re.sub(r"<<global_vars\.(\w+)>>", lambda m: global_vars[m.group(1)], value)
# The rerun's own /scratchspace and the /cicd view of earlier experiments.
env[key] = re.sub(r"^/(scratchspace|cicd)\b", lambda m: str(tmp_path / m[1]), value)
original = tmp_path / "cicd/earlier/dflash2/smoke_check.json"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot comment.

[P2] Seed the verdict at the prior experiment’s actual path, cicd/earlier/smoke_check.json, and assert the failed rerun writes scratchspace/smoke_check.json. The current fixture seeds cicd/earlier/dflash2/smoke_check.json, and _run() reads whatever path it receives, so the test would pass if task_2 overwrote the real prior verdict. Use SandboxPipeline/GlobalVariables for interpolation instead of duplicating it, and check result['draft'] points to cicd/earlier/dflash2/export (the exit handler records the draft even on invalid config).

| --- | --- | --- |
| Online | `<training.output_dir>/exported-checkpoint-{<step>,final}` | training progress only |
| Streaming | `/scratchspace/export` | task_2's acceptance length against `MIN_ACCEPTANCE_LENGTH` |
| Streaming | `<global_vars.output_dir>/export` (`/scratchspace/dflash2/export`) | task_2's acceptance length against `MIN_ACCEPTANCE_LENGTH` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot comment.

Keep the full streaming export path in the task table above. Here, point to task_1’s export and name the separate smoke verdict at /scratchspace/smoke_check.json rather than repeating the full export path.

Build task_2's environment through SandboxPipeline's own global_vars
interpolation, lay out the folders as build_slurm_executor() mounts
them, and seed the earlier experiment's verdict where it really lands
(its /scratchspace). A failed rerun must leave that verdict alone,
write its own to the rerun's /scratchspace, and record the earlier
experiment's export as its draft.

Point dflash2.md's streaming success marker at task_1's export and the
smoke verdict instead of repeating the export path.

Signed-off-by: Zhehao Hu <[email protected]>

@cjluo-nv cjluo-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review (gpt-6.2-sol) — DM the bot to share feedback.

Changes requested: both vLLM tasks now ignore the launcher's existing TRITON_CACHE_DIR override.

Needs action:

  • Preserve caller-selected Triton cache paths in hf_streaming_dflash2.yaml while keeping a node-local option. See inline.
  • 💬 The PR body now documents the .sqsh workaround and separate verdict; mark the example changes as not backward compatible and limit the output_dir claim to checkpoints and the drafter export.
  • Add a short CHANGELOG.rst migration note for the new default export path and the pre-enroot-4.0 .sqsh workaround, per AGENTS.md.

No action needed:

  • ✔️ Six prior concerns addressed, including the verdict overwrite and the regression test’s use of both experiments’ actual verdict paths.
  • The _run refactor enables path overrides without weakening existing assertions. Source review against main; exact base SHA unavailable. Unit and ARM64 GPU results are author-reported.

# Where the drafter is exported (train_eagle_streaming.sh defaults to /scratchspace/export).
- EXPORT_PATH: <<global_vars.output_dir>>/export
# Node-local: a shared Triton cache breaks when jobs on different nodes write it.
- TRITON_CACHE_DIR: /tmp/triton-cache

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot comment.

[P2] Preserve the existing cache-path override. get_default_env() in tools/launcher/core.py explicitly honors a caller’s TRITON_CACHE_DIR, but run_jobs() merges task environment last. This entry and task_2’s therefore replace even an explicitly selected writable node-local directory with /tmp/triton-cache. Could the example document the existing TRITON_CACHE_DIR launch override instead, or provide a node-local default that keeps explicitly selected paths working?

# DFlash2 uses a custom modeling file; export must trust remote code.
- EXPORT_EXTRA_ARGS: "--trust_remote_code"
# Where the drafter is exported (train_eagle_streaming.sh defaults to /scratchspace/export).
- EXPORT_PATH: <<global_vars.output_dir>>/export

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot comment.

The new export location is intentional, but consumers still looking at /scratchspace/export will no longer find new exports there. Likewise, the old direct-pull invocation now needs a .sqsh override on pre-4.0 enroot. Keep the migration paths in the example and record these as example-level backward-breaking changes in the checklist and CHANGELOG.rst.

A TRITON_CACHE_DIR in a task's environment overrides the one the
launcher takes from the caller's shell, so the example's node-local
setting could only be changed by editing the YAML. Drop both task
entries so the launcher's value applies again (/cicd/triton-cache, or
the caller's TRITON_CACHE_DIR), and show in the header how to launch
with a node-local /tmp/triton-cache.

Add a Backward Breaking Changes entry for the example's new export path
and for its digest-pinned vLLM image, which Slurm pulls only with
enroot 4.0 or later.

Signed-off-by: Zhehao Hu <[email protected]>

@cjluo-nv cjluo-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review (gpt-6.2-sol) — DM the bot to share feedback.

Changes requested: the PR description still marks the streaming example as backward compatible despite the export move and the new enroot requirement for direct pulls.

Needs action:

  • 💬 The checklist now explains both migrations but still says ✅. Mark the example backward-incompatible, consistent with CHANGELOG.rst.
  • 💬 The detailed path bullet is correct. Replace “every artifact path” in the PR description with checkpoints and drafter export; the smoke verdict stays in the current run’s /scratchspace.
  • Describe the node-local TRITON_CACHE_DIR as opt-in in the PR description; the default is still shared /cicd/triton-cache.
  • Clarify in the PR description that the served block of 8 uses NUM_SPEC_TOKENS=7, as set in task_2.

No action needed:

  • ✔️ Eight prior concerns addressed, including matching image digests and regression coverage that verifies both experiments’ verdict paths.
  • The _run refactor allows path overrides without weakening existing assertions. Source review against main; exact base SHA unavailable. Unit and ARM64 GPU results are author-reported.

@Zhehao-Hu
Zhehao-Hu requested a review from cjluo-nv November 24, 2026 01:44
@Zhehao-Hu
Zhehao-Hu marked this pull request as ready for review November 24, 2026 19:36
@Zhehao-Hu
Zhehao-Hu requested review from a team as code owners November 24, 2026 19:36
- training.output_dir=/scratchspace/dflash2
- training.output_dir=<<global_vars.output_dir>>
- training.training_seq_len=4096
# The recipe trains 16-token blocks, but vLLM serves DFlash2 with a block of

@h-guo18 h-guo18 Nov 25, 2026 •

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.

Good catch. Shall we remove this comment since it's about debugging process?

# cluster's architecture (enroot import on a host with enroot >= 4.0) and point both vLLM
# tasks at it, as in the second Usage line.
#
# Usage:

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.

Bot spotted, human reviewed.

[Nit] The Usage block now lists three commands that are alternatives (default / prebuilt .sqsh / node-local Triton cache; the last two can be combined), but nothing says so, and the header text refers to them by position ("the second Usage line", "the third Usage line"). A reader can take them for sequential steps, and inserting a line later silently breaks those references.

Suggest labelling each variant and referring to it by label, e.g.:

# Usage (pick one; the last two can be combined):
#   default:
#     uv run launch.py ...
#   enroot < 4.0 or Docker Hub pull failures (prebuilt .sqsh):
#     uv run launch.py ... container=/path/to/vllm.sqsh ...
#   node-local Triton cache:
#     TRITON_CACHE_DIR=/tmp/triton-cache uv run launch.py ...

and have the paragraphs above say "the .sqsh Usage variant" / "the node-local-cache variant".

@h-guo18 h-guo18 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.

Thanks! Left some nit-picking about code comments. Other changes lgtm

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.

3 participants