Repository navigation
hy4_flash: the NVFP4 build's quantization block and weight map, with recipe and receipts (slice 1 of #3801) - #4110
Conversation
|
On M5 Max with Zig 0.17.0, a clean trial merge of For the #3941 overlap, the trial merge of the two heads conflicts in For the Engram rebase, I took this PR's compressed-token fixture to #3941's current Igor Lessio - AIFLOW LABS |
|
Thanks for the rename. With #3941 merged at I reran the shared Engram fixture against the merged Metal code. All 72 layer/position cases still match after accounting for the per-head offsets, and the Metal host target with the added fixture passed 17/17. Igor Lessio - AIFLOW LABS |
|
@ashhart, #3941 and #4259 put Hy4-flash on main, so this branch now conflicts with main's family in |
4272307 to
a0f609d
Compare
|
@ashhart, slice 2 is ready on top of this branch: the build's NVFP4 routed experts on CUDA at one rank, packed for core's grouped NVFP4 kernels, with |
|
@ashhart, a short ping on this one. CI is green on |
|
Thank you, @atakann, and I'm sorry for the change of course: we asked for this build in #3801, and you delivered it with a full recipe and receipts. Since then we've tightened TensorFold's rule. We serve a checkpoint only in the precision its publisher released, with every output bit matching our serial reference, and we no longer take post-training conversions, even behind a switch. Your NVFP4 build is converted from Tencent's BF16 release (the recipe's own report shows about 9.5% expert weight error), so we won't add a map or recipe for it to the repo. Hy4-flash itself is very welcome. Main already has a host map for Tencent's official FP8 release, and the remaining slices from #3801 (the CUDA family, plain decode first, then DFly) would be great on that build. The GPQA Diamond and IFEval receipts were careful work, and your later slices can reuse the same approach.
|
|
Thanks @ashhart, understood. The official FP8 release is about 220 GB, which does not fit my two GB10s with room to run, so I can't build and test the CUDA slices on it. The NVFP4 build stays available on Hugging Face and in vLLM (#68387) for anyone who wants it on two Sparks. |
|
@atakann, I owe you an apology: I closed this too quickly and on the wrong reading of our rule. TensorFold's exactness rule is about our own code: whatever checkpoint is loaded, we reproduce it bit for bit and never add rounding or tolerances of our own. Which build someone chooses to serve, whether the publisher's FP8, your NVFP4 build or another quantization, is their choice, and main already loads several community builds. Your PR only reads your NVFP4 build exactly as stored, so it fits that rule. I've reopened it. From our review: this slice, which adds no serving path yet (the typed weight map, the sampled header test, the recipe and the quality notes) is ready to land once it's combined with current main, which we'll do on our side. The quality scores describe the build itself; they aren't token-equality evidence for later runtime slices, which will each need their own exact checks. Sorry again for the back and forth.
|
|
Thanks @ashhart, no problem, and thanks for reopening. Slice 2 (the NVFP4 routed experts on CUDA at one rank) is ready on top of this branch; I'll open it once this one lands, with its own token-equality checks on GB10. |
22d8e68 to
7e45264
Compare
…its recipe and quality receipts (slice 1 of ashhart#3801) nvfp4_weights.zig reads hf_quant_config.json (ModelOpt NVFP4, groups of 16, no KV cache quantization; anything else is UnsupportedHy4Quant) and names every text and drafter tensor of the build with its stored type and shape: NVFP4 routed experts, shared experts and dense MLP, e4m3 Engram rows with a BF16 scale a row, the rest as Tencent released it. The host test checks the map against 344 entries of atakans/Hy4-flash-NVFP4's own safetensors headers and the full count of 253,728 tensors outside the vision tower's blocks. tools/hy4_flash/nvfp4.py and engram_fp8.py rebuild the checkpoint; docs/receipts/hy4-flash-nvfp4/ holds the build steps and GPQA Diamond and IFEval on two GB10s.
7e45264 to
6f4fc80
Compare
|
Thank you @atakann. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
Slice 1 of #3801, reworked onto main's
hy4_flashfamily now that #3941 and #4259 landed it. This branch no longer carries its own config, Engram or template code; it adds only what the ModelOpt NVFP4 build needs on the host, next to main's affine and EXL3 maps:nvfp4_weights.zig:checkQuantreadshf_quant_config.jsonand takes ModelOpt NVFP4 in groups of 16 with no KV cache quantization; anything else isUnsupportedHy4Quant.checknames every text and drafter tensor of the build with its stored type and shape: NVFP4 routed experts (one tensor per expert), shared experts and dense MLP; e4m3 Engram rows with one BF16 scale a row; BF16 elsewhere, with the release's f32 tensors (the head,hc_*, the indexer's projections and APE, the sinks).nvfp4_weights_test.zigwithnvfp4_header.txt: 344 entries of atakans/Hy4-flash-NVFP4's own safetensors headers (30f201ac), every kind of tensor at layers 0, 1, 2 and 41, experts 0 and 511 of two layers, the whole drafter. The map must ask for each of them as stored, and for 253,728 tensors in all, the build's count outside the vision tower's blocks. A changed tensor is refused by name; FP8, group 32, an FP8 KV cache and a misspelled block are refused.tools/hy4_flash/nvfp4.pyandengram_fp8.pyrebuild the checkpoint from Tencent's BF16 release with ModelOpt 0.48.0, anddocs/receipts/hy4-flash-nvfp4/holds the steps and these scores (two GB10s, tensor parallel 2, thinking off, temperature 0):hy4-flash)No kernels and no serving: the loader does not read NVFP4 yet, so other families' tokens and main's Hy4 paths are unchanged. The next slice is the NVFP4 routed experts on CUDA at one rank, against a tiny checkpoint.
Checks
zig build test-hy4-flash-host: 30/30 on GB10 (Zig 0.17.0);zig fmt --checkclean.ruff check tools/hy4_flash.atc overlap: the only shared files arehost_tests.zigwith gemma4 drafters, hy4_flash cuda: refuse leftover checkpoint tensors #4566 (merges cleanly) andTHIRD_PARTY_NOTICES.mdwith ricursive: the publisher's DFlash2 drafter for Ripple-65B (stacked on #2231) #2260 (its conflicts are with main already, none from this branch).The earlier shape of this branch is kept at
atakann/TensorFold:hy4-flash-host-v1.