QSA Paper | GitHub | Engine + Build | Runtime Guide | GGUF Model Series | Unsloth GGUF | X | License
The original 18 backbone, vision, and MTP shards are byte-for-byte unchanged from Qwen/Qwen3.8-27B. This release adds 52,434,944 FP32 indexer parameters to the 16 full-attention layers. The other 48 decoder layers retain their original Gated DeltaNet architecture. Training left the backbone, vision encoder, projector, and MTP weights unchanged.
The original checkpoint is included as indexers/qsa_indexers.pt. It was trained for 300 steps at length 16,384 with a 50% multimodal mix and synthetic OCR, table, and shape tasks. The training source snapshot is included under research/.
Qwen Sparse Attention (QSA) uses a learned, compressed indexer to select context in four-token blocks. The 16 full-attention layers in this 27B adaptation use fixed K=2,048 plus the current block. All original KV entries are retained, so this is not KV-cache compression. The 12.5% figure describes K at 16k, not a constant ratio at every context length. The architecture reference is On the Design of Qwen3.8-Next Architecture: Evaluation, Efficiency, and Training Stability.
Original Qwen3.8-27B (left) and the QSA adaptation with 16 learned indexers (right).
The GGUF model series contains the Q8_0 conversion and three Unsloth mixed-precision variants. These are separate artifacts from this BF16 repository.
| Variant | Source | Size |
|---|---|---|
| Q8_0 | Conversion from this QSA BF16 release | 29.26 GB |
| Unsloth UD-Q4_K_M | Unsloth mixed-precision tensors plus the same FP32 indexers | 16.67 GB |
| Unsloth UD-Q5_K_M | Unsloth mixed-precision tensors plus the same FP32 indexers | 19.98 GB |
| Unsloth UD-Q6_K | Unsloth mixed-precision tensors plus the same FP32 indexers | 22.19 GB |
The Unsloth variants reuse 866 original tensors from unsloth/Qwen3.8-27B-GGUF byte-for-byte and add the same 80 FP32 QSA indexer tensors. No retraining or requantization was performed after adding the indexers. UD denotes mixed precision, not a uniform bit depth for every tensor.
The Transformers wrapper in this repository is a correctness reference. Text uses an SDPA mask, image and video conversations use dense attention, and MTP execution is not implemented. This wrapper does not provide native sparse-kernel speed.
For deployment, select a GGUF variant and use Qwen3.8-27B QSA for llama.cpp. The engine supports native text, image, and video QSA with M-RoPE, MTP with up to two draft tokens, and prefix-cache reuse. Stock llama.cpp does not support these QSA files. See the runtime guide for model selection, build, and launch instructions.
When launching, set QSA_MODEL to the selected GGUF filename, for example:
QSA_MODEL=Qwen3.8-27B-QSA-Unsloth-UD-Q5_K_M.gguf QSA_MODEL_DIR=/path/to/gguf ./qsa27b-runtime/launch.sh
Install requirements.txt. The captured Python environment used torch 2.14.1+cu126 and torchvision 0.29.1+cu126; the native runtime separately uses CUDA 12.9. Inspect the packaged custom code before enabling it.
from transformers import AutoModelForImageTextToText, AutoProcessor
path = "higa2515/Qwen3.8-27B-QSA-BF16"
processor = AutoProcessor.from_pretrained(path, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
path, trust_remote_code=True, dtype="auto", device_map="auto",
attn_implementation="sdpa",
)
original/ contains the pinned official metadata, including the original config, weight index, processor, tokenizer, license, and model card. The additional QSA shard is excluded by the original index. After downloading this complete repository:
python restore_original.py --source . --output ../Qwen3.8-27B-original
The tool verifies all original LFS hashes and then creates a separate, dense, standard HF snapshot, hard-linking large unchanged weights where possible. It refuses to overwrite an existing output directory.
These BF16 research-reference checks compare QSA with the original dense path. They are not Q8_0 native quality results.
| Check | Original dense | QSA | Observed comparison |
|---|---|---|---|
| Text PPL on 32,766 tokens, lower is better | 7.072960 | 7.071384 | QSA/dense ratio 0.99978 |
| Constructed 50-item four-choice DocVQA | 50/50 | 50/50 | 100% of the dense score on this probe |
The DocVQA probe is not standard open-ended DocVQA scoring. DocVQA was used for evaluation, not as the synthetic indexer training set. These small checks do not establish a general performance-retention percentage or broad quality equivalence.
Native image/video and cache probes passed, with limited multimodal checks through 64k. General multimodal quality at 128k/262k remains unverified.
A teacher-forced evaluation used six fixed windows, up to 65,024 input tokens, FP16 KV, and MTP disabled. PPL differences are QSA relative to dense within each quantized model.
| Variant | Overall PPL difference | 64k capture | Same-budget oracle | 64k prose PPL difference |
|---|---|---|---|---|
| UD-Q4_K_M | -1.41% | 73.82% | 82.93% | +2.44% |
| UD-Q5_K_M | -0.47% | 73.76% | 82.91% | +1.97% |
| UD-Q6_K | -0.35% | 73.89% | 83.04% | +1.76% |
Capture measures attention mass, not task accuracy. These text-only checks do not establish general quality equivalence, free-generation quality, or a comparison with this BF16 model. See the complete evaluation.
The following results apply only to Q8_0, not to the Unsloth variants. The GGUF engine was measured against its dense Q8_0 control with the same weights, FP16 KV, MTP draft2, engine, and two sm70 32GB GPUs.
| Input tokens | QSA cold prefill | Dense cold prefill | QSA decode | Dense decode |
|---|---|---|---|---|
| 0 | 660.75 | 658.87 | 49.28 | 49.87 |
| 261,120 | 1071.53 | 366.84 | 41.07 | 22.91 |
All values are token/s. At 261,120 input tokens, QSA was 1.793x faster in decode and 2.921x faster in cold prefill. From each path's re-measured 0k point, mixed decode declined 16.66% for QSA and 54.06% for dense.
These are text-speed results, not long-context reasoning accuracy. QSA's nonzero-depth samples were retained from the earlier matched run, and the two paths were measured in separate sessions. See the full comparison data and methodology.
Original model weights and notices retain the upstream Apache-2.0 license. QSA additions in this release are provided under Apache-2.0. Native llama.cpp code retains MIT and its included third-party notices.
model-00004-of-00018.safetensors 4.0 GBmodel-00016-of-00018.safetensors 4.0 GBmodel-00006-of-00018.safetensors 4.0 GBmodel-00008-of-00018.safetensors 4.0 GBmodel-00010-of-00018.safetensors 4.0 GBmodel-00012-of-00018.safetensors 4.0 GBmodel-00014-of-00018.safetensors 4.0 GBmodel-00001-of-00018.safetensors 4.0 GBquant4/draft/model.safetensors 3.8 GBmodel-00018-of-00018.safetensors 3.4 GBmodel-00002-of-00018.safetensors 3.0 GBmodel-00003-of-00018.safetensors 2.5 GBmodel-00007-of-00018.safetensors 2.1 GBmodel-00009-of-00018.safetensors 2.1 GBmodel-00011-of-00018.safetensors 2.1 GBmodel-00013-of-00018.safetensors 2.1 GBmodel-00015-of-00018.safetensors 2.1 GBmodel-00017-of-00018.safetensors 2.1 GBmodel-00005-of-00018.safetensors 2.1 GBquant4/target/model-00001-of-00018.safetensors 1.8 GBquant4/target/model-00018-of-00018.safetensors 1.6 GBquant4/target/model-00003-of-00018.safetensors 1.4 GBquant4/target/model-00004-of-00018.safetensors 1.1 GBquant4/target/model-00016-of-00018.safetensors 1.1 GBquant4/target/model-00006-of-00018.safetensors 1.1 GBquant4/target/model-00008-of-00018.safetensors 1.1 GBquant4/target/model-00010-of-00018.safetensors 1.1 GBquant4/target/model-00012-of-00018.safetensors 1.1 GBquant4/target/model-00014-of-00018.safetensors 1.1 GBquant4/target/model-00002-of-00018.safetensors 857 MBquant4/target/model-00007-of-00018.safetensors 593 MBquant4/target/model-00009-of-00018.safetensors 593 MBquant4/target/model-00011-of-00018.safetensors 593 MBquant4/target/model-00013-of-00018.safetensors 593 MBquant4/target/model-00015-of-00018.safetensors 593 MBquant4/target/model-00017-of-00018.safetensors 593 MBquant4/target/model-00005-of-00018.safetensors 591 MBqsa-indexers.safetensors 210 MBquant4/target/qsa-indexers.safetensors 210 MBHave the files? Submit a torrent.
Submit a torrentHave the complete files and permission to share them? Replace the example folder path. The script checks the files, makes a torrent and submits its magnet and checksums. Keep your torrent client seeding. Get your community key from your settings, and read the script before running it.
curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo manateelazycat/Qwen3.8-27B-QSA-TensorFold-Zig ./model-folderQwen/Qwen3.8-27B