Skip to content

core: decode lossless NVFP4 CSF scale planes - #904

Merged
ashhart merged 2 commits into
ashhart:mainfrom
akol1:codex/nvfp4-csf
Oct 18, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
akol1:codex/nvfp4-csf

Conversation

@akol1

@akol1 akol1 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

ModelOpt checkpoints can store NVFP4 block scales as byte-window CSF streams. Add a borrowed, validated plane that reconstructs exact scale bytes, including rectangular row/column partitions, without allocating a full plane for each rank.

The reader rejects malformed geometry, stream lengths, overflowing bases, unsorted/duplicate/out-of-range exception positions, invalid slices, and output that aliases either input stream. Tests cover handwritten slabs, all 256 replacement bytes, both partition axes, and the maximum u24 position. This format primitive can support the ModelOpt loading work in #758.

Validation at head 8a41d661fb05c256af261f63e3e5eb46c2957370, reviewed main base 46a08c18608153bfc566703a88acc883bc6140f4, Zig 0.17.0:

  • macOS arm64 host/golden/kernel-contract suite: 211/211 steps succeeded; 3,000/3,010 tests passed, ten skipped.
  • Frozen server corpus: 309/319 equal, ten known differences, zero unexpected differences.
  • Lean checker: 517 inherited findings, zero added. Diff whitespace check passed.
  • Complete publication tree, outgoing history and approved public identity inspected; original contributor history preserved.
  • Linux x86_64 exact-source test test-golden test-kernel-contract -Doptimize=safe: 91/91 build steps, 1401/1408 tests passed, seven explicit platform/library skips. Frozen server corpus: 309/319 equal, ten known differences, zero unexpected differences.

Host format tests do not qualify GPU arithmetic, checkpoint admission, tensor-parallel execution or model performance. This change adds no GPU kernel.

Public CI at this exact head: Zig format, No GPU host/contracts/goldens/fuzz, desktop and mobile checks all passed. Complete tracked-tree and outgoing-history privacy inspection found zero new private-data matches.

@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @akol1, for making the compressed scale plane a lossless shared-core reader, with malformed-stream and slice checks.

We checked 3f069e3. The bounded geometry, sorted exceptions, overlap refusal and low-even nibble order look right, and the decoder preserves scale bytes without floating conversion. This fits the common format layer in #847, together with #906.

We'll take the two increments in dependency order, preserving their authors, and run the host cases for all replacement bytes, partial slabs, odd column cuts, the last u24 position and allocation failures. At landing we'll also compare against the pinned format reference and the original scale bytes from a real checkpoint, including reconstruction from rank slices.

The next step is to connect this reader through the common loader and run those checks before using it in the consolidated family; we can handle small loader-integration fixes there.

Posted by Ash's AI Assistant Synthena

@akol1
akol1 marked this pull request as draft October 16, 2026 10:43
@akol1
akol1 marked this pull request as ready for review October 16, 2026 13:54
@ashhart ashhart mentioned this pull request Oct 17, 2026
@ashhart
ashhart merged commit eb8378e into ashhart:main Oct 18, 2026
4 checks passed
@ashhart

ashhart commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you, @akol1, for the lossless CSF scale codec and refreshed host coverage.

We merged your work for 1.1.0 in eb8378e. The shared codec stores exact exception bytes and refuses unsupported or overlapping geometry. It precedes #906's rank-local reader, keeping one format implementation.

Checkpoint consumers retain their original-byte and projection checks, including NVIDIA's activation and rounding rules.

Posted by Ash's AI Assistant Synthena

BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…h sorted exceptions), decoded exactly for a rank's slice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants