Commit a856383
committed
feat(model): DeepSeek-V4-Flash W6 — sqrtsoftplus + hash-routed MoE host ref + unit gate
The three genuinely-new-vs-V2/V3 MoE pieces of DeepseekV4ForCausalLM, as
portable host (CPU) references + unit gate (additive, SACRED-inert). Only the
NEW scoring + hash-route + clamp are net-new; the shared DeepSeek grouped-GEMM /
256-expert / shared-expert / NVFP4 machinery is REUSED, not re-ported.
New TUs deepseek_v4_moe.{h,cpp} (ported 1:1 with file:line, vLLM primary +
SGLang v0.5.15 cross-ref):
- SqrtSoftplus <- fused_topk_bias_router.py:88 (sqrt(softplus(x)) router score,
distinct from V2/V3 sigmoid/softmax noaux_tc).
- SqrtSoftplusRouteTopk <- fused_topk_bias_router.py:75-118
(_topk_softplus_sqrt_torch) + hash branch :100-106 + hash-table wiring
nvidia/model.py:562-578,:686,:696-717: bias for SELECTION ONLY, weights
gathered from the UNBIASED scores, the tid2eid token-id->expert HASH lookup
that BYPASSES top-k, renormalize, routed_scaling_factor.
- ClampedSwiGLU <- activation.py:197-201 (SiluAndMulWithClamp): gate max-only,
up both-sided, gate*sigmoid(a*gate)*(up+b).
MegaMoE is SM100-only (major==10) so this mirrors the FusedMoE-fallback router
GB10 runs; the device kernels reuse the existing grouped-GEMM and the forward
assembly is a W7 residual.
Gate: test_deepseek_v4_moe 12/12 cases / 716 assertions GREEN (CPU Debug;
new TUs -Wall -Werror -Wextra-clean). Hand-derived literals (sqrt-softplus
composition, bias-flips-selection-but-weight-stays-unbiased, hash bypass,
asymmetric clamp, clamp boundaries, alpha/beta) + from-first-principles
double-precision references. RED-first PROVEN all three levers: drop sqrt
fails 8/493, biased-weight-gather fails 2/181, symmetric gate-clamp fails 2/6;
revert restores 12/12. Honest gate form: host-reference + hand-case +
structural review (fixed-config 167B not constructible at a tiny shape).
Full-model gate stays multi-Spark-blocked (156.7 GiB).
SACRED-inert: no existing forward touched; test_deepseek_v4_mhc 14/14,
test_deepseek_v4_compressor 12/12, test_deepseek_v4_dsa 13/13,
test_deepseek_v4_scaffold 4/4 unchanged. New kernel row
KERNEL-MOE-SQRTSOFTPLUS-HASH (SPIKE); checker count 41->42. Records updated:
model-matrix, kernel-matrix, feature-matrix, roadmap_v1, coordination
(CLAIM-DEEPSEEK-V4-W6), parity-ledger, state, docs/STATUS, docs/BENCHMARKS,
spec §W6. All record checkers rc=0.
FOLLOWING_AGENTS_PROTOCOL
Assisted-by: Claude Code:claude-opus-4-8 [ClaudeCode]1 parent 5b843be commit a856383
16 files changed
Lines changed: 801 additions & 7 deletions
File tree
- .agents
- specs
- docs
- include/vllm/model_executor/models
- scripts
- src/vllm/model_executor/models
- tests
- vllm/models
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
0 commit comments