[PR #5433] [Engine] Auto-load sibling token-embd-bf16.gguf for sub-8-bit native token embeddings #5422

Open
opened 2026-11-07 16:35:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5433
Author: @bsorensen110
Created: 11/6/2026
Status: 🔄 Open

Base: main ← Head: feat/auto-bf16-embd-sidecar


📝 Commits (2)

  • dbb1086 [verified] feat(embed): auto-load sibling token-embd-bf16.gguf for sub-8-bit native embeddings
  • 9e3626b fix(embed): address review on BF16 sidecar auto-discovery

📊 Changes

8 files changed (+237 additions, -9 deletions)

View changed files

📝 docs/QUANTS.md (+15 -5)
📝 include/strata/core/native_head.hpp (+5 -0)
📝 src/core/native_head.cpp (+45 -0)
📝 src/kernels/native_expert_parity.cpp (+56 -0)
📝 src/program/generate.cpp (+13 -2)
📝 sycl/src/core/native_head.cpp (+46 -0)
📝 sycl/src/program/generate.cpp (+13 -2)
📝 tools/embd_bf16_pack.py (+44 -0)

📄 Description

Plain-English overview

Think of token_embd.weight as the dictionary at the very front door of the model.
Before Layer 0 even starts, every word/token ID gets turned into a list of 2,560 numbers (its vector) by looking up its row in this table.

1. What the 1- to 4-bit GGUFs ship vs. what docs/QUANTS.md assumed

  • docs/QUANTS.md assumed Unsloth kept this front-door dictionary at 8-bit (Q8_0, which is ~99.5% accurate) in every model.
  • That is true for UD-Q4_K_XL and larger — but in UD-IQ4_XS (and all the 1- to 3-bit models), the front-door dictionary is compressed down to 3- or 4-bit (IQ4_XS in UD-IQ4_XS) to save ~890 MB of file size.
  • 8.07% error (21.9 dB SNR): Comparing those 4-bit IQ4_XS vectors against Qwen's original 16-bit (BF16) checkpoint vectors shows every token entering Layer 0 starts out ~8% off from its true coordinates. Every single layer (all 48 of them, plus the DFlash2/MTP drafters) then does math on a slightly blurred input signal.

2. Why fixing it costs zero VRAM and zero decode speed

  • Normally, making a weight tensor 4x bigger (322 MiB -> 1,212 MiB) would eat GPU VRAM and slow down memory bandwidth.
  • Why it costs 0 B of VRAM: The dictionary has 248,320 words, but in any verify step the GPU only needs the 1 to 8 words currently being processed. Strata's NativeEmbed keeps the whole 1.21 GiB dictionary in system RAM (pinned so the GPU reads it directly over PCIe) and only pulls the few rows it needs each step. The GPU keeps the exact same number of resident expert slots (10,992 slots / 25.15 GiB on a 32 GB R9700).
  • Why it costs zero decode speed: For an entire 8-token verify window + 7-token DFlash2 draft (15 tokens total), reading 16-bit rows instead of 4-bit rows over PCIe 5.0 (55.8 GB/s) transfers an extra 56 KB per step. At 55.8 GB/s, 56 KB takes 1 microsecond (0.001 ms) out of a 24 ms step (0.004% of step time).

3. What the quality numbers actually mean
Feeding both setups the exact same 4,995 tokens of real text (data/quant_quality/v1: code, docs, english, multilingual, agent) and comparing the model's next-word predictions at every single token position:

  • Top-1 agreement = 95.12% (4.88% of tokens flip):
    • Roughly 1 out of every 20 words (244 out of 4,995 positions — and nearly 1 out of 11 words on docs), the 4-bit embedding noise was enough to tip a close race at the end of Layer 47 and make the model pick a different #1 next word than it picks with the clean BF16 input.
  • KL divergence = 0.02602 (why this number is large):
    • KL divergence measures how much the model's overall probability ranking over the next word gets distorted (0 = identical).
    • In docs/QUANTS.md, shrinking all 48 layers of routed experts from Q8_0 (188 GB) down to UD-Q5_K_XL (158 GB) causes a KL distortion of 0.0247, and shrinking the whole model all the way to UD-IQ4_XS (94 GB) causes 0.0566.
    • Fixing just this one 1.2 GB front-door table removes 0.0260 of distortion — roughly the same magnitude of distribution shift as stepping up a full quantization tier, without touching VRAM or speed.
  • Perplexity (PPL) drops on prose, docs, and multilingual (-0.09% to -0.76%):
    • Perplexity measures how uncertain the model is when reading real text (lower = better, more confident on the right words). With the clean BF16 input vectors, perplexity improved on English prose (4.241 -> 4.209), multilingual text (2.656 -> 2.646), and technical docs (9.530 -> 9.521).

Problem and result

In Qwen3.8-Flash-Next-UD-IQ4_XS (both the 3-shard 38bb39ee release and the 4-shard v3.1 release) as well as the 1- to 3-bit packs (IQ3_S, IQ3_XXS, IQ2_XS, Q2_0, IQ1_M), token_embd.weight ([2560, 248320]) is quantized to 3- or 4-bit (IQ4_XS in UD-IQ4_XS, 322.07 MiB, 1,360 B/row, 4.25 bpw) rather than Q8_0.

Comparing UD-IQ4_XS's IQ4_XS token_embd.weight directly against Qwen's original BF16 checkpoint embedding (token-embd-bf16.gguf, 1,212.50 MiB, 5,120 B/row) across the 1,445 active vocabulary tokens of data/quant_quality/v1 (and a 16,384-row uniform vocabulary sample) shows:

  • Row-level quantization error: 8.074% mean relative L2 error (7.791% full-vocab; p99 9.619%), 21.88 dB mean SNR, cosine similarity 0.996722.
  • Teacher-forced decode impact across all 4,995 positions of data/quant_quality/v1 (--resident-experts --ram-keep-gib 40 --pcie-frac 0):
    • Top-1 token agreement (BF16_embd vs IQ4_XS_embd): 95.12% — 244 / 4,995 (4.88%) of greedy top-1 token predictions flip solely from replacing the 4-bit input embedding with the BF16 checkpoint embedding (docs: 91.19% top-1 agreement / 88 flips; agent: 93.29% / 67 flips; english: 94.99% / 50 flips).
    • Mean KL(BF16_embd || IQ4_XS_embd): 0.02602 nats (p99 = 0.2580), nearly half the magnitude of UD-IQ4_XS's total 48-layer quantization KL vs Q8_0 (0.05660 in docs/QUANTS.md).
    • Perplexity (PPL, BF16_embd vs IQ4_XS_embd): improves on english (4.2413 -> 4.2090, -0.0323 / -0.76%), multilingual (2.6562 -> 2.6464, -0.0098 / -0.37%), docs (9.5298 -> 9.5213, -0.0085 / -0.09%), and overall (3.9539 -> 3.9531).
  • Resource and speed cost on R9700 (gfx1201, 32 GiB VRAM, PCIe 5.0 x16 at 55.8 GB/s):
    • VRAM: 0 B (NativeEmbed keeps token_embd.weight in pinned mapped host memory and gathers only the T active rows over PCIe; resident expert cache remains identical at 10,992 slots / 25.15 GiB).
    • Pinned host RAM: +890.4 MiB (1,212.5 MiB BF16 vs 322.1 MiB unmapped IQ4_XS), +0.1 s startup (0.1 -> 0.2 s).
    • PCIe / decode speed: +3,760 B/token (+56.4 KB / ~1.0 us per 15-row verify + DFlash2 step, < 0.005% of window time). Across 4 interleaved runs per arm (300 tokens across code, docs, english at temp=0.0, 0.7, 1.0), decode throughput is unchanged within trajectory/sampling variance (sampled_t0.7 3-domain mean 78.59 vs 77.82 tok/s; sampled_t1.0 3-domain mean 71.77 vs 73.68 tok/s; code greedy 96.25 -> 104.56 tok/s due to higher DFlash2 acceptance on the BF16 greedy trajectory).

This PR adds NativeEmbed::auto_bf16_sidecar(...) so that when --embd-gguf is omitted and STRATA_AUTO_EMBD_BF16 is not "0", the engine automatically uses a validated sibling token-embd-bf16.gguf whenever the model's token_embd.weight is narrower than 8-bit, adds --fetch to tools/embd_bf16_pack.py to download and SHA-256-verify Qwen's token-embd-bf16.gguf, and updates docs/QUANTS.md.

Builds on PR #290 (--embd-gguf and tools/embd_bf16_pack.py).

Approach

  • include/strata/core/native_head.hpp:60-64, src/core/native_head.cpp:290-331, sycl/src/core/native_head.cpp:289-330: Add NativeEmbed::auto_bf16_sidecar(shards, n_embd, n_vocab, &replaced_type):
    • Fast-paths out immediately via std::filesystem::is_regular_file if no token-embd-bf16.gguf exists in <shard0_dir>/, <shard0_dir>/../, or <shard0_dir>/../embd/, or if STRATA_AUTO_EMBD_BF16=0.
    • Inspects token_embd.weight in shards and returns {} if it is already 8-bit or wider (F32=0, F16=1, Q8_0=8, BF16=30), leaving UD-Q4_K_XL, UD-Q5_K_XL, UD-Q6_K_XL, and Q8_0 untouched unless --embd-gguf is explicitly passed.
    • Validates that the candidate token-embd-bf16.gguf has general.architecture == "strata-embd", token_embd.weight of type BF16 (30), shape [n_embd, n_vocab], and complete in-bounds payload bytes before returning its path.
  • src/program/generate.cpp:4918-4947, sycl/src/program/generate.cpp:2942-2961: Call NativeEmbed::auto_bf16_sidecar when o.embd_gguf.empty() and report the replacement in the startup banner (token embedding BF16 (token-embd-bf16.gguf, replacing IQ4_XS) in mapped host memory (1212 MiB, 0.2 s)). Keeping auto-discovery at the generate.cpp caller preserves NativeEmbed::load(shards, ...)'s direct contract for native_expert_parity --gguf-embd.
  • src/kernels/native_expert_parity.cpp:749-794: Extend --bf16-embd (check_bf16_embd) with a synthetic GGUF regression test verifying that auto_bf16_sidecar upgrades IQ4_XS (23) to token-embd-bf16.gguf, leaves Q8_0 (8) unchanged, and respects STRATA_AUTO_EMBD_BF16=0.
  • tools/embd_bf16_pack.py: Add --fetch to download and SHA-256-verify Qwen3.8-Flash-Next's token-embd-bf16.gguf (1,271,398,656 B, SHA-256 386203af9070c7b43acb24ded8922876721d97bbad1a709b25cb49d694a7f51d, matching setup.py:297).
  • docs/QUANTS.md: Document that UD-IQ4_XS stores token_embd.weight as IQ4_XS (322 MiB) rather than Q8_0, along with the measured quant_quality/v1 KL/top-1/PPL impact of replacing it with token-embd-bf16.gguf.

Validation

Tested on revision dbb1086aa (based on main 54828c7ef, Strata 0.2.10 / engine 0.1.57) on Linux (7.3.1-1-cachyos-server, AMD Radeon AI PRO R9700 gfx1201 32 GB VRAM, 128 GB RAM, ROCm 10.2.0a20260914).

Passed:

  • ./build-hip/native_expert_parity --bf16-embd on dbb1086aa: bf16 embedding: 97 gathered rows, 0 differ; dequant of 156160 values, 0 differ in any bit, bf16 sidecar auto-discovery: ok, native_expert_parity: 0 failures.
  • ./build-hip/native_expert_parity --gguf-embd .../token-embd-bf16.gguf 512: 248320 rows, 512 random rows gathered on the GPU, 0 rows / 0 values differ from ggml to_float; iq_dequant_f32 row: bitwise equal.
  • ./build-hip/native_expert_parity --gguf-embd .../Qwen3.8-Flash-Next-UD-IQ4_XS-00002-of-00004.gguf 512: 0 rows / 0 values differ from ggml to_float; iq_dequant_f32 row: bitwise equal.
  • python tools/embd_bf16_pack.py --fetch --out .../token-embd-bf16.gguf: verified existing .../token-embd-bf16.gguf (1271398656 B).
  • End-to-end startup and data/quant_quality/v1 evaluation (4,995 teacher-forced positions + 20 prompt logit dumps + 4 interleaved decode runs per arm) on UD-IQ4_XS v31 on R9700 (gfx1201): confirmed token embedding BF16 (token-embd-bf16.gguf, replacing IQ4_XS) in mapped host memory (1212 MiB, 0.2 s) and 10,992 resident expert slots (25.15 GiB VRAM) in both arms.

Failed:

  • none observed

Not run:

  • SYCL runtime execution (no Intel Arc GPU on this host; sycl/src/core/native_head.cpp and sycl/src/program/generate.cpp updated in lockstep with src/).

Limits

  • Requires token-embd-bf16.gguf (1.27 GB on disk, +890 MiB pinned mapped host RAM over IQ4_XS) to be present in the shard directory, its parent directory, or ../embd/ (or passed via --embd-gguf); when absent, startup does not download anything and uses the shard's own token_embd.weight unchanged.
  • Does not auto-replace Q8_0 embeddings (such as UD-Q4_K_XL and above, where Q8_0 is already within 0.56% of BF16); users who want BF16 over Q8_0 can still pass --embd-gguf explicitly.

Reproduction

cmake --build build-hip --target strata native_expert_parity -j16
./build-hip/native_expert_parity --bf16-embd
python tools/embd_bf16_pack.py --fetch --out /path/to/shards/token-embd-bf16.gguf

🔄 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/5433 **Author:** [@bsorensen110](https://github.com/bsorensen110) **Created:** 11/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/auto-bf16-embd-sidecar` --- ### 📝 Commits (2) - [`dbb1086`](https://github.com/Niko1221/Strata/commit/dbb1086aa414412b00e7a637110d76b1fddb65f7) [verified] feat(embed): auto-load sibling token-embd-bf16.gguf for sub-8-bit native embeddings - [`9e3626b`](https://github.com/Niko1221/Strata/commit/9e3626b5e938de028e66d107e28e1d990cf6d86e) fix(embed): address review on BF16 sidecar auto-discovery ### 📊 Changes **8 files changed** (+237 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `docs/QUANTS.md` (+15 -5) 📝 `include/strata/core/native_head.hpp` (+5 -0) 📝 `src/core/native_head.cpp` (+45 -0) 📝 `src/kernels/native_expert_parity.cpp` (+56 -0) 📝 `src/program/generate.cpp` (+13 -2) 📝 `sycl/src/core/native_head.cpp` (+46 -0) 📝 `sycl/src/program/generate.cpp` (+13 -2) 📝 `tools/embd_bf16_pack.py` (+44 -0) </details> ### 📄 Description ## Plain-English overview Think of `token_embd.weight` as the **dictionary at the very front door of the model**. Before Layer 0 even starts, every word/token ID gets turned into a list of `2,560` numbers (its vector) by looking up its row in this table. **1. What the 1- to 4-bit GGUFs ship vs. what `docs/QUANTS.md` assumed** - `docs/QUANTS.md` assumed Unsloth kept this front-door dictionary at 8-bit (`Q8_0`, which is ~99.5% accurate) in every model. - That is true for `UD-Q4_K_XL` and larger — **but in `UD-IQ4_XS` (and all the 1- to 3-bit models), the front-door dictionary is compressed down to 3- or 4-bit (`IQ4_XS` in `UD-IQ4_XS`)** to save ~`890 MB` of file size. - **8.07% error (`21.9 dB` SNR):** Comparing those 4-bit `IQ4_XS` vectors against Qwen's original 16-bit (`BF16`) checkpoint vectors shows every token entering Layer 0 starts out **~8% off** from its true coordinates. Every single layer (all 48 of them, plus the DFlash2/MTP drafters) then does math on a slightly blurred input signal. **2. Why fixing it costs zero VRAM and zero decode speed** - Normally, making a weight tensor 4x bigger (`322 MiB` -> `1,212 MiB`) would eat GPU VRAM and slow down memory bandwidth. - **Why it costs `0 B` of VRAM:** The dictionary has `248,320` words, but in any verify step the GPU only needs the **1 to 8 words currently being processed**. Strata's `NativeEmbed` keeps the whole `1.21 GiB` dictionary in **system RAM** (pinned so the GPU reads it directly over PCIe) and only pulls the few rows it needs each step. The GPU keeps the exact same number of resident expert slots (`10,992` slots / `25.15 GiB` on a 32 GB R9700). - **Why it costs zero decode speed:** For an entire 8-token verify window + 7-token DFlash2 draft (`15` tokens total), reading 16-bit rows instead of 4-bit rows over PCIe 5.0 (`55.8 GB/s`) transfers an extra **`56 KB` per step**. At `55.8 GB/s`, `56 KB` takes **1 microsecond (`0.001 ms`)** out of a `24 ms` step (`0.004%` of step time). **3. What the quality numbers actually mean** Feeding both setups the exact same `4,995` tokens of real text (`data/quant_quality/v1`: `code`, `docs`, `english`, `multilingual`, `agent`) and comparing the model's next-word predictions at every single token position: - **Top-1 agreement = `95.12%` (`4.88%` of tokens flip):** - Roughly **1 out of every 20 words** (`244` out of `4,995` positions — and nearly **1 out of 11 words on `docs`**), the 4-bit embedding noise was enough to tip a close race at the end of Layer 47 and make the model pick a **different #1 next word** than it picks with the clean BF16 input. - **KL divergence = `0.02602` (why this number is large):** - `KL divergence` measures how much the model's overall probability ranking over the next word gets distorted (`0` = identical). - In `docs/QUANTS.md`, shrinking **all 48 layers of routed experts** from `Q8_0` (`188 GB`) down to `UD-Q5_K_XL` (`158 GB`) causes a KL distortion of **`0.0247`**, and shrinking the whole model all the way to `UD-IQ4_XS` (`94 GB`) causes **`0.0566`**. - Fixing just this one `1.2 GB` front-door table removes **`0.0260` of distortion** — roughly the same magnitude of distribution shift as stepping up a full quantization tier, without touching VRAM or speed. - **Perplexity (`PPL`) drops on prose, docs, and multilingual (`-0.09%` to `-0.76%`):** - Perplexity measures how uncertain the model is when reading real text (lower = better, more confident on the right words). With the clean BF16 input vectors, perplexity improved on English prose (`4.241` -> `4.209`), multilingual text (`2.656` -> `2.646`), and technical docs (`9.530` -> `9.521`). --- ## Problem and result In `Qwen3.8-Flash-Next-UD-IQ4_XS` (both the 3-shard `38bb39ee` release and the 4-shard `v3.1` release) as well as the 1- to 3-bit packs (`IQ3_S`, `IQ3_XXS`, `IQ2_XS`, `Q2_0`, `IQ1_M`), `token_embd.weight` (`[2560, 248320]`) is quantized to 3- or 4-bit (`IQ4_XS` in `UD-IQ4_XS`, `322.07 MiB`, `1,360 B/row`, `4.25 bpw`) rather than `Q8_0`. Comparing `UD-IQ4_XS`'s `IQ4_XS` `token_embd.weight` directly against Qwen's original BF16 checkpoint embedding (`token-embd-bf16.gguf`, `1,212.50 MiB`, `5,120 B/row`) across the `1,445` active vocabulary tokens of `data/quant_quality/v1` (and a `16,384`-row uniform vocabulary sample) shows: - **Row-level quantization error:** `8.074%` mean relative L2 error (`7.791%` full-vocab; p99 `9.619%`), `21.88 dB` mean SNR, cosine similarity `0.996722`. - **Teacher-forced decode impact across all `4,995` positions of `data/quant_quality/v1` (`--resident-experts --ram-keep-gib 40 --pcie-frac 0`):** - **Top-1 token agreement (`BF16_embd` vs `IQ4_XS_embd`):** **`95.12%`** — **`244 / 4,995` (`4.88%`) of greedy top-1 token predictions flip** solely from replacing the 4-bit input embedding with the BF16 checkpoint embedding (`docs`: `91.19%` top-1 agreement / `88` flips; `agent`: `93.29%` / `67` flips; `english`: `94.99%` / `50` flips). - **Mean `KL(BF16_embd || IQ4_XS_embd)`:** **`0.02602 nats`** (`p99 = 0.2580`), nearly half the magnitude of `UD-IQ4_XS`'s total 48-layer quantization KL vs `Q8_0` (`0.05660` in `docs/QUANTS.md`). - **Perplexity (`PPL`, `BF16_embd` vs `IQ4_XS_embd`):** improves on `english` (`4.2413 -> 4.2090`, **`-0.0323` / `-0.76%`**), `multilingual` (`2.6562 -> 2.6464`, **`-0.0098` / `-0.37%`**), `docs` (`9.5298 -> 9.5213`, **`-0.0085` / `-0.09%`**), and overall (`3.9539 -> 3.9531`). - **Resource and speed cost on R9700 (`gfx1201`, 32 GiB VRAM, PCIe 5.0 x16 at `55.8 GB/s`):** - **VRAM:** **`0 B`** (`NativeEmbed` keeps `token_embd.weight` in pinned mapped host memory and gathers only the `T` active rows over PCIe; resident expert cache remains identical at **`10,992` slots / `25.15 GiB`**). - **Pinned host RAM:** **`+890.4 MiB`** (`1,212.5 MiB` BF16 vs `322.1 MiB` unmapped `IQ4_XS`), `+0.1 s` startup (`0.1 -> 0.2 s`). - **PCIe / decode speed:** `+3,760 B/token` (`+56.4 KB` / `~1.0 us` per 15-row verify + DFlash2 step, `< 0.005%` of window time). Across 4 interleaved runs per arm (`300` tokens across `code`, `docs`, `english` at `temp=0.0, 0.7, 1.0`), decode throughput is unchanged within trajectory/sampling variance (`sampled_t0.7` 3-domain mean `78.59` vs `77.82 tok/s`; `sampled_t1.0` 3-domain mean `71.77` vs `73.68 tok/s`; `code` greedy `96.25 -> 104.56 tok/s` due to higher DFlash2 acceptance on the BF16 greedy trajectory). This PR adds `NativeEmbed::auto_bf16_sidecar(...)` so that when `--embd-gguf` is omitted and `STRATA_AUTO_EMBD_BF16` is not `"0"`, the engine automatically uses a validated sibling `token-embd-bf16.gguf` whenever the model's `token_embd.weight` is narrower than 8-bit, adds `--fetch` to `tools/embd_bf16_pack.py` to download and SHA-256-verify Qwen's `token-embd-bf16.gguf`, and updates `docs/QUANTS.md`. ## Related discussion Builds on PR #290 (`--embd-gguf` and `tools/embd_bf16_pack.py`). ## Approach - **`include/strata/core/native_head.hpp:60-64`, `src/core/native_head.cpp:290-331`, `sycl/src/core/native_head.cpp:289-330`:** Add `NativeEmbed::auto_bf16_sidecar(shards, n_embd, n_vocab, &replaced_type)`: - Fast-paths out immediately via `std::filesystem::is_regular_file` if no `token-embd-bf16.gguf` exists in `<shard0_dir>/`, `<shard0_dir>/../`, or `<shard0_dir>/../embd/`, or if `STRATA_AUTO_EMBD_BF16=0`. - Inspects `token_embd.weight` in `shards` and returns `{}` if it is already 8-bit or wider (`F32=0`, `F16=1`, `Q8_0=8`, `BF16=30`), leaving `UD-Q4_K_XL`, `UD-Q5_K_XL`, `UD-Q6_K_XL`, and `Q8_0` untouched unless `--embd-gguf` is explicitly passed. - Validates that the candidate `token-embd-bf16.gguf` has `general.architecture == "strata-embd"`, `token_embd.weight` of type `BF16` (`30`), shape `[n_embd, n_vocab]`, and complete in-bounds payload bytes before returning its path. - **`src/program/generate.cpp:4918-4947`, `sycl/src/program/generate.cpp:2942-2961`:** Call `NativeEmbed::auto_bf16_sidecar` when `o.embd_gguf.empty()` and report the replacement in the startup banner (`token embedding BF16 (token-embd-bf16.gguf, replacing IQ4_XS) in mapped host memory (1212 MiB, 0.2 s)`). Keeping auto-discovery at the `generate.cpp` caller preserves `NativeEmbed::load(shards, ...)`'s direct contract for `native_expert_parity --gguf-embd`. - **`src/kernels/native_expert_parity.cpp:749-794`:** Extend `--bf16-embd` (`check_bf16_embd`) with a synthetic GGUF regression test verifying that `auto_bf16_sidecar` upgrades `IQ4_XS` (`23`) to `token-embd-bf16.gguf`, leaves `Q8_0` (`8`) unchanged, and respects `STRATA_AUTO_EMBD_BF16=0`. - **`tools/embd_bf16_pack.py`:** Add `--fetch` to download and SHA-256-verify Qwen3.8-Flash-Next's `token-embd-bf16.gguf` (`1,271,398,656` B, SHA-256 `386203af9070c7b43acb24ded8922876721d97bbad1a709b25cb49d694a7f51d`, matching `setup.py:297`). - **`docs/QUANTS.md`:** Document that `UD-IQ4_XS` stores `token_embd.weight` as `IQ4_XS` (`322 MiB`) rather than `Q8_0`, along with the measured `quant_quality/v1` KL/top-1/PPL impact of replacing it with `token-embd-bf16.gguf`. ## Validation Tested on revision `dbb1086aa` (based on `main` `54828c7ef`, Strata 0.2.10 / engine 0.1.57) on Linux (`7.3.1-1-cachyos-server`, AMD Radeon AI PRO R9700 `gfx1201` 32 GB VRAM, 128 GB RAM, ROCm 10.2.0a20260914). **Passed:** - `./build-hip/native_expert_parity --bf16-embd` on `dbb1086aa`: `bf16 embedding: 97 gathered rows, 0 differ; dequant of 156160 values, 0 differ in any bit`, `bf16 sidecar auto-discovery: ok`, `native_expert_parity: 0 failures`. - `./build-hip/native_expert_parity --gguf-embd .../token-embd-bf16.gguf 512`: `248320 rows, 512 random rows gathered on the GPU, 0 rows / 0 values differ from ggml to_float; iq_dequant_f32 row: bitwise equal`. - `./build-hip/native_expert_parity --gguf-embd .../Qwen3.8-Flash-Next-UD-IQ4_XS-00002-of-00004.gguf 512`: `0 rows / 0 values differ from ggml to_float; iq_dequant_f32 row: bitwise equal`. - `python tools/embd_bf16_pack.py --fetch --out .../token-embd-bf16.gguf`: `verified existing .../token-embd-bf16.gguf (1271398656 B)`. - End-to-end startup and `data/quant_quality/v1` evaluation (`4,995` teacher-forced positions + `20` prompt logit dumps + 4 interleaved decode runs per arm) on `UD-IQ4_XS v31` on R9700 (`gfx1201`): confirmed `token embedding BF16 (token-embd-bf16.gguf, replacing IQ4_XS) in mapped host memory (1212 MiB, 0.2 s)` and `10,992` resident expert slots (`25.15 GiB` VRAM) in both arms. **Failed:** - none observed **Not run:** - SYCL runtime execution (no Intel Arc GPU on this host; `sycl/src/core/native_head.cpp` and `sycl/src/program/generate.cpp` updated in lockstep with `src/`). ## Limits - Requires `token-embd-bf16.gguf` (`1.27 GB` on disk, `+890 MiB` pinned mapped host RAM over `IQ4_XS`) to be present in the shard directory, its parent directory, or `../embd/` (or passed via `--embd-gguf`); when absent, startup does not download anything and uses the shard's own `token_embd.weight` unchanged. - Does not auto-replace `Q8_0` embeddings (such as `UD-Q4_K_XL` and above, where `Q8_0` is already within `0.56%` of `BF16`); users who want `BF16` over `Q8_0` can still pass `--embd-gguf` explicitly. ## Reproduction ```sh cmake --build build-hip --target strata native_expert_parity -j16 ./build-hip/native_expert_parity --bf16-embd python tools/embd_bf16_pack.py --fetch --out /path/to/shards/token-embd-bf16.gguf ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5422
No description provided.