Repository navigation
[1/2] Support streaming teacher features for Megatron EAGLE3 - #3473
WEIXILIN0307 wants to merge 2 commits into
Conversation
Signed-off-by: WEIXILIN0307 <[email protected]>
Pre-merge checks:
|
| Check name | Status | Explanation |
|---|---|---|
| Security Anti-Patterns | Summary: No security anti-pattern from the custom check appears in the lines this PR adds. Scope: The PR adds two commits to the speculative-decoding code, 49304a5 and 0e6a792. I diffed them again… |
Full details: Security Anti-Patterns
-
Explanation
Summary: No security anti-pattern from the custom check appears in the lines this PR adds. Scope: The PR adds two commits to the speculative-decoding code, 49304a5 and 0e6a792. I diffed them against their parent, fe3dab7. The changed files are CHANGELOG.rst, examples/speculative_decoding/README.md, hf_streaming_dataset.py, megatron_eagle.py, and four test files. The local origin/main is older than the PR base, so a diff against origin/main also shows unrelated commits. I excluded those. Checks against the six criteria: 1. torch.load with weights_only=False: no match in added lines. 2. numpy.load with allow_pickle=True: no match. The word "pickle" does not appear in added lines. 3. trust_remote_code=True: no match in added lines, including the README and Python files. 4. Builtin eval() or exec() on external input: no match. The only hits are
.bfloat16().eval()(nn.Module.eval, in a test/model setup) and a chained.eval(). Both put a model in evaluation mode and do not evaluate strings. 5. "# nosec": no match. 6. Dependency changes: no changes to pyproject.toml or requirement files in the PR commits. Also scanned for subprocess, shell=True, yaml and marshal in added lines. No matches. Limitations: I used grep-based pattern matching on the diff. I did not run Bandit or inspect the full files.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Signed-off-by: WEIXILIN0307 <[email protected]>
Summary
Provide fixed-length BF16 teacher features to offline Megatron-LM EAGLE3 using the existing ModelOpt vLLM HTTP/NIXL reader. The adapter supplies aligned token IDs, an unshifted loss mask and feature rows. The Megatron EAGLE forward applies the checkpoint's final norm to a streamed pre-norm residual before the teacher LM head.
Interface contract
S, emitS+1token IDs and mask entries andSBF16 rows in each feature tensor. Padded features and mask entries are zero. Megatron-LM shifts IDs and supervision once to form next-token labels.[1, 13, 24]map to vLLM completed-layer captures[2, 14, 25, 28]. Use matching teacher weights and tokenizer. Disk-backed post-norm features use the default forward path.[blocks, tokens, planes, hidden]or[blocks, planes, tokens, hidden]. Set a block size distinct from the number of capture planes. Disable chunked prefill and prefix caching to capture the entire prompt in one scheduler step. Provide a capture slot of at leastStokens and a context limit of at leastS+1for the one-token completion request.Reproduction
Start the BF16 Qwen3 teacher on its own GPU with the documented vLLM configuration. Set
TEACHER_MODELto the same local weights directory. Run the real-service test on a second GPU. Server command and capture settingsCUDA_VISIBLE_DEVICES=1 NIXL_BACKENDS=UCX UCX_TLS=tcp,sm,self,cuda_copy \ EAGLE_STREAMING_TEST_URL=http://127.0.0.1:18876 EAGLE_STREAMING_TEST_TEACHER="$TEACHER_MODEL" \ pytest -q tests/gpu_vllm/torch/speculative/plugins/test_rdma_hidden_states_connector.py \ -k live_megatron_streamValidation
Related work
Refs #3349. The companion Megatron-LM draft owns trainer selection and batching. The RFC contains the full online throughput, end-to-end command time, memory, training loss and acceptance length comparison. Megatron-LM #9550 · RFC #3474
Before this PR is ready for review