[PR #264] [MERGED] EXL3 tests against exllamav3 itself: its packer's tiles and a model's matrices - every decoder the same bits #435

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/264
Author: @sociolog
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @mw00

Base: main ← Head: exl3-exllamav3-tests


📝 Commits (1)

  • f6d998f EXL3 tests against exllamav3 itself: its packer's tiles and a model's matrices - every decoder the same bits

📊 Changes

16 files changed (+664 additions, -16 deletions)

View changed files

📝 CMakeLists.txt (+3 -0)
➕ data/exl3-exllamav3/exl3_k2_10_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_12_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_14_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_16_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_2_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_4_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_6_cb0.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_6_cb1.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_6_cb2.bin (+0 -0)
➕ data/exl3-exllamav3/exl3_k2_8_cb2.bin (+0 -0)
📝 include/strata/kernels/cpu/exl3_ref.hpp (+3 -0)
📝 src/kernels/cpu/exl3_ref.cpp (+14 -7)
📝 tests/exl3_test.cu (+391 -9)
➕ tools/exl3_exllamav3_fixture.py (+177 -0)
➕ tools/test_exl3_exllamav3.py (+76 -0)

📄 Description

What

The EXL3 decoders - the CPU reference (exl3_ref.cpp), the device kernels, the CPU lane's arithmetic and
tools/exl3_pack.py's numpy decoder behind --check - are tested against each other (exl3_test), so a mistake they
share would pass. This holds them to exllamav3's own output, bit for bit:

  • tools/exl3_exllamav3_fixture.py runs in an exllamav3 environment on a CUDA device. Random 16-bit trellis states
    packed by exllamav3's pack_trellis, then each step's state as its unpack_trellis reads it and W' as its
    reconstruct decodes it (exllamav3's own pack(unpack(words)) == words is checked first). --model writes a model's
    matrices as stored, with exllamav3's W' and its reconstruct_had_slice's W.
  • data/exl3-exllamav3/: exllamav3 1.6.2's fixtures for K 1..8 with mul1 and K 3 with 3inst and mcg (2 x 8 tiles
    each, 10 files, 208 KB).
  • tools/test_exl3_exllamav3.py (so the CI's tools tests check it, no GPU): exl3_pack's states and W' against them.
  • exl3_test --exllamav3 <dir> (ctest exl3_exllamav3): the CPU reference's states (exl3_tile_states, new -
    exl3_inner now decodes through it, same results) and W', the bit-by-bit window of the exact model the CPU tiers are
    tested against, the device's W' in both layouts (reconstruct_inner, reconstruct_inner_rows), and every CPU tier
    this machine runs against that model on exllamav3's tiles.
  • exl3_test --expect <dir>: the same on a model's matrices (the tool's --model files; not a ctest - it needs the
    model), plus the full weight (reconstruct_rows) against the exact W = diag(suh) H W' H diag(svh) computed in F64,
    and the CPU lane's product against the reference's.

No engine code changes (one function split out of exl3_inner).

Results

RTX 3060 (sm_86) and a Ryzen 9 5900X (AVX2), exllamav3 1.6.2 + torch 2.9:

  • Every fixture: 0 of 4,096 states and 0 of 4,096 weights differ in the CPU reference, the exact model and
    exl3_pack's decoder; the device's W' 0 of 16,384 in both layouts; the AVX2 tier bit for bit the model.
  • turboderp's GLM-5.3-Flash EXL3 sc_3.10bpw, 12 matrices - routed experts of layers 3, 10 and 44 and of the MTP block
    (K 3 / 4), the shared expert, o_proj, eh_proj, q_a and kv_a (K 4 / 6): W' 0 differences in 2-34 M weights
    each, from the CPU reference and the device in both layouts; the AVX2 tier bit for bit its model.
  • The full weight: the device's 2.9e-4 relative to the exact one (one FP16 rounding of the tile between the two
    transforms and one of the result; worst 5.3e-4 of the largest weight); exllamav3's fused reconstruct_had_slice
    9.3e-4 from it (its FP16 intermediates, worst 1.4e-3) - so the two agree to ~1e-3 and no tighter, and the check is
    against the exact weight instead.
  • exl3_test as before (142 ok, the same numbers to the last digit); the tools tests (272) and
    tools/check_hip_compat.py pass.

The tool also takes exllamav3 1.6's half-integer bitrates once the engine does (a follow-up PR).

🤖 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/264 **Author:** [@sociolog](https://github.com/sociolog) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `exl3-exllamav3-tests` --- ### 📝 Commits (1) - [`f6d998f`](https://github.com/mw00/project-maya/commit/f6d998f74d231867b567fdfe5445705cb8087375) EXL3 tests against exllamav3 itself: its packer's tiles and a model's matrices - every decoder the same bits ### 📊 Changes **16 files changed** (+664 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+3 -0) ➕ `data/exl3-exllamav3/exl3_k2_10_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_12_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_14_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_16_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_2_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_4_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_6_cb0.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_6_cb1.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_6_cb2.bin` (+0 -0) ➕ `data/exl3-exllamav3/exl3_k2_8_cb2.bin` (+0 -0) 📝 `include/strata/kernels/cpu/exl3_ref.hpp` (+3 -0) 📝 `src/kernels/cpu/exl3_ref.cpp` (+14 -7) 📝 `tests/exl3_test.cu` (+391 -9) ➕ `tools/exl3_exllamav3_fixture.py` (+177 -0) ➕ `tools/test_exl3_exllamav3.py` (+76 -0) </details> ### 📄 Description ## What The EXL3 decoders - the CPU reference (`exl3_ref.cpp`), the device kernels, the CPU lane's arithmetic and `tools/exl3_pack.py`'s numpy decoder behind `--check` - are tested against each other (`exl3_test`), so a mistake they share would pass. This holds them to exllamav3's own output, bit for bit: - **`tools/exl3_exllamav3_fixture.py`** runs in an exllamav3 environment on a CUDA device. Random 16-bit trellis states packed by exllamav3's `pack_trellis`, then each step's state as its `unpack_trellis` reads it and W' as its `reconstruct` decodes it (exllamav3's own `pack(unpack(words)) == words` is checked first). `--model` writes a model's matrices as stored, with exllamav3's W' and its `reconstruct_had_slice`'s W. - **`data/exl3-exllamav3/`**: exllamav3 1.6.2's fixtures for K 1..8 with mul1 and K 3 with 3inst and mcg (2 x 8 tiles each, 10 files, 208 KB). - **`tools/test_exl3_exllamav3.py`** (so the CI's tools tests check it, no GPU): `exl3_pack`'s states and W' against them. - **`exl3_test --exllamav3 <dir>`** (ctest `exl3_exllamav3`): the CPU reference's states (`exl3_tile_states`, new - `exl3_inner` now decodes through it, same results) and W', the bit-by-bit window of the exact model the CPU tiers are tested against, the device's W' in both layouts (`reconstruct_inner`, `reconstruct_inner_rows`), and every CPU tier this machine runs against that model on exllamav3's tiles. - **`exl3_test --expect <dir>`**: the same on a model's matrices (the tool's `--model` files; not a ctest - it needs the model), plus the full weight (`reconstruct_rows`) against the exact W = diag(suh) H W' H diag(svh) computed in F64, and the CPU lane's product against the reference's. No engine code changes (one function split out of `exl3_inner`). ## Results RTX 3060 (sm_86) and a Ryzen 9 5900X (AVX2), exllamav3 1.6.2 + torch 2.9: - Every fixture: 0 of 4,096 states and 0 of 4,096 weights differ in the CPU reference, the exact model and `exl3_pack`'s decoder; the device's W' 0 of 16,384 in both layouts; the AVX2 tier bit for bit the model. - turboderp's GLM-5.3-Flash EXL3 `sc_3.10bpw`, 12 matrices - routed experts of layers 3, 10 and 44 and of the MTP block (K 3 / 4), the shared expert, `o_proj`, `eh_proj`, `q_a` and `kv_a` (K 4 / 6): W' **0 differences** in 2-34 M weights each, from the CPU reference and the device in both layouts; the AVX2 tier bit for bit its model. - The full weight: the device's 2.9e-4 relative to the exact one (one FP16 rounding of the tile between the two transforms and one of the result; worst 5.3e-4 of the largest weight); exllamav3's fused `reconstruct_had_slice` 9.3e-4 from it (its FP16 intermediates, worst 1.4e-3) - so the two agree to ~1e-3 and no tighter, and the check is against the exact weight instead. - `exl3_test` as before (142 ok, the same numbers to the last digit); the tools tests (272) and `tools/check_hip_compat.py` pass. The tool also takes exllamav3 1.6's half-integer bitrates once the engine does (a follow-up PR). 🤖 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:25:23 +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#435
No description provided.