[PR #520] [CLOSED] DeepSeek: orcarouter's abliterated Mix-256G GGUF, and ~7x faster prompts for a tensor-parallel GGUF group #576

Closed
opened 2026-10-29 21:27:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/520
Author: @needmorevram
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: ds4-abliterated


📝 Commits (1)

  • b5eb8ca DeepSeek: orcarouter's abliterated Mix-256G GGUF (--ds4-quant abliterated); a tensor-parallel GGUF group's prompt copies by member part, from pinned copies

📊 Changes

16 files changed (+827 additions, -87 deletions)

View changed files

📝 README.md (+1 -0)
📝 docs/SETTINGS.md (+15 -2)
📝 docs/SETUP.md (+11 -1)
📝 maya.py (+81 -17)
📝 setup.py (+7 -2)
📝 src/ds4/ds4_gguf.cu (+26 -20)
📝 src/ds4/ds4_gguf.cuh (+2 -2)
📝 src/ds4/ds4_iq.cu (+28 -1)
📝 src/ds4/ds4_iq.cuh (+5 -4)
📝 src/ds4/ds4_model.cu (+412 -27)
📝 src/ds4/ds4_q6k.cuh (+16 -0)
📝 tests/ds4_gguf_test.cu (+32 -9)
📝 tools/ds4/download_gguf.json (+44 -0)
📝 tools/ds4/pack_gguf.py (+15 -0)
📝 tools/test_ds4_vision_pack.py (+37 -2)
📝 tools/test_setup_ds4.py (+95 -0)

📄 Description

Adds orcarouter's abliterated DeepSeek-V4.1-Flash-1017 (Mix-256G GGUF, 346 GB) to the setup as --ds4-quant abliterated. It also makes a tensor-parallel GGUF group's prompts much faster. At --tp 8 on 9 GPUs, 16K prompts went from 85-93 to 595-639 tok/s; part of that came from moving the model's Engram shard to an NVMe.

The speed work only changes how expert bytes reach the GPUs, not the arithmetic. MAYA_DS4_TP_CHECK=1 compares every new copy with the file's bytes, byte for byte.

What changes

Setup (maya.py, setup.py, tools/ds4/download_gguf.json, tools/ds4/pack_gguf.py)

  • --ds4-quant abliterated downloads the 7 shards, with sizes and sha256 at revision 43fac799, into <models>/DeepSeek-V4.1-Flash-1017-abliterated-GGUF/Mix-256G. The model is served as deepseek-v4.1-flash-abliterated.
  • Gated repo: the download sends the user's Hugging Face token. It takes HF_TOKEN, HUGGING_FACE_HUB_TOKEN, or the token hf auth login saved.
    • curl reads the header from a 0600 file in a private temp folder, so the token is never on its command line. The printed commands show $HF_TOKEN, not the token itself.
    • The Python fallback sends it as an unredirected header, so it doesn't follow the redirect to the CDN.
    • With no token and files still missing, the setup stops and says how to get one.
  • pack_gguf.py: this GGUF has no dspark.* keys. If its layer count and compress ratios match DeepSeek-V4.1-Flash's (40 layers plus the drafter's 3), the pack takes the drafter's geometry from the checkpoint's config.json. DeepSeek's DSpark drafter then drafts for it as it does for unsloth's GGUFs. Without this, the engine loaded the drafter but never drafted.

Engine: the quant's formats (ds4_gguf.cu, ds4_iq.cu, ds4_q6k.cuh)

  • Some layers put MXFP4 beside a low-bit role: IQ3 gate/ups over MXFP4 downs, and the other way round.
    • Each role now takes its own kernels and its own activation rounding (mx_role). This covers the token, window and prompt-set paths.
    • Before, a layer had to be all MXFP4 or all low-bit.
  • Q6_K dense weights run on the device (ds4_iq), and the Q6_K token embedding is decoded on the host.
  • The TP check's shared-expert reference handles Q5_K and Q6_K.

Engine: prompts of a tensor-parallel GGUF group (ds4_model.cu)

  • Each member copies only its own part (read_mx_member). With MAYA_DS4_TP_GGUF_UNEVEN=1 and off the flow:
    • Each member's prompt copy carries only its part: its gate/up rows and its columns of the down.
    • That part is gathered from the NUMA copy, or cut in place from the file's blob, and goes over in one DMA.
    • Before, every member staged the whole expert, then copied the down's columns with one cudaMemcpy2DAsync per row. That took about 35 ms an expert.
  • The RAM copies are pinned (cp_pin). With several GPUs, the CPU lane's experts copied into RAM (two NUMA parts) are pinned at load when prompts run in chunks, all or none.
    • The prompt path then DMAs an expert straight from the copy. The CPU only gathers a member's columns of the down.
    • Before, every byte went through the CPU's staging first: about 490 GB of memcpy for a 16K prompt, at about 33 GB/s across 72 reader threads.
    • DS4_COPY_PIN=0 turns this off. If the pin fails, the load says so and the prompt path stages everything as before.
  • MAYA_DS4_TP_CHECK=1 checks the new copies. For each format and rotation, it copies the parts as the prompt path does, from RAM and from the file. It then compares them on the device with the file's bytes, with guard bytes around each copy.

Docs: README's model table, SETUP.md, and SETTINGS.md (DS4_COPY_PIN, the members' prompt copies, the TP check).

Tested

  • Hardware: RTX 3090 + 8x RTX 5060 Ti 16 GB (every link PCIe 3.0 x8), 2x Xeon Gold 6152, 183 GB RAM, model on an NVMe.
  • Settings: --tp 8 --prefill-chunk 4096 --dspark on, MAYA_DS4_TP_GGUF_UNEVEN=1. The 3090 runs layers 0-4 and the drafter by itself; the 5060 Tis are the tp8 group.

Checks:

  • Perplexity on the pplcard sub23 passages: 3.4837. LibertAIDAI's 3.5-bit EXL3 gives 3.4081.
  • MAYA_DS4_TP_CHECK=1 passed: 27 expert formats and rotations, and 432 of the prompt path's copies byte for byte on the devices.
  • ds4_gguf_test: ALL OK (497 checks) on an RTX 5060 Ti (sm_120) and on the RTX 3090 (sm_86). It covers Q6_K against ggml's dequantize_row_q6_K, and the IQ3_XXS/MXFP4, MXFP4/IQ3_S and IQ2_S/MXFP4 layers: token experts, plus the PCIe lane bit for bit with VRAM.
  • CI's checks: check_hip_compat.py OK; tools 400 tests OK (1 skipped); serve 366 tests OK (8 skipped).

Speed: the same serve bench and prompts as #495 (two ~16K prompts, then decode at temperature 1.0). Prefill is two prompts; decode is all / median.

step prefill tok/s decode tok/s
main + the quant's formats 84.7 / 92.7 42.6 / 44.0
+ members copy only their part 130.8 / 176.4 not comparable (run with the TP check on)
+ the Engram shard on an NVMe instead of a USB SSD (no code change) 405.6 / 446.1 52.1 / 53.7
+ the copies pinned (this PR) 594.9 / 638.8 54.0 / 54.85
LibertAIDAI's 3.5-bit EXL3, same settings 1058-1186 63-64

Why the Engram step mattered: the Engram tables (shard 00002, 110 GB, read at random in 144-byte rows) were on a USB SSD that manages about 5,000 random reads/s. A 16K prompt reads about 620K rows, which takes about 2 minutes at that rate. On an NVMe (about 115K reads/s) it's no longer the bottleneck. README already says to keep the files on an NVMe.

Load time: pinning takes 50-110 s for 125 GB. From the NVMe, the server is ready in 5-8 minutes.

Known gaps

  • Still about half the EXL3's prefill, for two reasons:
    • n_ff 2304 is 9 blocks of 256, so at --tp 8 one member takes 512 columns and the others 256, rotating per layer. That's 1.78x the even share; EXL3's split128 is 1.33x.
    • The CPU still gathers the down's columns.
    • --tp 9 would split evenly. Not measured.
  • MAYA_DS4_TP_CHECK=1 hung the first prompt once at tp8 (GPU 1 at 100%), before the member-part change. It hasn't happened in any run since.
  • Long prompts weren't completed on this PC. Prompts of 72K-156K tokens ended in box resets. The iDRAC logged the first as a fatal PCIe error on the 3090's root port, and this box has had such resets from another card's slot before. I believe it's the hardware, but it means nothing past 16K tokens was run to the end here.
  • Without the 3090 (8x 16 GB, --tp 8), the drafter's three blocks on the lead cap every member's VRAM experts: 1,523 of 15,360 slots, leaving 206 GB to be read from the files.
    • MAYA_DS4_DRAFT_DEV=1,2,3, which already exists, spreads the blocks across members. 161 GB was then copied and pinned.
    • Speed with it not measured.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/520 **Author:** [@needmorevram](https://github.com/needmorevram) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `ds4-abliterated` --- ### 📝 Commits (1) - [`b5eb8ca`](https://github.com/mw00/project-maya/commit/b5eb8ca76cce399121d1a15c7cc0f42895483c72) DeepSeek: orcarouter's abliterated Mix-256G GGUF (--ds4-quant abliterated); a tensor-parallel GGUF group's prompt copies by member part, from pinned copies ### 📊 Changes **16 files changed** (+827 additions, -87 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `docs/SETTINGS.md` (+15 -2) 📝 `docs/SETUP.md` (+11 -1) 📝 `maya.py` (+81 -17) 📝 `setup.py` (+7 -2) 📝 `src/ds4/ds4_gguf.cu` (+26 -20) 📝 `src/ds4/ds4_gguf.cuh` (+2 -2) 📝 `src/ds4/ds4_iq.cu` (+28 -1) 📝 `src/ds4/ds4_iq.cuh` (+5 -4) 📝 `src/ds4/ds4_model.cu` (+412 -27) 📝 `src/ds4/ds4_q6k.cuh` (+16 -0) 📝 `tests/ds4_gguf_test.cu` (+32 -9) 📝 `tools/ds4/download_gguf.json` (+44 -0) 📝 `tools/ds4/pack_gguf.py` (+15 -0) 📝 `tools/test_ds4_vision_pack.py` (+37 -2) 📝 `tools/test_setup_ds4.py` (+95 -0) </details> ### 📄 Description Adds orcarouter's abliterated DeepSeek-V4.1-Flash-1017 ([Mix-256G GGUF](https://huggingface.co/orcarouter/DeepSeek-V4.1-Flash-1017-abliterated-GGUF), 346 GB) to the setup as `--ds4-quant abliterated`. It also makes a tensor-parallel GGUF group's prompts much faster. At `--tp 8` on 9 GPUs, 16K prompts went from 85-93 to 595-639 tok/s; part of that came from moving the model's Engram shard to an NVMe. The speed work only changes how expert bytes reach the GPUs, not the arithmetic. `MAYA_DS4_TP_CHECK=1` compares every new copy with the file's bytes, byte for byte. ## What changes **Setup** (`maya.py`, `setup.py`, `tools/ds4/download_gguf.json`, `tools/ds4/pack_gguf.py`) - `--ds4-quant abliterated` downloads the 7 shards, with sizes and sha256 at revision `43fac799`, into `<models>/DeepSeek-V4.1-Flash-1017-abliterated-GGUF/Mix-256G`. The model is served as `deepseek-v4.1-flash-abliterated`. - **Gated repo:** the download sends the user's Hugging Face token. It takes `HF_TOKEN`, `HUGGING_FACE_HUB_TOKEN`, or the token `hf auth login` saved. - curl reads the header from a 0600 file in a private temp folder, so the token is never on its command line. The printed commands show `$HF_TOKEN`, not the token itself. - The Python fallback sends it as an unredirected header, so it doesn't follow the redirect to the CDN. - With no token and files still missing, the setup stops and says how to get one. - **`pack_gguf.py`:** this GGUF has no `dspark.*` keys. If its layer count and compress ratios match DeepSeek-V4.1-Flash's (40 layers plus the drafter's 3), the pack takes the drafter's geometry from the checkpoint's `config.json`. DeepSeek's DSpark drafter then drafts for it as it does for unsloth's GGUFs. Without this, the engine loaded the drafter but never drafted. **Engine: the quant's formats** (`ds4_gguf.cu`, `ds4_iq.cu`, `ds4_q6k.cuh`) - Some layers put MXFP4 beside a low-bit role: IQ3 gate/ups over MXFP4 downs, and the other way round. - Each role now takes its own kernels and its own activation rounding (`mx_role`). This covers the token, window and prompt-set paths. - Before, a layer had to be all MXFP4 or all low-bit. - Q6_K dense weights run on the device (`ds4_iq`), and the Q6_K token embedding is decoded on the host. - The TP check's shared-expert reference handles Q5_K and Q6_K. **Engine: prompts of a tensor-parallel GGUF group** (`ds4_model.cu`) - **Each member copies only its own part** (`read_mx_member`). With `MAYA_DS4_TP_GGUF_UNEVEN=1` and off the flow: - Each member's prompt copy carries only its part: its gate/up rows and its columns of the down. - That part is gathered from the NUMA copy, or cut in place from the file's blob, and goes over in one DMA. - Before, every member staged the whole expert, then copied the down's columns with one `cudaMemcpy2DAsync` per row. That took about 35 ms an expert. - **The RAM copies are pinned** (`cp_pin`). With several GPUs, the CPU lane's experts copied into RAM (two NUMA parts) are pinned at load when prompts run in chunks, all or none. - The prompt path then DMAs an expert straight from the copy. The CPU only gathers a member's columns of the down. - Before, every byte went through the CPU's staging first: about 490 GB of memcpy for a 16K prompt, at about 33 GB/s across 72 reader threads. - `DS4_COPY_PIN=0` turns this off. If the pin fails, the load says so and the prompt path stages everything as before. - **`MAYA_DS4_TP_CHECK=1` checks the new copies.** For each format and rotation, it copies the parts as the prompt path does, from RAM and from the file. It then compares them on the device with the file's bytes, with guard bytes around each copy. **Docs:** README's model table, SETUP.md, and SETTINGS.md (`DS4_COPY_PIN`, the members' prompt copies, the TP check). ## Tested - **Hardware:** RTX 3090 + 8x RTX 5060 Ti 16 GB (every link PCIe 3.0 x8), 2x Xeon Gold 6152, 183 GB RAM, model on an NVMe. - **Settings:** `--tp 8 --prefill-chunk 4096 --dspark on`, `MAYA_DS4_TP_GGUF_UNEVEN=1`. The 3090 runs layers 0-4 and the drafter by itself; the 5060 Tis are the tp8 group. **Checks:** - **Perplexity** on the pplcard sub23 passages: 3.4837. LibertAIDAI's 3.5-bit EXL3 gives 3.4081. - **`MAYA_DS4_TP_CHECK=1`** passed: 27 expert formats and rotations, and 432 of the prompt path's copies byte for byte on the devices. - **`ds4_gguf_test`:** ALL OK (497 checks) on an RTX 5060 Ti (sm_120) and on the RTX 3090 (sm_86). It covers Q6_K against ggml's `dequantize_row_q6_K`, and the IQ3_XXS/MXFP4, MXFP4/IQ3_S and IQ2_S/MXFP4 layers: token experts, plus the PCIe lane bit for bit with VRAM. - **CI's checks:** `check_hip_compat.py` OK; `tools` 400 tests OK (1 skipped); `serve` 366 tests OK (8 skipped). **Speed:** the same serve bench and prompts as #495 (two ~16K prompts, then decode at temperature 1.0). Prefill is two prompts; decode is all / median. | step | prefill tok/s | decode tok/s | |---|---|---| | main + the quant's formats | 84.7 / 92.7 | 42.6 / 44.0 | | + members copy only their part | 130.8 / 176.4 | not comparable (run with the TP check on) | | + the Engram shard on an NVMe instead of a USB SSD (no code change) | 405.6 / 446.1 | 52.1 / 53.7 | | + the copies pinned (this PR) | **594.9 / 638.8** | **54.0 / 54.85** | | LibertAIDAI's 3.5-bit EXL3, same settings | 1058-1186 | 63-64 | Why the Engram step mattered: the Engram tables (shard 00002, 110 GB, read at random in 144-byte rows) were on a USB SSD that manages about 5,000 random reads/s. A 16K prompt reads about 620K rows, which takes about 2 minutes at that rate. On an NVMe (about 115K reads/s) it's no longer the bottleneck. README already says to keep the files on an NVMe. Load time: pinning takes 50-110 s for 125 GB. From the NVMe, the server is ready in 5-8 minutes. ## Known gaps - **Still about half the EXL3's prefill**, for two reasons: - n_ff 2304 is 9 blocks of 256, so at `--tp 8` one member takes 512 columns and the others 256, rotating per layer. That's 1.78x the even share; EXL3's split128 is 1.33x. - The CPU still gathers the down's columns. - `--tp 9` would split evenly. Not measured. - **`MAYA_DS4_TP_CHECK=1` hung the first prompt once** at tp8 (GPU 1 at 100%), before the member-part change. It hasn't happened in any run since. - **Long prompts weren't completed on this PC.** Prompts of 72K-156K tokens ended in box resets. The iDRAC logged the first as a fatal PCIe error on the 3090's root port, and this box has had such resets from another card's slot before. I believe it's the hardware, but it means nothing past 16K tokens was run to the end here. - **Without the 3090 (8x 16 GB, `--tp 8`),** the drafter's three blocks on the lead cap every member's VRAM experts: 1,523 of 15,360 slots, leaving 206 GB to be read from the files. - `MAYA_DS4_DRAFT_DEV=1,2,3`, which already exists, spreads the blocks across members. 161 GB was then copied and pinned. - Speed with it not measured. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:27:03 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#576
No description provided.