# IQ4_NL CPU reference parity The pure Rust `leleka_quant_core::iq4_nl` decoder implements GGUF kind 20: 18 bytes produce 32 F32 values. Bytes 0–1 hold a little-endian FP16 scale and bytes 2–17 hold codepoint pairs. The low nibble at byte `2+j` produces element `j`; the high nibble produces element `j+16`. Multiplication uses the existing binary16-to-binary32 helper and the signed nonlinear codebook: ```text -127 -104 -83 -65 -49 -35 -22 -10 1 13 25 38 53 69 89 113 ``` The arithmetic/table oracle is the unmodified vendored `ggml-quants.c::dequantize_row_iq4_nl` and `ggml-common.h::kvalues_iq4nl` from llama.cpp `3cf03257f219afbe7334045ff7c6a06ac68c627d`, also pinned by imported Strata `d9ab8435f654c368c586340d490915f6addf56a3`. Source hashes and license remain in [GGML provenance](../control-plane/third_party/ggml/UPSTREAM.md); the quant crate's [MIT notice](../crates/quant-core/LICENSE-GGML) is retained. No upstream source, table or pin is changed. The independent Rust crate has no C/FFI, GGML, Strata, Python or CUDA build/runtime dependency. ## Numerical and API gates The new control-plane oracle exhausts all **63,488 finite FP16 scale encodings**, including both signed zeros, every signed subnormal and normal, and both signs of the maximum finite value. For every scale its independently generated block covers all 16 codepoints in each output half. Every decoded value is compared with the actual pinned C decoder using `f32::to_bits()`: **zero tolerance**, including signed zero. This is **2,031,616 element comparisons**. Coverage assertions additionally require all 256 packed byte values at every one of the 16 byte positions and all 16 codepoints at every one of the 32 output positions. This exhausts the scale/codepoint combinations but not the joint space of all 16 packed bytes. A separate 14-block batch compares exact output bits through both bulk APIs with deliberately unaligned input, exercising the existing C bridge's alignment-copy path. All **2,048 nonfinite FP16 scale encodings** are admitted by both Rust APIs and the C oracle, preserving IQ4_NL's existing consumer behavior. The two infinity encodings require exact output bits/signs. All 2,046 NaN encodings require NaN classification; no portable NaN payload or sign equivalence is claimed. The existing IQ3_S refusal of nonfinite scales is unchanged. Existing consumers keep their own rejection or downstream value policies. Standalone tests check independent expected codebook values and split-half order, signed zero, nonfinite admission, multiple blocks, empty input/output, malformed input blocks and incorrect output lengths. Invalid shapes leave the entire caller output unchanged. The decoder allocates no heap buffer and decodes into caller-owned storage. The visitor remains bounded and retains errors and consumer receipts; other format branches are unchanged. Only generated synthetic fixtures are used. Tracked Qwen evidence identifies IQ4_NL expert/shared-expert/PLE tensors in [historical validation](build-validation.md), but this gate reads no weights. This qualifies CPU decoding and bounded preparation integration, not complete model support, immutable weights, readiness, GPU behavior, model quality or performance. Other target formats still require C; the control-plane build still compiles its legacy GGML oracle. Removing that build dependency is a separate task. ## Targeted commands ```sh cargo test --locked -p leleka-quant-core cargo clippy --locked -p leleka-quant-core --all-targets -- -D warnings cargo test --locked -p strata-control --lib ggml_bridge::tests cargo test --locked -p strata-control --lib gguf_f32_stream::tests ``` ## Actual local CPU result, 2026-10-07 - Rust: `rustc 1.99.0 (b940084d7 2026-09-28)`. - Host: `aarch64-apple-darwin` (Darwin arm64). - C compiler: Apple Clang 21.0.0 (`clang-2100.1.1.101`). - Quant crate: **5 passed, 0 failed**, including three new IQ4_NL tests; standalone Clippy with warnings denied passed. - Bridge oracle: **9 passed, 0 failed** (177 unrelated tests filtered), including three new IQ4_NL tests. All 2,031,616 finite-scale element comparisons, packed-field/codepoint coverage assertions, unaligned batch comparisons and all nonfinite admission/classification/infinity-sign comparisons passed. - QA's separate visitor gate: **7 passed, 0 failed**. Its new finite fixture compared 1,821 blocks with C output across two callbacks: source chunks 28,152 and 4,626 bytes (cap 28,160), derived chunks 200,192 and 32,896 bytes. Shape rejection before seek/callback, early/late truncation, callback abort at either chunk, and nonfinite classification/infinity signs passed. - Vendored GGML manifest hashes, owned-file formatting and `git diff --check` passed. The production C bridge body and all six earlier bridge test functions remain byte unchanged. The private oracle build target was cleaned. No finite numeric mismatch was observed, and no numerical tolerance was relaxed. NaN payload/sign differences were not measured; the nonfinite gate compares the explicit classification/admission contract above. These results apply to this CPU/compiler configuration; Linux/GCC, real-model and GPU qualification remain separate.