mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3589] [Engine] DeepSeek V4-Flash (deepseek4) as a second model family #4702
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4702
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3589
Author: @JUNQINGV587
Created: 10/21/2026
Status: 🔄 Open
Base:
main← Head:dsv4-mvp-rebase📝 Commits (10+)
93e79b4dsv4: DeepSeek V4-Flash (deepseek4) as a second model family610761bdsv4: pay the prefill pass's phase bill where it is spent (attn classes, MoE host/GPU/cold-io split)5b760eadsv4: stream the prefill's missing expert blobs from a pinned read-ahead pool (1.49x on 128 tokens)41b903a[Engine] dsv4: --dsv4-prefill-chunk W prefills a long prompt as W-row passes in one process3a1c2f6[Engine] dsv4: chunked prefill is bit-identical to the single pass1b6c7dc[Engine] dsv4: size a chunked prefill's workspace by the chunk, not the prompt05f35af[Engine] dsv4: STRATA_DSV4_PFTIME host-path sub-phase counters7a97528[Engine] dsv4: global heat eviction for the expert cache (4k prefill +15%)7529b45[Engine] dsv4: issue the predictive expert read-ahead at the layer head7c40fd3[Engine] dsv4: account attention GPU time per launch category (M1)📊 Changes
34 files changed (+15376 additions, -8 deletions)
View changed files
📝
CMakeLists.txt(+45 -1)➕
docs/DSV4.md(+96 -0)📝
include/strata/artifact/gguf_reader.hpp(+166 -0)📝
include/strata/artifact/model_family.hpp(+12 -1)📝
include/strata/core/expert_cache.hpp(+17 -0)➕
include/strata/dsv4/attn.hpp(+169 -0)➕
include/strata/dsv4/comp.hpp(+188 -0)➕
include/strata/dsv4/engine.hpp(+14 -0)➕
include/strata/dsv4/geometry.hpp(+84 -0)➕
include/strata/dsv4/layout.hpp(+294 -0)📝
include/strata/kernels/cpu/expert_layout.hpp(+5 -0)📝
include/strata/kernels/cpu/native_expert.hpp(+7 -4)📝
src/core/expert_source.cpp(+12 -0)➕
src/dsv4/dsv4_attn.cu(+1317 -0)➕
src/dsv4/dsv4_attn_test.cpp(+510 -0)➕
src/dsv4/dsv4_attn_time.h(+157 -0)➕
src/dsv4/dsv4_comp.cu(+1621 -0)➕
src/dsv4/dsv4_comp_test.cpp(+485 -0)➕
src/dsv4/dsv4_engine.cu(+1715 -0)➕
src/dsv4/dsv4_main.cpp(+5 -0)...and 14 more files
📄 Description
Problem
A DeepSeek V4-Flash checkpoint cannot be loaded at all today:
gguf_reader.hppaccepts onlyqwen4exp, sothe file is rejected before anything else happens. The model differs from Qwen3.8-Flash-Next in the parts
that decide the engine's shape — hash routing on the first layers, MLA attention with a 128 window plus
compressed slots picked by the DSA indexer, 256 experts top-6 on a 4096 hidden / 2048 intermediate geometry —
so it needs its own loader, geometry and kernels rather than a new branch in the Qwen path.
Issue: #479 (V4-Flash support request). This follows the reopen instructions from #1518 being closed by the
0.2.0-beta tracker reset: it is rebased onto
main(011c9e60), its checks were re-run on this tree, and thetitle carries the area prefix.
What this adds
A second model family, additive to the default path:
src/dsv4/— engine, MoE path, attention + compressor kernels, and a CPU reference forward(
dsv4ref.cpp, binarystrata-dsv4ref) that the engine's dumps are compared against.include/strata/dsv4/— geometry, layout, attention/compressor interfaces.generate.cpp— one switch (STRATA_HAVE_DSV4) that reads the GGUF header's architecture and handsdeepseek4files todsv4::run;strata-dsv4is the same entry point on its own command line.tools/nvfp4_convert_dsv4.py— conversion through the pinned llama.cpp (it already knowsdeepseek4andwrites
compress_ratios; the script patches the ModelOpt NVFP4 naming and merges per-expert tensors).tools/iq_pack.pypacks the result as usual; the pack format is unchanged (36-byte NVFP4 blobs).docs/DSV4.md— what is supported, the conversion commands, and the limits.The Qwen gate and its kernels are untouched. The only shared-file edits are the family switch, two widened
activation constants in
native_expert.hppfor the wider V4 geometry, and one extra overload inexpert_layout.hpp; all three keep the Qwen path's behaviour.Limits (deliberate)
c(5) ≈ 2.76forwards perround for ~2.4 accepted tokens, and the draft layer is another 2.7-10.9 GiB of resident experts.
engine's CUDA GEMV does not, so such a pack would silently compute wrong numbers.
ctx/128); prompts longer than the 128-tokenwindow are prefill-chunked by the caller.
Validation
Environment: this branch on
011c9e60, containers with CUDA 13.0.2, sm_89 (2×L20, 96 GiB VRAM, 125 GiB RAM),Release build, model
DeepSeek-V4-Flash-0731-NVFP4(164 GB GGUF → 145.13 GiB expert pool, 57.5 % resident).Passed (commands and logs available on request; dumps are compared file by file):
compute-sanitizer --tool memcheckThroughput on the same machine: ~30 t/s for one decode stream (33 ms/pass), ~47 t/s with six rows in one
forward (127 ms/pass).
Not run: GPUs other than sm_89 (no sm_120/HIP/SYCL), Windows, single-GPU 24 GB, IQ2/IQ4 packs, MTP.
Size
~11 k lines, mostly new files under
src/dsv4(dsv4_moe.cu2051,dsv4ref.cpp1575,dsv4_comp.cu1193,
dsv4_attn.cu1119). Happy to split it into loader/geometry, attention and MoE PRs if that iseasier to review.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.