fix(ENG-EXPERT-STREAM): seal the IQ1 decode against the oracles, not against itself - #1026
Conversation
…against itself The IQ1_S / IQ1_XXXS decode landed in #946 with its codebooks sealed and every other decode parameter pinned only by self-consistency. `ReferenceDotF64` and the G3 NMSE reference both decode the weight with `vt::cpu::BlockToFloat`, the function under test, so they are independent in the summation and nowhere else. An independent review injected three defects, each applied and compiled, and the whole gate stayed green with an unchanged assertion count: `kIq1sDelta` doubled to 0.25 (which hits both encodings), the IQ1_S delta sign inverted in dequant and vec_dot together, and the IQ1_S scale read from `qh` bits 13-15 instead of 12-14 in both paths. All three are reproduced here before the repair and all three now fail. What closes it is a golden-vector fixture whose expected values come from the oracles themselves rather than from this tree. Each blob is decoded by `ggml_get_type_traits(type)->to_float` in a build of ggml-org/llama.cpp @ 237ad9b96 for IQ1_S and IQ3_XXS, and of unslothai/llama.cpp @ 36fe8e1cc for IQ1_XXXS, and the IQ1 inputs are real `blk.0.ffn_gate_exps.weight` bytes from the two target checkpoints. Agreement is bit-exact on all 1024 values per encoding. That is stronger than the spec's 15 August run, which compared our C++ against a hand transcription of the fork: both sides were transcriptions there, so a defect in the fork would have been reproduced identically by each. The NMSE ceiling was 2e-3, described as about 4x the residual. Re-measured over all 12 shapes per type, the unmutated peak is 5.240e-4 for iq1_s and 3.109e-4 for iq1_xxxs, and the doubled delta takes iq1_s to 6.967e-4. So 2e-3 passed a defect that 6e-4 fails, and the ceiling is now set from that measurement. The iq1_xxxs half is the more instructive one: the same defect moves its NMSE the wrong way, to 1.420e-4, so no ceiling catches it there. A statistic whose reference decodes through the function under test cannot seal a decode parameter at all. It bounds quantization error, which is its own job. `DequantGgufRowToF32` listed no case 19 and no case 66, so the loader's expansion path threw "unsupported ggml type" for the two encodings the target checkpoints are 96.92 % made of. That is not a corner: `RouteGgufTensor` sends a tensor there whenever VT_CPU_REF is set, keep-quant is off, K is ragged, or the role is not verbatim, so the reference lane could not load the model. Case 18 (IQ3_XXS) carried the same omission since the DeepSeek-V4 port and is fixed in the same shared branch, gated on its own oracle-produced golden. Three smaller repairs from the same review. The IQ1_S vec_dot comment claimed the other kernels do not read `bsums` when Q2_K, Q4_K and Q5_K do. The i-quant table header called itself a 1:1 mirror of one revision while carrying one table from a different fork, and indexed neither new table. Both checkpoint-census cases claimed total coverage of 1702 tensor records while enumerating six of the seven encodings and summing to 864; they now carry F32's 838 tensors and assert that the buckets sum, which is what makes the claim checkable. Closes #1023. Row ENG-EXPERT-STREAM, issue #912. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
Operator verification (independent of the implementer report)Per AGENTS.md, "The operator reruns the row's gate itself. An implementer or reviewer report is an input, never a gate result." Re-ran the central claim myself on this branch, not taken from the report:
That is the mutation which previously passed all 490 tests with assertion counts unchanged. It is now caught. Full gate, run by the operator on this branch: 492/492 passed, 0 failed, exit 0. Why this merges despite the review cycle normally continuingThe defect it repairs is LIVE in
|
`main` advanced to 4f2d917 (#1026) while this branch was in CI, and #1026 touched `.agents/issue-index.md`, so GitHub reported CONFLICTING. GitHub does not run the `merge=union` driver that `.gitattributes:7` sets for that file -- `git merge-tree --write-tree` resolves it clean locally while the forge does not -- so the resolution has to happen here, where the driver runs. The union driver's auto-merge was DISCARDED rather than trusted: took 4f2d917's `.agents/issue-index.md` wholesale with `git checkout <pin> --`, then re-applied the scoped repair on top. Re-verified mechanically against the new base, not assumed to carry over: 255 -> 254 rows, #995 exactly 1x, every row 6 parts, and 253 unrelated rows byte-identical AND in the same order. Net diff versus 4f2d917 is +1/-2 in one file. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:claude-opus-5 [claude-code]
Repairs the findings of an independent review of the IQ1_S (ggml 19) / IQ1_XXXS (ggml 66) decode that landed in #946. Row
ENG-EXPERT-STREAM, issues #912 and #1023.The decode was sealed at the codebooks and nowhere else
kIq1sGridandkIq1xxxsGrideach carry an FNV-1a digest and a lane census, and that seal works: corrupt a grid entry and the gate fails. It stops one table short. Every other decode parameter was pinned only by self-consistency, becauseReferenceDotF64(tests/vt/test_ops_quant_dot.cpp:231-236) and the G3MatmulBTQuantNMSE reference (:915) both decode the weight withvt::cpu::BlockToFloat, the function under test. They are independent in the summation and nowhere else.Three defects were injected, each applied and compiled, and the whole gate stayed green with an unchanged assertion count. All three are reproduced on the unrepaired tree in this PR's evidence and all three now fail:
kIq1sDelta0.125Fto0.25F, which hits BOTH encodingsqhbits 13-15 instead of 12-14, both pathsWhat closes it: goldens the oracles produced, over real checkpoint bytes
tests/vt/iq1_golden_vectors.hcommits, for each encoding, a small set of block bytes and the f32 values the ORACLE decoded them to. The expected values never pass through this tree. Each blob went throughggml_get_type_traits(type)->to_floatin a build of the pinned oracle itself:ggml-org/llama.cpp @ 237ad9b96blk.0.ffn_gate_exps.weight, UD-IQ1_S shard 2unslothai/llama.cpp @ 36fe8e1cc7f2b3b8c92fdda0ab07600141921786blk.0.ffn_gate_exps.weight, UD-Q1_0 shard 2ggml-org/llama.cpp @ 237ad9b96Agreement is bit-exact on all 1024 values per encoding, not approximate: both sides evaluate the same
dl * (grid[j] + delta)in f32, so any difference at all means a parameter diverged rather than that rounding moved. The four IQ1 blocks carry both delta-sign polarities and sub-block scales 2 through 7, so every field the decode reads varies inside the fixture.kIq1sDeltais additionally sealed by value against upstreamIQ1S_DELTA(ggml-common.h:1121).This is stronger than the spec's 15 August bit-identity run, and worth saying how. That run compared our C++ against a hand transcription of the fork, so both sides were transcriptions and a defect in the fork would have been reproduced identically by each. These vectors are decoded by the fork's own compiled code. It still does not make the fork gateable in the sense #933 owes, which is running the MODEL, but the fork's decoder is no longer transcribed at all.
The dequant arm is what the goldens seal directly. The vec_dot arm is tied to it by the existing "vec_dot matches f64 dequantize-then-dot" case, so a defect injected into either alone fails there and a defect injected into both fails on the goldens. That is why mutations 2 and 3, which changed both paths together, are now caught.
The NMSE ceiling was widened past the point where it discriminates
It was
2e-3, described in the code as about 4x the residual. Re-measured over all 12 shapes per type with the ceiling forced to1e-12so doctest prints every captured value:kIq1sDelta = 0.25iq1_siq1_xxxsSo
2e-3passed a defect that6e-4, the value now set, fails. Theiq1_xxxsrow is the more instructive half: the same defect moves that statistic the WRONG WAY, so no ceiling catches it there at all. An NMSE whose reference decodes through the function under test cannot seal a decode parameter. It bounds quantization error, which is its own job, and it is kept tight enough to stay a second signal where it can be one.The loader's expansion path could not decode the target checkpoint
DequantGgufRowToF32listed nocase 19and nocase 66, so it threwunsupported ggml typefor the two encodings the target checkpoints are 96.92 % made of, althoughvt::cpu::BlockToFloatdecodes both in one line. Not a corner:RouteGgufTensorsends a tensor there wheneverVT_CPU_REFis set, keep-quant is off, K is ragged, or the role is not verbatim, so the reference lane could not load the model.case 18(IQ3_XXS, the DeepSeek-V4 UD-IQ2_XXSffn_downencoding) carried the same omission and is fixed in the same shared branch rather than filed and deferred, gated on its own oracle-produced golden. This list has now drifted behindBlockDTypeFromGgmlTypeIdtwice, so it says so and says to keep the two in step.Three smaller repairs from the same review
The IQ1_S vec_dot comment claimed the other kernels do not read
bsums, while Q2_K, Q4_K and Q5_K already do; the reason is specific to the delta but the field is not. The i-quant table header called the file a 1:1 mirror of237ad9b96and indexed its tables, while carryingkIq1xxxsGridfrom a different fork and indexing neither new table. And both checkpoint-census cases claimed TOTAL coverage of 1702 tensor records while enumerating six of the seven encodings and summing to 864; they now carry F32's 838 tensors, assert routing in both directions, and assert that the buckets sum, which is what makes the claim checkable at all.Gate
Full gate on the rebased head:
cmake --build build -j 8rc 0 with zeroerror:lines,ctest -j 6492/492 passed, 0 failed, exit 0 (2 skipped:test_modelopt_mixed_precision_checkpoint,test_voxtral_e2e). Focused suites:test_ops_quant_dot28 cases / 205664 assertions,test_gguf_dequant20 / 2846,test_gguf_keep_quant39 / 6089, all SUCCESS.scripts/agent-preflight.sh --stagedreports two failures,check-agent-recordandtest_agent_record, both the duplicated#995row that #1022 already tracks. Proved pre-existing with a matched arm rather than asserted: a cleanorigin/mainworktree runs the same checker torc=1with byte-identical output. Every other gate passes, includingcheck-env-docandtest_cpu_x86_llamacpp_floor, which were red before this branch was rebased onto45b022cdc.No checker was weakened and no assertion deleted. The only bound that moved moved DOWN, from
2e-3to6e-4.Closes #1023.
FOLLOWING_AGENTS_PROTOCOL
Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5 [claude-code]