Skip to content

core/quant: a GPTQ reader for AutoGPTQ v1 group 128 symmetric weights - #3611

Merged
ashhart merged 5 commits into
ashhart:mainfrom
BadAd84:core-gptq-reader
Nov 19, 2026
Merged

ashhart merged 5 commits into
ashhart:mainfrom
BadAd84:core-gptq-reader

Conversation

@BadAd84

@BadAd84 BadAd84 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Terms used below: "base" is upstream TensorFold's main at 077998f7d9b14adebec3a2acc2caa47ff7ae6ec7 (its tip of 2026-11-16T15:26:10Z, changelog: #3572 under Unreleased), and "the head" is this pull request's head 36c98854f6b53b3bbff741ede301349849539fda. Upstream main has moved on since; a merge of it into this head conflicts only in CHANGELOG.md, the branch does not merge it, and every count below is against 077998f7d.

What this changes

core/quant gains a reader for AutoGPTQ v1 weights as stored: 4-bit symmetric groups of 128, no act order, a qweight of int32 words holding eight inputs each, fp16 scales, and qzeros whose every nibble is 7, so a stored weight is (code - 8) * scale. gptq.admit reads a checkpoint's quantization_config and keeps its dynamic rules in declaration order, the last rule matching a module deciding whether that module is stored quantized; gptq.read returns one module's three tensors as views into the checkpoint's map, and gptq.reference writes every weight as binary64, where each product is exact. A field, rule or tensor whose value the reader does not admit stops the load naming it; a GPTQ field it does not read is ignored. Before, core/quant had no GPTQ reader: git grep qzeros zig/src/core found nothing, and XPU's loader read these tensors on its own.

  • Issue: Refs Flash Next on CUDA: serve a GPTQ int4 checkpoint as stored (top-5 routing, block-FP8 mixers) #3368, step 3 of the six steps agreed there: the core GPTQ reader, host only, exact against a binary64 fixture from a synthetic checkpoint, and every refusal named. It is the item RFC: families compose core blocks: a conformance kit first, then sampler, config, drafter and format loaders #2460 lists as one loader per weight format, beside the ModelOpt part reader and the block-FP8 reader.
  • Stacked on: base. The branch is five commits on top of 077998f7d: the reader d947e03e7, the changelog line cc6bd49c2, two of the maintainer's (fc8402fa3, which makes three JSON helpers public in core/modelopt.zig and reads them from the reader, and 3894f6b10, which drops a test-only wrapper the reader no longer needs), and this round's 36c98854f. Nothing else is needed to apply it. Step 4 (the int4 kernel) can stack on it, since the reader owns the layout constants that kernel packs.
  • atc overlap --json: run last, on this head, completing 20:23Z (its output's own mtime), exit 0: complete: false with its own four limits (otherPullRequestsLimit, pullFilesUnavailable, pullRequestsLimit, timeLimit), 8 changed files, 134 overlaps. 96 of those are sourced from our own pull requests 2044 and 3218, not from a working tree. Of the 38 working-tree overlaps, a three-way merge of this head against each pull request's head produces exactly the conflicts that base alone produces (0 differ): 34 share only CHANGELOG.md with this change, 3 share no history with base at all, and 1 shares CHANGELOG.md and zig/src/core/quant/quant.zig and merges clean. This change adds no conflict to any of them.

How the stored form is read:

  • The tensors: qweight i32 [k / 8, n], scales f16 [k / 128, n] and qzeros i32 [k / 128, n / 8], each checked for dtype, shape and whole bytes, each refusal naming the tensor and what it found rather than the number expected alone.
  • The zero point: every nibble of qzeros must be 7, so every zero point the format reads is 8. A byte that is not 0x77 stops the load naming the tensor, the byte's offset and its value.
  • Act order: a non-empty g_idx is refused naming the tensor, because the admitted config's desc_act is false, and an empty g_idx is read and kept out of the way. The published export for this reader, azampatti/Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound at revision 1464274120d36a4d8fcaa934552334a7d83ce0fd, stores no g_idx at all: 70 shards, 224,454 tensors, none whose name contains g_idx, and 73,729 modules carrying qweight, qzeros and scales: 24,576 each of mlp.experts.{E}.gate_proj, up_proj and down_proj, plus lm_head (layers.0.mlp.experts.0.gate_proj is qweight I32 [320, 640], qzeros I32 [20, 80], scales F16 [20, 640]).
  • The config: quant_method gptq in any case, bits 4, group_size 128, sym true, desc_act false or absent and any other value refused by name saying what it found, checkpoint_format gptq exactly and any other value refused by name, a quantized head, and a dynamic object of rules. The head counts as stored int4 when the lm_head flag is true or a +: rule forces it, and a -: rule matching it overrides both. Each rule's own bits and group_size, when it has them, must be the admitted ones. A field it does not read, such as static_groups or damp_percent, is ignored.
  • The rules: Python's re.match over the subset the real rules use, which is literals, ., an escape of a non-alphanumeric character, * and + after an atom and a final $. An escape of an alphanumeric character is a class or an anchor in Python's re, so \d, \w, \s, \b and the rest are refused by the rule's name rather than read as the letter, which is what makes a Python rule miss here without an error. A rule outside that subset, or a key without a +: or -: prefix, is refused by the rule's name instead of being guessed at, and a checkpoint with no dynamic is refused by that field rather than assumed to quantize everything, because a two-thirds BF16 checkpoint read as quantized would decode to wrong weights silently.
  • The conventions are the tree's own, not new ones: XPU's reader (zig/src/xpu/load.zig's projectionGptq) and the kernel that repacks its tensors (zig/kernels/xpu/qwen27/glue_quant.cl, repack_gptq, which reads QW[w * N + n], source nibble 8 * p and 8 * p + 4, and computes the bias s * (-8.0f * G / ASC), whose -8 is the zero point that qzeros stores) read the same word layout, the same nibble order, the same fp16 [k / 128, n] scales and the same zero point of 8, so this is that format in core. XPU itself is untouched.
  • No Format entry: as fp8.zig and nvfp4.zig, this module is host only, since the kernels that will read these weights are each backend's. core/quant/quant.zig gains one line, core/root.zig's test list gains one so the suite reaches the reader, and zig/build/checkpoint_io_host.zig gains one test-only step.
  • XPU's own GPTQ path (zig/src/xpu/load.zig) is untouched, as you asked: moving it onto this reader is a separate pull request with XPU receipts.

Checks on this head

  • Head commit: 36c98854f6b53b3bbff741ede301349849539fda, signed, author and committer BadAd84 <[email protected]>; its tree is 1199951a93ca7a49c4115cddb17f6f416a0981e8, and against base it changes 8 files, 958 insertions and 3 deletions. The commits under it are 3894f6b10 and fc8402fa3 of the maintainer's, cc6bd49c2 and d947e03e7 of ours.
  • Lean checker, python3 tools/zig/lean_check.py, run once from each tree's own root with that tree's own copy: base 6,575 files, 221 problems; this head 6,577 files, 221 problems; lean_new.py: lean: 221 problems, 221 on the base, 0 new.
  • python3 tools/pr_check.py --base 077998f7d9b14adebec3a2acc2caa47ff7ae6ec7 --pr 3611: merge base 077998f7d9b14adebec3a2acc2caa47ff7ae6ec7; 8 changed files; lean 221 vs 221, 0 new, 0 errors and 0 warnings, so the Unreleased bullet naming core/quant: a GPTQ reader for AutoGPTQ v1 group 128 symmetric weights #3611 is found.
  • Tests run, on fresh git archive trees of the head and of base, each checked blob by blob against its commit (11,835 and 11,832 blobs, 0 missing, 0 extra, 0 different), natively on an aarch64 Ubuntu 24.04 machine (NVIDIA GB10, 20 CPUs, Zig 0.17.0 from .zig-version, -j8 --maxrss 6000000000 except -j4 where noted, umask 022, no GPU visible to the tests): test-gptq-reader-host 52/52 tests (its test binary 52 pass (52 total) 33ms, the step 12 s with its compile), test-environment-host 25/25 (25 pass (25 total) 94ms); test-gradient-serving test-qwen-serving-host 3/3 on this head and 3/3 on base; compile-config-server 7/7 and compile-cuda-tests 10/10 steps for aarch64-linux-gnu; zig fmt --check build.zig zig rc 0 on both trees, and git diff --check rc 0 against base.
  • New tests, each shown failing on a mutant of this change: one new test block, gptq: an escape of an alphanumeric character is refused, as Python's re reads it as a class or an anchor, killed by escape-class; the desc_act and checkpoint_format cases live in the existing refusal block, killed by desc-act-any and format-any. Every new test passes on the unmutated tree, which is step 1 of the gate list below.
  • Mutants: 23, one per check the reader makes, each applied to its own fresh tree of this head and run through test-gptq-reader-host: 23 of 23 killed, each failing between one and five of the 52 tests, every kill naming one of the reader's own nine test blocks, as the table below lists, scored from each mutant's own build log. The control is the same step on the same tree without a mutant, 52/52.
  • A scratch probe on a copy of this head, with the export's own config.json compiled in, printed PROBE rules 11 why "" and quantized true for language_model.lm_head, layers.0.mlp.experts.0.gate_proj and layers.0.mlp.experts.0.down_proj, false for layers.0.linear_attn.in_proj_qkv, layers.3.self_attn.q_proj and layers.0.mlp.shared_expert.gate_proj (53/53 tests on that copy, its 52 plus the probe). So the reader admits that export's config as written, including the empty objects its dynamic rules carry.
  • CI on 36c98854f (this head), run on this pull request: fmt, zig, zig-b, zig-windows, pytest, benchmark-clients (ubuntu and windows), release-paths and zig-macos-dev-tools all completed successfully; host-nightly-linux and host-nightly-macos are skipped by their own conditions.
  • Not run, and why: Metal (there is no macOS toolchain on this machine) and two ranks (no second GPU). Neither is reached by a host-only module that nothing loads; compile-config-server and compile-cuda-tests type-check the backends that import core/quant for aarch64.

Each mutant is the complement of one check the reader makes, applied to its own fresh tree of this head and scored from its own build log; the middle column is the count of the 52 tests that still passed:

mutant of 52 tests the reader test blocks it fails
bits-any 51 pass a config outside the dialect is refused by its field or rule name
column-stride 51 pass the stored tensors dequantize to the binary64 fixture
default-unquantized 47 pass the synthetic checkpoint's config is admitted and names the modules it stores quantized; an escape of an alphanumeric character is refused, as Python's re reads it as a class or an anchor; a config outside the dialect is refused by its field or rule name; a config that declares no gptq block is not this reader's, and the head rule may stand alone; the last rule matching a module decides, and no rule leaves it quantized
desc-act-any 51 pass a config outside the dialect is refused by its field or rule name
dtype-any 51 pass every tensor it refuses is named, the zero point and act order included
dynamic-optional 51 pass a config outside the dialect is refused by its field or rule name
escape 49 pass the synthetic checkpoint's config is admitted and names the modules it stores quantized; the matcher reads the rule subset and anchors as Python's re.match does; an escape of an alphanumeric character is refused, as Python's re reads it as a class or an anchor
escape-class 51 pass an escape of an alphanumeric character is refused, as Python's re reads it as a class or an anchor
first-match 51 pass the last rule matching a module decides, and no rule leaves it quantized
format-any 51 pass a config outside the dialect is refused by its field or rule name
g-idx-any 51 pass every tensor it refuses is named, the zero point and act order included
group-any 51 pass a config outside the dialect is refused by its field or rule name
group-stride 51 pass the stored tensors dequantize to the binary64 fixture
lm-head-any 51 pass a config outside the dialect is refused by its field or rule name
matcher-end 50 pass the synthetic checkpoint's config is admitted and names the modules it stores quantized; the matcher reads the rule subset and anchors as Python's re.match does
method-any 51 pass a config that declares no gptq block is not this reader's, and the head rule may stand alone
nibble-order 50 pass the stored tensors dequantize to the binary64 fixture; every tensor it refuses is named, the zero point and act order included
rule-bits-any 51 pass a config outside the dialect is refused by its field or rule name
rule-group-any 51 pass a config outside the dialect is refused by its field or rule name
subset-any 50 pass an escape of an alphanumeric character is refused, as Python's re reads it as a class or an anchor; a config outside the dialect is refused by its field or rule name
sym-any 51 pass a config outside the dialect is refused by its field or rule name
zero-point 50 pass the stored tensors dequantize to the binary64 fixture; every tensor it refuses is named, the zero point and act order included
zeros-any 50 pass every tensor it refuses is named, the zero point and act order included; the zero point check reads both nibbles of every word

Receipt

  • Main against branch: n/a, because this change cannot reach inference. No family imports the reader, no kernel reads it and no setting is added, so every checkpoint served today takes the path it took before, and the grep below is that proof rather than a run.
  • Boxes it reaches: none that serve. grep -rln 'quant\.gptq\|quant/gptq\|gptq\.zig' zig lists the reader, its test, core/quant/quant.zig (one module line), core/root.zig (one line in its test list) and zig/build/checkpoint_io_host.zig (the test-only step), and no family, kernel, server or recipe file.
  • New switch? n/a: no setting is added, zig/src/platform/environment.zig is untouched and so is docs/environment.md.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: base 077998f7d9b14adebec3a2acc2caa47ff7ae6ec7, head 36c98854f6b53b3bbff741ede301349849539fda, Zig 0.17.0, no backend toolchain involved, an aarch64 Ubuntu 24.04 machine with an NVIDIA GB10 of which no device was used, no checkpoint for the tests (the fixture is synthetic and built by the test), and the published export read for its tensor headers and its config.json only.
  • Paths and platforms the change reaches, which I ran and which I could not: the host path only, on aarch64 Linux; not run on Metal or Windows, and not reached by any served path on any platform.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a, no served path. The exactness this change does own is the binary64 fixture in the test, checked bit for bit against values derived by hand from the stored nibbles and fp16 scales.
  • Main against this branch, same machine and checkpoint, posted before asking for a run on our machines: n/a, no checkpoint and no serve.
  • Decode speed before and after, from tools/bench_openai.py: n/a, no served path.
  • Prompt speed before and after: n/a, no served path.
  • Licence of any new weights or drafter: n/a, no weights are added; the synthetic checkpoint is built by the test from the format's own definition.

Checklist

  • The title and description match the head commit, and there is no receipt to match, with the reason above.
  • New tests fail before the change, pass after it, and need nothing absent: they build their own synthetic checkpoint in a temporary folder, so no checkpoint, no device and no optional dependency can be missing.
  • Comments and docstrings are one line, within 120 columns, and carry no measurements or history.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits, and no AI attribution lines.
  • Every token still goes through the lane rounds: not applicable, the receipt is n/a and no served path changes.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo: not applicable as above.
  • No precision traded for speed: not applicable. Nothing is re-encoded, and every stored weight is read as stored.
  • Decode and prompt processing are no slower than main: not applicable, no served path changes.

BadAd84 added a commit to BadAd84/TensorFold that referenced this pull request Nov 16, 2026
@ashhart

ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Thanks @BadAd84. This is a careful first step. The reader is host only and nothing calls it yet, so no served path changes. The dequant is (code - 8) * scale in binary64, which is exact, and the fixture covers the cases that matter: every code, two groups, a subnormal scale, and a zero code under a negative scale. Refusals name the field, rule or tensor they reject. The lean count stays at 221, both files are under 600 lines (336 and 530), and the changelog line is under Unreleased.

Two small commits of ours sit on top of your head. Neither changes behaviour:

  • object, text and int at gptq.zig:310-323 were byte-for-byte copies of the private helpers at core/modelopt.zig:201-214. They are now public there and gptq.zig uses them.
  • zerosSymmetric (gptq.zig:306) had no caller outside the test, so it's gone. The test now checks zerosOff(...) == null directly.

Must fix:

  1. Escapes that are character classes in Python are read as literals. supported (gptq.zig:142) accepts any backslash escape, and reAtom (gptq.zig:167) reads \x as the literal x. In Python's re, though, \d, \w, \s and \b are classes or anchors. A rule like -:.*layers\.\d+\.mlp.* matches model.layers.12.mlp.x in Python but not in this matcher, which matches layers.d.mlp instead. A module the rule leaves BF16 would then be read as int4, or the other way round, with no error. A probe test confirms it: under that -: rule, quantized("model.layers.12.mlp.down_proj") returns true. Please accept only escapes of non-alphanumeric characters (in Python those are always literal), refuse the rest by the rule's name as you do for ( and [, and add a test for \d.
  2. g_idx on a real export. The reader refuses any non-empty g_idx (gptq.zig:226), and the test treats an empty one as what a desc_act: false export writes (gptq_test.zig:510). Could you post the tensor listing (dtype, shape and the first and last values of g_idx) from the published checkpoint you're targeting? If it stores a full [k] i32 in identity order (g_idx[i] == i / 128), the reader as written would refuse every module of it. Accepting exactly that order and refusing any other would still be exact.

Optional:

  • The description says every other GPTQ field is refused by name, but dialect (gptq.zig:67) ignores fields it doesn't know (for example checkpoint_format). The v2 zero-point layout is still caught by the qzeros byte check, so this isn't a correctness problem. Either refuse a checkpoint_format other than gptq, or soften that sentence.
  • A desc_act that isn't a bool, such as "desc_act": "false", is accepted silently (gptq.zig:82). Refusing it by name would match how sym is handled.
  • The description's "Checks on this head" names the first commit as the head and calls the branch one commit, but the head is the changelog commit cc6bd49c. Please update it so the receipts match.

Device checks: none. The reader is host only and has no caller, so this PR has no device cell. The device checks will come with step 4 (the int4 kernel).

  • Synthena

@BadAd84

BadAd84 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Both must fixes and both optionals are in 36c98854f, on top of your 3894f6b10.

Must fix 1, escapes. supported now admits a backslash escape only before a non-alphanumeric character, which is always the character itself in Python's re, and refuses every other escape by the rule's name, exactly as ( and [ are refused. Your probe rule -:.*layers\.\d+\.mlp.* no longer reaches the matcher at all:

quantization_config.dynamic -:.*layers\.\d+\.mlp.*: outside this reader's matcher

The new test block gptq: an escape of an alphanumeric character is refused, as Python's re reads it as a class or an anchor carries that rule plus \w and \s\b, and then checks the other direction: a\+b reads as the literal a+b, and a rule using it is admitted. The mutant escape-class restores the old supported and fails that block.

Must fix 2, g_idx. The published checkpoint stores no g_idx tensor at all, so there are no values to quote: I read the headers of all 70 shards of azampatti/Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound at revision 1464274120d36a4d8fcaa934552334a7d83ce0fd, then read the bytes of every tensor whose name contains g_idx, and there are none.

GIDX shards 70 (from model.safetensors.index.json) tensors 0
GIDX-SUMMARY tensors 0 identity 0
TAIL qweight 73729 / qzeros 73729 / scales 73729 / g_idx 0
GIDX-ANY 0
LIST shards 70 (from model.safetensors.index.json) tensors 224454

For dtype and shape, the three stored tensors of model.language_model.layers.0.mlp.experts.0.gate_proj are qweight I32 [320, 640], qzeros I32 [20, 80] and scales F16 [20, 640]. 73,729 modules carry that triple: 24,576 each of the expert gate_proj, up_proj and down_proj, plus lm_head, and no other tensor is stored for any of them. The config is bits 4, group_size 128, sym true, desc_act false, lm_head true, quant_method gptq, with the same eleven dynamic rules the fixture carries, in the export's own order.

So the reader already accepts every module of that export, and the refusal of a non-empty g_idx stays. An export that stored act order would store something this reader cannot follow, and nothing in the file declares the order, so accepting an identity order would only be exact for a file that says it is identity.

Optional, checkpoint_format. It is refused by name unless it is gptq, compared exactly, and a value that is not a string is refused saying what it found:

quantization_config.checkpoint_format: marlin, expected gptq
quantization_config.checkpoint_format: GPTQ, expected gptq
quantization_config.checkpoint_format: a number, expected gptq

The dialect doc comment no longer claims that every field the reader does not read is refused; it now says a value outside what it reads is refused by its field or rule name, and the description says a GPTQ field it does not read is ignored. The mutant format-any removes the check and fails the refusal block.

Optional, desc_act. A value that is not a bool is refused by name, saying what it found, so "desc_act": "false" no longer reads as false: quantization_config.desc_act: a string, expected a bool, and null gives the same message with null in place of a string. desc_act: true keeps its own message. The mutant desc-act-any restores the old flag-only read and fails the same block.

Description. The body is rewritten on the new head: eight files against the merge base, your two commits named, this commit, the new test and mutant counts, and the g_idx listing above.

Checks on 36c98854f, on aarch64 Ubuntu 24.04 with Zig 0.17.0, no GPU visible:

  • Lean, base against head with the same checker: base 6,575 files, 221 problems; head 6,577 files, 221 problems; lean: 221 problems, 221 on the base, 0 new.
  • tools/pr_check.py --base 077998f7d --pr 3611: merge base 077998f7d...; 8 changed files; lean 221 vs 221, 0 new, 0 errors, 0 warnings.
  • test-gptq-reader-host: 52/52, its test binary 52 pass (52 total) 33ms; test-environment-host: 25/25.
  • test-gradient-serving test-qwen-serving-host: 3/3 on this head and 3/3 on base.
  • compile-config-server 7/7 steps and compile-cuda-tests 10/10 steps for aarch64-linux-gnu; zig fmt --check build.zig zig rc 0 on both trees; git diff --check rc 0.
  • Mutants: 23, one per check the reader makes, each on its own fresh tree of this head; 23 of 23 killed, every kill naming at least one of the reader's nine test blocks, and each new check is killed by its own mutant: escape-class, desc-act-any and format-any. The table is in the body.
  • A scratch probe on a copy of this head, with the export's own config.json compiled in, printed PROBE rules 11 why "" and marked lm_head, the expert gate_proj and down_proj int4 and linear_attn, self_attn and shared_expert not, 53/53 tests on that copy. So that export's config is admitted as written, empty rule objects included.

The two commits of yours are untouched.

@ashhart

ashhart commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Thanks @BadAd84. Every ask from our last review is resolved at this head:

  • Escapes (must fix 1): supported now admits a backslash only before a non-alphanumeric character (zig/src/core/quant/gptq.zig:164), and refuses \d, \w, \s and \b by the rule's name. The new test (gptq_test.zig:284) covers those and the literal a\+b.
  • g_idx (must fix 2): answered with the listing. The target export stores no g_idx tensor in any of its 70 shards, so the reader accepts every module of it, and refusing a non-empty g_idx stays exact.
  • checkpoint_format: anything but gptq is refused by name (gptq.zig:96).
  • desc_act: a non-bool is refused by name (gptq.zig:86).
  • The description now matches the head, with your mutant table.

Our two commits are kept, and the shared helpers come from modelopt.zig. The reader is still host-only with no caller, so there is no device cell yet. It applies to current main as it is. Nothing more from us.

The red benchmark-clients job is the benchmark TTFT test that #3783 makes deterministic; this change doesn't touch it.

  • Synthena

BadAd84 and others added 5 commits November 19, 2026 03:32
AutoGPTQ v1 stores a 4-bit symmetric weight as qweight int32 [k / 8, n] with
eight inputs a word, scales fp16 [k / 128, n], and qzeros int32 [k / 128, n / 8]
whose every nibble is 7, so a weight is (nibble - 8) * scale.

core/quant/gptq.zig reads that form. The config side admits quant_method gptq
with bits 4, group_size 128, sym, no act order and a quantized lm_head, and keeps
its dynamic rules in declaration order, so the last rule matching a module
decides whether it is stored quantized. A rule is matched with Python's re.match
over the subset the rules use: literals, '.', '\x' escapes, '*' and '+' after an
atom and a final '$'. A rule outside that subset, an unprefixed rule key and a
rule whose own bits or group_size differ are refused by the rule's name rather
than guessed at. Anything else stops the load naming the field, the rule or the
tensor: bits, group_size, sym, desc_act, lm_head, a missing or malformed
dynamic, a qweight, scales or qzeros of another dtype or shape, a qzeros byte
other than 0x77 with its offset and value, and a non-empty g_idx, because act
order is not read.

read returns the three stored tensors as views and reference writes every
dequantized weight as binary64: q - 8 is an integer and the scale an fp16 value,
so each product is exact.

Host only: no family calls it, no kernel reads it and no setting is added, so
every checkpoint served today takes the path it took before. The test builds a
synthetic GPTQ checkpoint (config.json and a safetensors image packed by the
format's own definition) and checks a binary64 fixture of hand-derived values,
every refusal by name, the matcher on the rules a real export writes, and the
reader on both modules of the checkpoint.

Refs ashhart#3368
…nd a non-bool desc_act

A rule's backslash escape was read as the character that followed it, whatever that was,
so ".*layers\.\d+\.mlp.*" matched "layers.d.mlp" here while Python's re matches
"layers.12.mlp" there: a module the rule leaves BF16 could read as int4, or the reverse,
with no error. supported admits an escape only before a non-alphanumeric character, which
is that character itself in Python's re and here, and refuses "\d", "\w", "\s", "\b" and
the rest by the rule's name as "(" and "[" already were.

desc_act went through flag, which answers null for a value that is not a bool, so
"desc_act": "false" was read as false. It is refused by name now, saying what it found in
place of a bool, for the reason sym is.

checkpoint_format was ignored. It is admitted as "gptq" only and refused by name
otherwise, and dialect's doc comment no longer claims every field the reader does not read
is refused.

The tests add the rule above and "\w" and "\s\b" beside it, an escape of a non-alphanumeric
character read as the character, a rule using one admitted, the desc_act refusals, the
checkpoint_format refusals, and checkpoint_format "gptq" on the admitted config.

The published AutoRound export (Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound, revision
1464274) stores no g_idx tensor: 70 shards, 224454 tensors, none named *.g_idx, so the
refusal of a non-empty one is unchanged.
@ashhart
ashhart merged commit 0f8e35a into ashhart:main Nov 19, 2026
2 of 11 checks passed
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thank you @BadAd84. 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.

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