feat(speculative): add Qwen3 dense target support for EAGLE-1/2/3#2313
Open
khazic wants to merge 2 commits into
Open
feat(speculative): add Qwen3 dense target support for EAGLE-1/2/3#2313khazic wants to merge 2 commits into
khazic wants to merge 2 commits into
Conversation
Contributor
|
/ok to test b3d018c |
b3d018c to
ee3bdc3
Compare
Contributor
|
/ok to test ee3bdc3 |
fa4074f to
0be62cc
Compare
Contributor
|
/ok to test 0be62cc |
Register ``Qwen3ForCausalLM`` in the EAGLE dense draft dispatch table.
Qwen3 already works through the existing config-driven draft path:
``head_dim`` is read via ``getattr(config, "head_dim", ...)`` (Qwen3
decouples it from ``hidden_size / num_attention_heads``), and
``attention_bias`` / ``mlp_bias`` are read via ``getattr(..., False)``
so Qwen3's config exposes them correctly. No code-path changes
required; just an allowlist entry plus example configs and docstrings.
- registry.py: append "Qwen3ForCausalLM" to ``_DENSE_ARCHITECTURES``.
- Add example YAMLs: ``qwen3_eagle{1,2,3}_perfectblend.yaml``.
- Update docstrings (draft modules + recipes) to mention Qwen3.
End-to-end smoke-tested on 8x H100 with Qwen/Qwen3-8B target on a
PerfectBlend 200-sample slice (EAGLE-3, 25 steps): loss decreases
9.85 -> 6.18 (~37% drop), train_acc ticks up from 0 to ~0.09. No
construction-time / load-time errors.
Signed-off-by: khazic <khazzz1c@gmail.com>
EAGLE-3 draft reads ACT2FN[config.hidden_act] from the target config, but EAGLE-1/2 draft hardcoded nn.SiLU(). All currently registered dense architectures (Llama / Phi-3 / Qwen3) happen to use silu, so the hardcode is correct today. However, the dense registry is intended to grow to cover non-SiLU families next (e.g. Gemma uses gelu_pytorch_tanh). With the hardcode in place, registering such an architecture would silently mismatch the target's activation: no crash, no error, training still converges, but draft hidden states drift from target and speculative acceptance rate quietly drops with no observable symptom. Read hidden_act from config so the draft matches the target by construction and adding new architectures stays a one-line registry change. Signed-off-by: khazic <khazzz1c@gmail.com>
0be62cc to
ef5eb6c
Compare
Contributor
|
/ok to test ef5eb6c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Add Qwen3 (
Qwen3ForCausalLM) as a supported target for EAGLE-1 /EAGLE-2 / EAGLE-3 training. Stacked on top of #2312 (Phi-3 support);
the actual Qwen3-specific delta is one registry entry + three example
configs + docstring updates.
Changelog (Qwen3 delta only)
components/speculative/eagle/registry.py: appendQwen3ForCausalLMto_DENSE_ARCHITECTURES. Qwen3 already worksthrough the existing config-driven draft path -- it decouples
head_dimfromhidden_size / num_attention_heads, which theattention layer already reads via
getattr(config, "head_dim", ...);attention_biasandmlp_biasare exposed onQwen3Configso they are read normally.examples/speculative/eagle{1,2,3}/qwen3_eagle{1,2,3}_perfectblend.yaml.No code-path changes were required. The registry dispatch already
exists from #2312.
Verification
End-to-end smoke test on 8 x H100:
Qwen/Qwen3-8B(15.26 GB, 8.19 B params,model_type=qwen3).Loss decreases
9.85 -> 6.18over 25 steps (~37% drop), accuracy ticksup from
0to~0.09. NoTypeError/AttributeErroratdraft construction, target load (Liger applied to
model type: qwen3without complaint), or training step.
Before your PR is "Ready for review"
Pre checks:
multi-GPU + a real Qwen3 target; smoke-test evidence above.
examples/speculative/eagle{1,2,3}/.