[PR #141] [MERGED] EXL3 with the DFlash2 drafter: garbled answers, the 1-2 GPU window, a re-asked prompt's drafts #358

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/141
Author: @needmorevram
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @mw00

Base: main ← Head: exl3-dflash2


📝 Commits (1)

  • a0ed975 EXL3 with the DFlash2 drafter: garbled answers, the 1-2 GPU window, a re-asked prompt's drafts

📊 Changes

4 files changed (+108 additions, -57 deletions)

View changed files

📝 include/strata/core/glm_dflash.hpp (+3 -2)
📝 src/core/glm_dflash.cu (+11 -5)
📝 src/core/glm_fast_path.cu (+6 -3)
📝 src/core/glm_window.cu (+88 -47)

📄 Description

Summary

The EXL3 quant with the DFlash2 drafter answered with noise ("Let Letj{{_{ #{ ... !!!!!!!!"), while the same model with its MTP block was fine. Three fixes, all in the DFlash2 / verify-window code:

  • Garbled answers (every GPU count). The verify window (batched and pipelined) dequantized each token's embedding at a row size from iq_row_bytes, which returns 0 for BF16. EXL3's token_embd is BF16, so every window token after the prompt read row 0 of the table: the answer turned to noise and almost no draft was accepted (9 GPUs: 0.1%). The row size now comes from ggml_row_size, as on the token path (glm_model.hpp already notes the same trap there). GGUF packs were not affected: their token_embd is a type iq_row_bytes knows.
  • EXL3 in the 1-2 GPU batched window. It errored or crashed before: the window read the indexer's BF16 q_b (null in an EXL3 pack) and sent the routed experts to moe_win_experts, which has no EXL3 kernel. It now takes idx_q_b_x, gives the EXL3 GEMVs the F32 inputs the token path gives them, runs each token's routed experts on the EXL3 kernels with its own plan (the batched and the token-by-token window alike), and sends an EXL3 layer's CPU-lane routes to the window lanes a token at a time (win_cpu_merged has the native kernels only).
  • A prompt asked again drafted from the old answer. When a conversation rolls back to its snapshot (snapshot_restore), the drafter's ring still holds the old continuation's positions, and inject() skips any position whose slot already holds it - so the new answer was drafted from the previous one (2.7% accepted, 26 tok/s on 9 GPUs). GlmDflash::reset(from) now forgets the positions from the rollback on.

Tests

Window exactness (glm_pack_test, GLM_TEST_WINDOW=4, 256 tokens of real text, the drafter loaded, CPU plan pinned): window picks vs token-at-a-time decode, 413 of 413 on the RTX 3090 alone and 413 of 413 on the 3090 + one 5060 Ti (the two-part batched window with both parts' CPU pools).

Server, EXL3 3.05bpw, same build, decode tok/s from the engine's glm stat lines - a warm-up pass discarded, the mean of two more (they agree within ~3%), drafts accepted in brackets. Prompts: a code answer (512 tokens), the same prompt again at once, an explanation, a short story, and a summary of a 10,941-token document (384 tokens).

9 GPUs (RTX 3090 + 8x RTX 5060 Ti):

Prompt DFlash2 MTP DFlash2 vs MTP
Code 79.0 (64%) 42.8 (89%) +85%
Same prompt again 79.9 (64%) 42.8 (89%) +87%
Explanation 60.4 (48%) 40.2 (79%) +50%
Short story 42.9 (34%) 35.4 (58%) +21%
10.9K-token document 52.1 (45%) 39.3 (84%) +32%

Before this PR, the 9-GPU DFlash2 server ran at ~26.7 tok/s with 0.1% of drafts accepted, and its answers were noise.

2 GPUs (RTX 3090 + RTX 5060 Ti):

Prompt DFlash2 MTP DFlash2 vs MTP
Code 14.1 (93%) 17.3 (88%) -19%
Same prompt again 14.1 (92%) 19.7 (89%) -28%
Explanation 13.7 (83%) 17.4 (80%) -21%
Short story 9.9 (59%) 14.7 (56%) -32%
10.9K-token document 11.4 (75%) 15.4 (79%) -26%

Notes

  • On 2 GPUs DFlash2 is now correct for EXL3 but slower than MTP. Only 40-48% of the routed experts are in VRAM there, so the window's CPU lane takes 190-270 experts and 105-155 ms per token, and EXL3's CPU kernel shares one scratch between the two window lanes, so they take turns. The setup's speed calibration (e5693c0) keeps the drafter only where it is faster, so a 2-GPU EXL3 setup should end up on MTP until then. I'll fix the 2-GPU DFlash2 decode speed in a future PR (a CPU-lane scratch per window lane, an EXL3 merged window pass); this PR is the correctness fix.
  • One GPU was checked for exactness only, not benchmarked.

🔄 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/141 **Author:** [@needmorevram](https://github.com/needmorevram) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `exl3-dflash2` --- ### 📝 Commits (1) - [`a0ed975`](https://github.com/mw00/project-maya/commit/a0ed975df4db02f0cd32c37b37cc01783e35d6a6) EXL3 with the DFlash2 drafter: garbled answers, the 1-2 GPU window, a re-asked prompt's drafts ### 📊 Changes **4 files changed** (+108 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/glm_dflash.hpp` (+3 -2) 📝 `src/core/glm_dflash.cu` (+11 -5) 📝 `src/core/glm_fast_path.cu` (+6 -3) 📝 `src/core/glm_window.cu` (+88 -47) </details> ### 📄 Description ## Summary The EXL3 quant with the DFlash2 drafter answered with noise ("Let Letj{\{\_{ \#{ ... !!!!!!!!"), while the same model with its MTP block was fine. Three fixes, all in the DFlash2 / verify-window code: - **Garbled answers (every GPU count).** The verify window (batched and pipelined) dequantized each token's embedding at a row size from `iq_row_bytes`, which returns 0 for BF16. EXL3's `token_embd` is BF16, so every window token after the prompt read row 0 of the table: the answer turned to noise and almost no draft was accepted (9 GPUs: 0.1%). The row size now comes from `ggml_row_size`, as on the token path (`glm_model.hpp` already notes the same trap there). GGUF packs were not affected: their `token_embd` is a type `iq_row_bytes` knows. - **EXL3 in the 1-2 GPU batched window.** It errored or crashed before: the window read the indexer's BF16 `q_b` (null in an EXL3 pack) and sent the routed experts to `moe_win_experts`, which has no EXL3 kernel. It now takes `idx_q_b_x`, gives the EXL3 GEMVs the F32 inputs the token path gives them, runs each token's routed experts on the EXL3 kernels with its own plan (the batched and the token-by-token window alike), and sends an EXL3 layer's CPU-lane routes to the window lanes a token at a time (`win_cpu_merged` has the native kernels only). - **A prompt asked again drafted from the old answer.** When a conversation rolls back to its snapshot (`snapshot_restore`), the drafter's ring still holds the old continuation's positions, and `inject()` skips any position whose slot already holds it - so the new answer was drafted from the previous one (2.7% accepted, 26 tok/s on 9 GPUs). `GlmDflash::reset(from)` now forgets the positions from the rollback on. ## Tests **Window exactness** (`glm_pack_test`, `GLM_TEST_WINDOW=4`, 256 tokens of real text, the drafter loaded, CPU plan pinned): window picks vs token-at-a-time decode, **413 of 413** on the RTX 3090 alone and **413 of 413** on the 3090 + one 5060 Ti (the two-part batched window with both parts' CPU pools). **Server, EXL3 3.05bpw**, same build, decode tok/s from the engine's `glm stat` lines - a warm-up pass discarded, the mean of two more (they agree within ~3%), drafts accepted in brackets. Prompts: a code answer (512 tokens), the same prompt again at once, an explanation, a short story, and a summary of a 10,941-token document (384 tokens). 9 GPUs (RTX 3090 + 8x RTX 5060 Ti): | Prompt | DFlash2 | MTP | DFlash2 vs MTP | |---|---|---|---| | Code | **79.0** (64%) | 42.8 (89%) | +85% | | Same prompt again | **79.9** (64%) | 42.8 (89%) | +87% | | Explanation | **60.4** (48%) | 40.2 (79%) | +50% | | Short story | **42.9** (34%) | 35.4 (58%) | +21% | | 10.9K-token document | **52.1** (45%) | 39.3 (84%) | +32% | Before this PR, the 9-GPU DFlash2 server ran at ~26.7 tok/s with 0.1% of drafts accepted, and its answers were noise. 2 GPUs (RTX 3090 + RTX 5060 Ti): | Prompt | DFlash2 | MTP | DFlash2 vs MTP | |---|---|---|---| | Code | 14.1 (93%) | **17.3** (88%) | -19% | | Same prompt again | 14.1 (92%) | **19.7** (89%) | -28% | | Explanation | 13.7 (83%) | **17.4** (80%) | -21% | | Short story | 9.9 (59%) | **14.7** (56%) | -32% | | 10.9K-token document | 11.4 (75%) | **15.4** (79%) | -26% | ## Notes - On 2 GPUs DFlash2 is now correct for EXL3 but slower than MTP. Only 40-48% of the routed experts are in VRAM there, so the window's CPU lane takes 190-270 experts and 105-155 ms per token, and EXL3's CPU kernel shares one scratch between the two window lanes, so they take turns. The setup's speed calibration (e5693c0) keeps the drafter only where it is faster, so a 2-GPU EXL3 setup should end up on MTP until then. **I'll fix the 2-GPU DFlash2 decode speed in a future PR** (a CPU-lane scratch per window lane, an EXL3 merged window pass); this PR is the correctness fix. - One GPU was checked for exactness only, not benchmarked. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:24:38 +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#358
No description provided.