mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4820] [Engine] Native support for DeepSeek-V4-Flash (0731 release) in strata-dsv41 #5196
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#5196
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/4820
Author: @code-martin
Created: 10/31/2026
Status: 🔄 Open
Base:
main← Head:feature/deepseek4-support📝 Commits (1)
6eea5a4[Engine] Native support for DeepSeek-V4-Flash 0731, on-the-fly Q4_K dense quantization, and scaled route_prior📊 Changes
12 files changed (+959 additions, -306 deletions)
View changed files
📝
serve/frontend.py(+7 -2)📝
serve/server.py(+42 -13)📝
serve/test_family_name.py(+2 -1)📝
serve/web/app.js(+10 -2)📝
serve/web/index.html(+5 -0)📝
setup.py(+17 -0)📝
src/dsv41/ds4_kernels.cu(+310 -145)📝
src/dsv41/ds4_kernels.cuh(+17 -9)📝
src/dsv41/ds4_main.cpp(+21 -1)📝
src/dsv41/ds4_model.cu(+499 -124)📝
src/dsv41/ds4_model.hpp(+6 -0)📝
tools/dsv41/pack_gguf.py(+23 -9)📄 Description
Problem and result
Problem:
Strata's
strata-dsv41engine was strictly configured for the DeepSeek-V4.1-Flash (1017 release) layout (general.architecture = "deepseek41"). Running original DeepSeek-V4-Flash (0731 release) models (general.architecture = "deepseek4"— e.g. DwarfStar/antirez or Unsloth GGUFs) failed due to architectural differences:hc_splitintoa_pre/f_prepassed directly into same-sublayerhc_pre_norm, plus finaloutput.hc_*pre-norm beforenorm.weight).unit_norm) on Q heads (128 heads of 256 dims).quant = 4) and BF16 compressed KV cache.coff = 2,R = 4withc_ape) and dedicated indexer compressor with Walsh-Hadamard transform (hadamard128).ffn.gate.tid2eid).Result:
Full native support for DeepSeek-V4-Flash 0731 (
deepseek4) instrata-dsv41:Q8_0 -> Q4_KandF16 -> Q8_0) during load on <= 12 GB GPUs, cutting dense footprint from 7.90 GB to 4.61 GB (saving 3.29 GB VRAM).kDs4RoutePriorScale = 0.1f), controllable via--route-prior, server API, and Chat settings drawer (0.0–1.0 slider, default 0.1), boosting cold decode throughput from 4.7 tok/s to 13.3 tok/s (+183%) with 100% fluent output.Related discussion
none
Approach
tools/dsv41/pack_gguf.py,src/dsv41/ds4_model.cu): Mapped 0731 tensors (tid2eid,attn.indexer.ape.weight,attn.indexer.wgate.weight), enabled optional Engram bypass (engram_layer_ids = []), and supported F16/BF16 dense uploads. Implemented 0731 forward pass withhc_split,output.hc_*pre-norm,unit_norm, indexer Hadamard transform, and early-layer token routing.src/dsv41/ds4_model.cu): Added parallel CPU conversion of dense layers from Q8_0 to Q4_K and F16 to Q8_0 when GPU memory <= 12 GiB (orDS4_DENSE_Q4K=1).cudaHostAllocMapped/hmap) with 4-bit FP4 quantization.kDs4RoutePriorScale = 0.1finside router kernels so that user values [0.0, 1.0] map safely to score deltas [0.0, 0.10], plus Web UI settings slider and REST API.Validation
Passed:
- Build:
ninja -C M:/Strata/build-dsv41 strata-dsv41on Windows 11 x64, MSVC v143, CUDA 13.1 (0 errors).- Smoke test:
smoke.py --exe strata-dsv41.exe --pack maya-ds4-0731 --tokens 64->"The capital of France is Paris."- Full 240K context allocation (245,760 tokens) with 231 VRAM resident experts on RTX 3080 10GB.
- Route prior sweep benchmark (Prompt: "Briefly describe the architecture and main instruments of the James Webb Space Telescope (JWST).", max_tokens = 60, temp = 0.0):
* prior 0.0 (off): 4.7 tok/s (12,725 ms, 100% fluent)
* prior 0.1 (default): 9.7 tok/s (6,182 ms, 100% fluent, +106% speedup)
* prior 0.3: 7.2 tok/s (8,337 ms, 100% fluent)
* prior 0.5: 9.3 tok/s (6,432 ms, 100% fluent)
* prior 0.7: 13.3 tok/s (4,521 ms, 100% fluent, +183% speedup)
* prior 1.0: 12.3 tok/s (4,868 ms, 100% fluent)
Failed: none observed
Not run: Non-CUDA backends (HIP / SYCL / Metal) — strata-dsv41 engine targets CUDA (sm_80+).
Limits
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.