[PR #2727] [CLOSED] tools: add opt-in FP4-Local CSF checkpoint conversion #4232

Closed
opened 2026-11-07 15:34:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2727
Author: @hagope
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: feat/fp4-local-csf-converter


📝 Commits (5)

  • c286ffa tools: add opt-in FP4-Local CSF checkpoint conversion
  • bc79b6a docs: clarify CSF converter test prerequisites
  • 9b06de2 Bound CSF conversion buffers when checkpoint shards interleave layers
  • 1e344ac Preserve explicit checkpoint metadata across AutoConfig normalization
  • 090e641 Document full-checkpoint conversion and text-serving validation

📊 Changes

6 files changed (+1014 additions, -0 deletions)

View changed files

📝 docs/NVFP4.md (+5 -0)
➕ docs/NVFP4_CSF.md (+146 -0)
➕ tools/nvfp4_csf.py (+101 -0)
➕ tools/nvfp4_csf_convert.py (+362 -0)
➕ tools/test_nvfp4_csf.py (+79 -0)
➕ tools/test_nvfp4_csf_convert.py (+321 -0)

📄 Description

The FP4-Local checkpoint stores expert scales as CSF streams and uses mixed MXFP8/NVFP4 weights, which the existing offline converter cannot read. This adds a separate explicit converter that writes a main text GGUF and a streamed BF16 PLE GGUF for Strata’s existing readers.

Refs #2726. The full pinned checkpoint has now been converted and served through Strata 0.1.44.1 on an RTX 5090 32 GB / Core Ultra 9 285K / 64 GiB RAM / Ubuntu host.

  • Routed-expert codes and decoded scale bytes are retained; the pinned converter performs the NVFP4 repack.
  • Dense MXFP8/non-expert NVFP4 weights are decoded before the existing BF16/F16/Q8_0 policy, adding rounding.
  • The NVFP4 PLE table is streamed to BF16 in bounded row chunks (102,400,491,520 payload bytes for FP4-Local).
  • Metadata-only --dry-run reports the conversion plan. Outputs/manifests are new files; source checkpoint files remain read-only.
  • Experts are grouped by layer before repacking so the real checkpoint’s interleaved shards do not accumulate the entire arena in RAM. Explicit source config values are preserved across AutoConfig normalization, including full_attention names needed by the pinned metadata writer. Both full-run failures have regression tests with failing negative controls against the previous implementation.
  • Vision and MTP are excluded. The upstream installer, runtime/backend and ordinary nvfp4_convert.py remain unchanged. Compatibility adapters are scoped to the new command and restored on exit/failure.

Validation:

  • CPU suites: 5 codec tests + 14 converter tests passed on the target host; Ruff and git diff --check passed.
  • The CLI also converted a bounded real-tensor fixture end to end, retaining nine independently computed expert projection hashes and writing a readable BF16 PLE file.
  • Full output: 1,511 tensors / 73,939,912,352 bytes in the main GGUF; 144 NVFP4 expert tensors with 512 experts each. Nine projection hashes/global scales matched; 18 BF16 PLE rows across first/middle/final shards matched source reconstruction. Expert pack: 48 layers / 63.28 GiB.
  • The initial full export’s fixed-size compression-ratio metadata was repaired without changing tensor payloads. All 38 architecture fields then matched a fresh metadata export from the corrected converter, and tensor checks were repeated.
  • Live API checks passed text, structured tool calling and tool-result continuation, separated reasoning, streaming and retrieval from an 18,040-token prompt. A client gateway round trip passed. The corrected service remained stable with zero restarts during these checks.
  • Smoke-check rates: 3,224 prompt tokens/s on the retrieval prompt, 49 tokens/s for a 77-token reasoning reply, 54 tokens/s for a 109-token streamed paragraph. Configuration: 128K maximum context, INT8 KV with 32K resident cells, 38 GiB expert RAM budget, no MTP or vision sidecar. These short checks are not a quality/throughput comparison; the full 128K limit was not exercised.
  • Earlier three-expert CUDA parity passed the existing test (1.096%, 1.156%, 1.159% relative output error; threshold 3%). No GPU/kernel changes.

The docs record the pinned checkpoint/reference revisions, precision changes, memory needs, conversion caveats and measurements. Full answer-quality comparison, full-context retrieval, vision and MTP remain untested.

Format reference: vLLM #60646. AI-assisted implementation and testing.


🔄 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/2727 **Author:** [@hagope](https://github.com/hagope) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/fp4-local-csf-converter` --- ### 📝 Commits (5) - [`c286ffa`](https://github.com/Niko1221/Strata/commit/c286ffa2433676ed57fbec029a08c818c7254552) tools: add opt-in FP4-Local CSF checkpoint conversion - [`bc79b6a`](https://github.com/Niko1221/Strata/commit/bc79b6a1a28748137cb9a014524942253c804707) docs: clarify CSF converter test prerequisites - [`9b06de2`](https://github.com/Niko1221/Strata/commit/9b06de2a696720b099eaa11e07fd9e45f430b8c8) Bound CSF conversion buffers when checkpoint shards interleave layers - [`1e344ac`](https://github.com/Niko1221/Strata/commit/1e344aca1b6554ecd713df0792bdb50695cfc4e9) Preserve explicit checkpoint metadata across AutoConfig normalization - [`090e641`](https://github.com/Niko1221/Strata/commit/090e641476ec3416c71e72c89982b3a143c351b3) Document full-checkpoint conversion and text-serving validation ### 📊 Changes **6 files changed** (+1014 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/NVFP4.md` (+5 -0) ➕ `docs/NVFP4_CSF.md` (+146 -0) ➕ `tools/nvfp4_csf.py` (+101 -0) ➕ `tools/nvfp4_csf_convert.py` (+362 -0) ➕ `tools/test_nvfp4_csf.py` (+79 -0) ➕ `tools/test_nvfp4_csf_convert.py` (+321 -0) </details> ### 📄 Description The FP4-Local checkpoint stores expert scales as CSF streams and uses mixed MXFP8/NVFP4 weights, which the existing offline converter cannot read. This adds a separate explicit converter that writes a main text GGUF and a streamed BF16 PLE GGUF for Strata’s existing readers. Refs #2726. The full pinned checkpoint has now been converted and served through Strata 0.1.44.1 on an RTX 5090 32 GB / Core Ultra 9 285K / 64 GiB RAM / Ubuntu host. - Routed-expert codes and decoded scale bytes are retained; the pinned converter performs the NVFP4 repack. - Dense MXFP8/non-expert NVFP4 weights are decoded before the existing BF16/F16/Q8_0 policy, adding rounding. - The NVFP4 PLE table is streamed to BF16 in bounded row chunks (102,400,491,520 payload bytes for FP4-Local). - Metadata-only `--dry-run` reports the conversion plan. Outputs/manifests are new files; source checkpoint files remain read-only. - Experts are grouped by layer before repacking so the real checkpoint’s interleaved shards do not accumulate the entire arena in RAM. Explicit source config values are preserved across AutoConfig normalization, including `full_attention` names needed by the pinned metadata writer. Both full-run failures have regression tests with failing negative controls against the previous implementation. - Vision and MTP are excluded. The upstream installer, runtime/backend and ordinary `nvfp4_convert.py` remain unchanged. Compatibility adapters are scoped to the new command and restored on exit/failure. Validation: - CPU suites: 5 codec tests + 14 converter tests passed on the target host; Ruff and `git diff --check` passed. - The CLI also converted a bounded real-tensor fixture end to end, retaining nine independently computed expert projection hashes and writing a readable BF16 PLE file. - Full output: 1,511 tensors / 73,939,912,352 bytes in the main GGUF; 144 NVFP4 expert tensors with 512 experts each. Nine projection hashes/global scales matched; 18 BF16 PLE rows across first/middle/final shards matched source reconstruction. Expert pack: 48 layers / 63.28 GiB. - The initial full export’s fixed-size compression-ratio metadata was repaired without changing tensor payloads. All 38 architecture fields then matched a fresh metadata export from the corrected converter, and tensor checks were repeated. - Live API checks passed text, structured tool calling and tool-result continuation, separated reasoning, streaming and retrieval from an 18,040-token prompt. A client gateway round trip passed. The corrected service remained stable with zero restarts during these checks. - Smoke-check rates: 3,224 prompt tokens/s on the retrieval prompt, 49 tokens/s for a 77-token reasoning reply, 54 tokens/s for a 109-token streamed paragraph. Configuration: 128K maximum context, INT8 KV with 32K resident cells, 38 GiB expert RAM budget, no MTP or vision sidecar. These short checks are not a quality/throughput comparison; the full 128K limit was not exercised. - Earlier three-expert CUDA parity passed the existing test (1.096%, 1.156%, 1.159% relative output error; threshold 3%). No GPU/kernel changes. The docs record the pinned checkpoint/reference revisions, precision changes, memory needs, conversion caveats and measurements. Full answer-quality comparison, full-context retrieval, vision and MTP remain untested. Format reference: [vLLM #60646](https://github.com/vllm-project/vllm/pull/60646). AI-assisted implementation and testing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:34:12 +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#4232
No description provided.