[PR #49] [CLOSED] GLM pack: STRATA_GLM_DENSE_QUANT=q5_k|q4_k requantizes the dense rows at load (per GPU, from a layer on) #302

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/49
Author: @sociolog
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: pr5-dense-quant


📝 Commits (2)

  • 83383c3 GLM pack: STRATA_GLM_DENSE_QUANT=q5_k|q4_k requantizes the dense rows at load (per GPU, from a layer on)
  • 0afd555 README: the Tuning table's row for STRATA_GLM_DENSE_QUANT

📊 Changes

2 files changed (+110 additions, -28 deletions)

View changed files

📝 README.md (+1 -0)
📝 src/core/glm_model.cu (+109 -28)

📄 Description

What

The natively served dense rows of a higher-precision type (Q6_K, Q8_0) - KDA q/k/v, attention output, shared experts,
dense FFN, MLA q/kv; not the output head, not the NextN block - are dequantized with ggml's traits and quantized to
the target with ggml_quantize_chunk at load (rows split across the cores, ~20 s). The files are untouched.

  • STRATA_GLM_DENSE_QUANT=q5_k|q4_k (all GPUs), STRATA_GLM_DENSE_QUANT<n> (one GPU's own, 0 = off),
    STRATA_GLM_DENSE_QUANT_FROM=<layer> (only from that layer on), STRATA_GLM_DENSE_QUANT_KINDS (the
    STRATA_GLM_TIMING kind names). README row added.

Rebased onto v1.0.23: #44 moved the dense rows' VRAM sizing into pack_row_vram, so the requant now lives there too
(dense_requant_to, one dense_kind_of), and --layer-split auto's pricing counts the requantized sizes (the all-GPU
setting; a per-GPU STRATA_GLM_DENSE_QUANT<n> is not known before the placement).

Measured (RTX 3090 + 3060 split, Maya-M, 131072 context; KL by score mode, pool and CPU plan pinned, 3,935 tokens)

what VRAM freed (3090 + 3060) KL nats/token decode
whole model q5_k 0.59 + 0.30 GB 0.040 +6 %
whole model q4_k 1.14 + 0.58 GB 0.066 +10 %
from layer 22 q5_k 0.13 + 0.30 GB 0.010 -
3060's half only (layers 29-44) q5_k 0 + 0.30 GB 0.003 +2.5 %
3060's half only q4_k 0 + 0.58 GB 0.008 +2.6 %

The early layers carry nearly all of the quality cost; the late layers' dense weights requantize almost for free.

Checks: on v1.0.21 (whose CUDA sources are those of v1.0.23): build (sm_75, sm_86); glm_dsa_parity, glm_ffn_parity, glm_hc_parity, glm_kda_parity, glm_layer_parity --selftest: all PASS; the --bench request sequence on the real model (RTX 3090 + 3060 split): runs clean. On v1.0.23, as CI runs them: tools/check_hip_compat.py passes (no new CUDA names); server tests OK (3 skipped); tools tests: the one error is test_iq_pack needing the llama.cpp clone (third_party/), the same on plain v1.0.23.


The code, the measurements and this description were produced with the help of Claude, an AI assistant by Anthropic.


🔄 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/49 **Author:** [@sociolog](https://github.com/sociolog) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr5-dense-quant` --- ### 📝 Commits (2) - [`83383c3`](https://github.com/mw00/project-maya/commit/83383c3fb41dd7ce02c60806b4fc070ceff8e76c) GLM pack: STRATA_GLM_DENSE_QUANT=q5_k|q4_k requantizes the dense rows at load (per GPU, from a layer on) - [`0afd555`](https://github.com/mw00/project-maya/commit/0afd55544813151e118d93a020fbb2f276850aa6) README: the Tuning table's row for STRATA_GLM_DENSE_QUANT ### 📊 Changes **2 files changed** (+110 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `src/core/glm_model.cu` (+109 -28) </details> ### 📄 Description ## What The natively served dense rows of a higher-precision type (Q6_K, Q8_0) - KDA q/k/v, attention output, shared experts, dense FFN, MLA q/kv; not the output head, not the NextN block - are dequantized with ggml's traits and quantized to the target with `ggml_quantize_chunk` at load (rows split across the cores, ~20 s). The files are untouched. - `STRATA_GLM_DENSE_QUANT=q5_k|q4_k` (all GPUs), `STRATA_GLM_DENSE_QUANT<n>` (one GPU's own, `0` = off), `STRATA_GLM_DENSE_QUANT_FROM=<layer>` (only from that layer on), `STRATA_GLM_DENSE_QUANT_KINDS` (the `STRATA_GLM_TIMING` kind names). README row added. Rebased onto v1.0.23: #44 moved the dense rows' VRAM sizing into `pack_row_vram`, so the requant now lives there too (`dense_requant_to`, one `dense_kind_of`), and `--layer-split auto`'s pricing counts the requantized sizes (the all-GPU setting; a per-GPU `STRATA_GLM_DENSE_QUANT<n>` is not known before the placement). ## Measured (RTX 3090 + 3060 split, Maya-M, 131072 context; KL by score mode, pool and CPU plan pinned, 3,935 tokens) | what | VRAM freed (3090 + 3060) | KL nats/token | decode | |---|---|---:|---:| | whole model q5_k | 0.59 + 0.30 GB | 0.040 | +6 % | | whole model q4_k | 1.14 + 0.58 GB | 0.066 | +10 % | | from layer 22 q5_k | 0.13 + 0.30 GB | 0.010 | - | | **3060's half only (layers 29-44) q5_k** | 0 + 0.30 GB | **0.003** | +2.5 % | | 3060's half only q4_k | 0 + 0.58 GB | 0.008 | +2.6 % | The early layers carry nearly all of the quality cost; the late layers' dense weights requantize almost for free. **Checks:** on v1.0.21 (whose CUDA sources are those of v1.0.23): build (sm_75, sm_86); `glm_dsa_parity`, `glm_ffn_parity`, `glm_hc_parity`, `glm_kda_parity`, `glm_layer_parity` `--selftest`: all PASS; the `--bench` request sequence on the real model (RTX 3090 + 3060 split): runs clean. On v1.0.23, as CI runs them: `tools/check_hip_compat.py` passes (no new CUDA names); server tests OK (3 skipped); tools tests: the one error is `test_iq_pack` needing the llama.cpp clone (`third_party/`), the same on plain v1.0.23. --- *The code, the measurements and this description were produced with the help of Claude, an AI assistant by Anthropic.* --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:23:58 +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#302
No description provided.