[PR #5479] [Engine] allow reusing standalone PLE n-gram shards across different quant splits #5454

Open
opened 2026-11-07 19:36:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5479
Author: @code-martin
Created: 11/7/2026
Status: 🔄 Open

Base: main ← Head: feature/reuse-ple-shards


📝 Commits (1)

  • 59f6da5 fix(model): allow reusing standalone PLE n-gram shards across different quant splits

📊 Changes

3 files changed (+13 additions, -4 deletions)

View changed files

📝 include/strata/artifact/gguf_reader.hpp (+4 -0)
📝 src/core/native_dense.cpp (+7 -4)
📝 tools/iq_pack.py (+2 -0)

📄 Description

Problem and result

The 28.8 GB IQ4_NL n-gram embedding table (per_layer_token_embd.weight) in Qwen3.8-Flash-Next is mathematically identical across the entire model family:

  • All ISTA-DASLab 2-shard GGUFs (Q2_0, IQ2_XS, IQ3_XXS, IQ3_S: shard 2)
  • All Unsloth 3-shard v3.1 sets (UD-IQ1_M, UD-Q2_0, UD-IQ2_XS: shard 3)
  • All Unsloth 4-shard v3.1 sets (UD-Q2_K_XL, UD-IQ3_XXS, UD-Q3_K_XL, UD-IQ4_XS-v31: shard 4)

They differ solely in the GGUF split header metadata (split.count and split.no).

Before this change, attempting to hardlink or share an existing 28.8 GB PLE shard across different split layouts (for instance, reusing an ISTA-DASLab shard 2 for any Unsloth 3- or 4-shard quant) caused GgufModel::validate_split, NativeDense::load, and tools/iq_pack.py to abort with split validation errors:
GGUF: <shard> does not declare itself shard K of N of this model (split.count / split.no / split.tensors.count)
or
native dense: additional shard must match the architecture-validated first shard's split metadata.

Users testing different quantization levels had to either re-download the identical 28.8 GB file for each model or clone 28.8 GB on disk to run binary header-patching scripts (set_split.py).

After this change, any standalone PLE shard can be shared or hardlinked across all 2-, 3-, and 4-shard variants, saving 28.8 GB of bandwidth and disk space per tested model.

None.

Approach

Exempt shards containing solely per_layer_token_embd.weight from strict split.count and split.no equality checks across the stack:

  1. include/strata/artifact/gguf_reader.hpp (GgufModel::validate_split): bypass split counter validation when the shard holds exactly one tensor named per_layer_token_embd.weight.
  2. src/core/native_dense.cpp (NativeDense::load): bypass split metadata validation and duplicate shard number rejection for standalone PLE shards.
  3. tools/iq_pack.py (check_split): ignore split count mismatch for single-tensor PLE shards during pack generation.

All primary model shards (shard 1 with metadata, attention, SSM, and expert shards) remain strictly validated against each other.

Validation

Passed:

  • SHA-256 verification confirms the payload of ISTA-DASLab shard 2 is bit-identical to Unsloth v3.1 shard 4 (5de8b5dbf89409acc39468decafd4a4a95b13c29d88a14b0356107897829ec36).
  • Verified python tools/iq_pack.py --gguf ... --compat-bf16 successfully prepares the pack when shard 4 is a hardlink to ISTA-DASLab shard 2 (split.count=2 vs split.count=4), exiting 0.
  • Hardware execution: verified end-to-end token generation on Strata v0.2.11 with hardlinked cross-split PLE shard.

Failed:

  • None observed.

Not run:

  • Multi-GPU distributed layer-split engine run (--layer-split).

Limits

Applies strictly to shards that contain only per_layer_token_embd.weight. Shards carrying routed experts, attention projections, or any other tensors alongside PLE remain subject to exact split metadata alignment.


🔄 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/5479 **Author:** [@code-martin](https://github.com/code-martin) **Created:** 11/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/reuse-ple-shards` --- ### 📝 Commits (1) - [`59f6da5`](https://github.com/Niko1221/Strata/commit/59f6da53aacd4699f50234d7488112a2e26479cf) fix(model): allow reusing standalone PLE n-gram shards across different quant splits ### 📊 Changes **3 files changed** (+13 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/artifact/gguf_reader.hpp` (+4 -0) 📝 `src/core/native_dense.cpp` (+7 -4) 📝 `tools/iq_pack.py` (+2 -0) </details> ### 📄 Description ## Problem and result The 28.8 GB IQ4_NL n-gram embedding table (`per_layer_token_embd.weight`) in Qwen3.8-Flash-Next is mathematically identical across the entire model family: - All ISTA-DASLab 2-shard GGUFs (`Q2_0`, `IQ2_XS`, `IQ3_XXS`, `IQ3_S`: shard 2) - All Unsloth 3-shard v3.1 sets (`UD-IQ1_M`, `UD-Q2_0`, `UD-IQ2_XS`: shard 3) - All Unsloth 4-shard v3.1 sets (`UD-Q2_K_XL`, `UD-IQ3_XXS`, `UD-Q3_K_XL`, `UD-IQ4_XS-v31`: shard 4) They differ solely in the GGUF split header metadata (`split.count` and `split.no`). Before this change, attempting to hardlink or share an existing 28.8 GB PLE shard across different split layouts (for instance, reusing an ISTA-DASLab shard 2 for any Unsloth 3- or 4-shard quant) caused `GgufModel::validate_split`, `NativeDense::load`, and `tools/iq_pack.py` to abort with split validation errors: `GGUF: <shard> does not declare itself shard K of N of this model (split.count / split.no / split.tensors.count)` or `native dense: additional shard must match the architecture-validated first shard's split metadata`. Users testing different quantization levels had to either re-download the identical 28.8 GB file for each model or clone 28.8 GB on disk to run binary header-patching scripts (`set_split.py`). After this change, any standalone PLE shard can be shared or hardlinked across all 2-, 3-, and 4-shard variants, saving 28.8 GB of bandwidth and disk space per tested model. ## Related discussion None. ## Approach Exempt shards containing solely `per_layer_token_embd.weight` from strict `split.count` and `split.no` equality checks across the stack: 1. `include/strata/artifact/gguf_reader.hpp` (`GgufModel::validate_split`): bypass split counter validation when the shard holds exactly one tensor named `per_layer_token_embd.weight`. 2. `src/core/native_dense.cpp` (`NativeDense::load`): bypass split metadata validation and duplicate shard number rejection for standalone PLE shards. 3. `tools/iq_pack.py` (`check_split`): ignore split count mismatch for single-tensor PLE shards during pack generation. All primary model shards (shard 1 with metadata, attention, SSM, and expert shards) remain strictly validated against each other. ## Validation **Passed:** - SHA-256 verification confirms the payload of ISTA-DASLab shard 2 is bit-identical to Unsloth v3.1 shard 4 (`5de8b5dbf89409acc39468decafd4a4a95b13c29d88a14b0356107897829ec36`). - Verified `python tools/iq_pack.py --gguf ... --compat-bf16` successfully prepares the pack when shard 4 is a hardlink to ISTA-DASLab shard 2 (`split.count=2` vs `split.count=4`), exiting 0. - Hardware execution: verified end-to-end token generation on Strata v0.2.11 with hardlinked cross-split PLE shard. **Failed:** - None observed. **Not run:** - Multi-GPU distributed layer-split engine run (`--layer-split`). ## Limits Applies strictly to shards that contain only `per_layer_token_embd.weight`. Shards carrying routed experts, attention projections, or any other tensors alongside PLE remain subject to exact split metadata alignment. --- <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#5454
No description provided.