[PR #291] [CLOSED] PLE: the n-gram table in FP8 E4M3, as Qwen ships it (opt-in) #2557

Closed
opened 2026-11-04 02:01:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/291
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: pr/ple-fp8


📝 Commits (1)

  • 2a76f67 PLE: the n-gram table in FP8 E4M3, as Qwen ships it

📊 Changes

9 files changed (+332 additions, -44 deletions)

View changed files

📝 CMakeLists.txt (+4 -0)
📝 include/strata/artifact/gguf_reader.hpp (+6 -0)
📝 include/strata/kernels/ngram.hpp (+10 -1)
📝 include/strata/ngram/ple_reader.hpp (+7 -5)
📝 src/kernels/ngram.cpp (+66 -20)
➕ src/kernels/ple_fp8_parity.cpp (+84 -0)
📝 src/ngram/ple_reader.cpp (+22 -15)
📝 src/program/generate.cpp (+10 -3)
➕ tools/ple_fp8_pack.py (+123 -0)

📄 Description

Summary

The engine reads the 51.2e9-value n-gram table only as IQ4_NL (ISTA-DASLab's shard 2, 90 B a row). That table is
8.1% off the checkpoint's own values per row (correlation 0.996-0.997 on rows from all 128 shards, so it is the same
table in the same order). Qwen ships it in FP8 E4M3: 128 shards of [2500012, 160] plus one scale. NVIDIA's NVFP4
checkpoint keeps the same FP8 table.

  • tools/ple_fp8_pack.py copies those FP8 bytes, unchanged, into a one-tensor GGUF: per_layer_token_embd.weight
    [160, 320001536] as I8, with strata.ple.format = f8_e4m3 and strata.ple.scale. The output is 51.2 GB, streamed
    at flat memory.
  • PleTable opens either format; the row size (90 / 160 B) and the decode follow the file. PleReader takes the row
    size at open, and its cache sizes itself by it.
  • A PLE-only file (general.architecture = strata-ple) is not added to the default dense-projection sources.
  • The start line names the table's format.

Measured

Measured on current main (0.1.29, d6708a4) with ISTA-DASLab's IQ2_XS, RTX 5090 32 GB, Ryzen 9 9950X3D, 128 GB DDR5, Windows 11. KL is first-token KL divergence (STRATA_DUMP_FIRST_LOGITS, #276); two runs of main itself differ by 0 on 5 of 6 short prompts and by 0.00013 on the sixth.

First-token KL of the IQ4_NL table against the FP8 one: 0.0009 (1K), 0.0013 (2K), 0.0002 (4K), 0.022 (32K); mean 0.0061, top-1 4/4.

  • Speed. IQ2_XS decode with the FP8 table: 141 / 144 / 151 tok/s, against 136 / 143 / 140 with IQ4_NL
    (400-token answers, --vram-reserve-mib 1500). On an NVFP4 pack: 108-119 against 115-118.
  • Correctness. ple_fp8_parity: rows through Direct, Mmap and gather_batch match torch's decode of the
    checkpoint bit for bit.

Switch

Opt-in: --ple-gguf <the FP8 GGUF>. Nothing changes otherwise.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 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/Niko1221/Strata/pull/291 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/ple-fp8` --- ### 📝 Commits (1) - [`2a76f67`](https://github.com/Niko1221/Strata/commit/2a76f67659e08aafdef47a5fb9aac9618eb90ec8) PLE: the n-gram table in FP8 E4M3, as Qwen ships it ### 📊 Changes **9 files changed** (+332 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+4 -0) 📝 `include/strata/artifact/gguf_reader.hpp` (+6 -0) 📝 `include/strata/kernels/ngram.hpp` (+10 -1) 📝 `include/strata/ngram/ple_reader.hpp` (+7 -5) 📝 `src/kernels/ngram.cpp` (+66 -20) ➕ `src/kernels/ple_fp8_parity.cpp` (+84 -0) 📝 `src/ngram/ple_reader.cpp` (+22 -15) 📝 `src/program/generate.cpp` (+10 -3) ➕ `tools/ple_fp8_pack.py` (+123 -0) </details> ### 📄 Description ## Summary The engine reads the 51.2e9-value n-gram table only as IQ4_NL (ISTA-DASLab's shard 2, 90 B a row). That table is 8.1% off the checkpoint's own values per row (correlation 0.996-0.997 on rows from all 128 shards, so it is the same table in the same order). Qwen ships it in FP8 E4M3: 128 shards of [2500012, 160] plus one scale. NVIDIA's NVFP4 checkpoint keeps the same FP8 table. - `tools/ple_fp8_pack.py` copies those FP8 bytes, unchanged, into a one-tensor GGUF: `per_layer_token_embd.weight` [160, 320001536] as I8, with `strata.ple.format = f8_e4m3` and `strata.ple.scale`. The output is 51.2 GB, streamed at flat memory. - `PleTable` opens either format; the row size (90 / 160 B) and the decode follow the file. `PleReader` takes the row size at open, and its cache sizes itself by it. - A PLE-only file (`general.architecture = strata-ple`) is not added to the default dense-projection sources. - The start line names the table's format. ## Measured Measured on current main (0.1.29, d6708a4) with ISTA-DASLab's IQ2_XS, RTX 5090 32 GB, Ryzen 9 9950X3D, 128 GB DDR5, Windows 11. KL is first-token KL divergence (`STRATA_DUMP_FIRST_LOGITS`, #276); two runs of main itself differ by 0 on 5 of 6 short prompts and by 0.00013 on the sixth. First-token KL of the IQ4_NL table against the FP8 one: 0.0009 (1K), 0.0013 (2K), 0.0002 (4K), 0.022 (32K); mean 0.0061, top-1 4/4. - **Speed.** IQ2_XS decode with the FP8 table: 141 / 144 / 151 tok/s, against 136 / 143 / 140 with IQ4_NL (400-token answers, `--vram-reserve-mib 1500`). On an NVFP4 pack: 108-119 against 115-118. - **Correctness.** `ple_fp8_parity`: rows through Direct, Mmap and `gather_batch` match torch's decode of the checkpoint bit for bit. ## Switch Opt-in: `--ple-gguf <the FP8 GGUF>`. Nothing changes otherwise. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:17 +07:00
Sign in to join this conversation.
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
Niko1221/Strata#2557
No description provided.