mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3384] [Engine] run Mirai's Qwen3.8-Flash-Next-S (QNS trellis) packs #4607
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#4607
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/3384
Author: @alesha-pro
Created: 10/20/2026
Status: 🔄 Open
Base:
main← Head:qns-flash-next-s📝 Commits (1)
8e75f6f[Engine] run Mirai's Qwen3.8-Flash-Next-S (QNS trellis) packs📊 Changes
31 files changed (+1674 additions, -62 deletions)
View changed files
📝
CMakeLists.txt(+7 -1)➕
docs/QNS.md(+57 -0)📝
include/strata/artifact/gguf_reader.hpp(+8 -0)📝
include/strata/core/expert_cache.hpp(+2 -0)📝
include/strata/core/mtp.hpp(+2 -0)📝
include/strata/core/native_dense.hpp(+4 -0)📝
include/strata/core/native_head.hpp(+5 -0)📝
include/strata/core/verify.hpp(+3 -0)📝
include/strata/core/weights.hpp(+9 -0)📝
include/strata/kernels/cpu/expert_layout.hpp(+21 -1)📝
include/strata/kernels/cpu/native_expert.hpp(+5 -4)➕
include/strata/kernels/cpu/qns.hpp(+38 -0)➕
include/strata/kernels/qns_cuda.hpp(+73 -0)➕
include/strata/kernels/qns_gather.hpp(+16 -0)📝
include/strata/kernels/verify_kernels.hpp(+3 -0)📝
src/core/expert_source.cpp(+33 -0)📝
src/core/mtp.cpp(+43 -9)📝
src/core/native_dense.cpp(+50 -1)📝
src/core/native_head.cpp(+37 -1)📝
src/core/verify.cpp(+58 -13)...and 11 more files
📄 Description
Problem and result
Mirai published Qwen3.8-Flash-Next-S, a trellis build of Flash-Next (routed experts 1-5 bits each, 2.4 on average; backbone and head 5 bits), packed for Strata:
trymirai/Qwen3.8-Flash-Next-S-strata-experimental. Until now it runs only on v0.1.43 with Mirai'sstrata-qns.patch. This PR ports that patch to 0.2.0: the S and S-small packs load and run on one card and on a layer split, with MTP and the refusal projection. Every other model takes the same path as before, checked on IQ3_S below.Related discussion
Scope: I am writing to @Niko1221 directly to agree it. The QNS format, the CUDA and AVX2 kernels and the packer support are Mirai's work, from their
strata-qns.patch.Approach
Mirai's code is taken unchanged from their HF repo (2026-10-15, which already has the layer-split rotation fix). What the merge with 0.1.44-0.2.0 needed:
native_experts.txtv5 for Hadamard-folded experts, and the patch used v5 for QNS layers. QNS packs are v6 here. v5 keeps its meaning (hadamard.txt is required for v5 only). A v5 QNS pack from the old patch is refused with "repack with tools/iq_pack.py"; repacking takes ~20 s and gives the same files except the header line. The packer skips the Hadamard spec for QNS.kQnsDenseType: the GDN gate projection (side_proj) and the QSA query chain on a branch stream.slot_stride(expert_bytes(l, e), slot_guard);expert_bytesis the layer's blob for non-QNS packs.docs/QNS.md: how to pack and run.All new code is behind
expert_layout().qns()orkQnsDenseType.Validation
Ubuntu 22.04, CUDA 12.8, 4x RTX 3090 at 300 W, EPYC 7642 (AVX2), 125 GB RAM. Branch head
8e75f6f(engine sources identical to the tested build).Passed
cmake -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 -DSTRATA_BUILD_TESTS=OFF,--target strata. No new warnings in the touched files.tools/iq_pack.pyon S and S-small: v6 packs;qns_offsets.bin,qns_rotation.bin,dense.bin,index.txtand every layer row byte-identical to the v0.1.43 patch's packs./v1/chat/completions, thinking off, 32K context, MTP on, the refusal vector on: a sum, a Python function, a Russian answer, a tool call, a 6,210-token document with a hidden code, a lock-picking question.3d1fb48) against this branch: all six greedy answers byte-identical, same token counts; decode per request within 3.1%.Failed: none observed.
Not run
.cufiles are compiled for HIP by the existing glob, so this needs a HIP build (or a CUDA-only guard) before review. Help welcome.Limits
docs/QNS.md).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.