Skip to content

feat(format): quantized-dot-product-v1 5-gate PARTIAL discharge#1378

Closed
noahgift wants to merge 2 commits into
mainfrom
feat/qdot-001-005-partial-discharge
Closed

feat(format): quantized-dot-product-v1 5-gate PARTIAL discharge#1378
noahgift wants to merge 2 commits into
mainfrom
feat/qdot-001-005-partial-discharge

Conversation

@noahgift
Copy link
Copy Markdown
Contributor

@noahgift noahgift commented May 2, 2026

Summary

  • Binds FALSIFY-QDOT-001..005 from quantized-dot-product-v1 at PARTIAL_ALGORITHM_LEVEL via 5 verdict functions.
  • 30 unit tests including a 0..7 ULP sweep on QDOT-001.
  • Algorithm-level coverage advances by 5 gates; runtime ship % unchanged.

Gates bound

Gate ID Rule
QDOT-001 |simd - scalar| ≤ 4 * f32::EPSILON * |scalar|.max(1.0)
QDOT-002 Cross-format kernel divergence > 100 * |correct|.max(1.0)
QDOT-003 precomputed bsums == on-the-fly bsums (exact integer eq)
QDOT-004 YAML format set == trait-impl format set (HashSet equality)
QDOT-005 Every format has at least "scalar" dispatch key

Pinned constants

  • AC_QDOT_ULP_TOLERANCE = 4
  • AC_QDOT_CROSS_FORMAT_GARBAGE_FACTOR = 100.0
  • AC_QDOT_DISPATCH_MIN_KEY = "scalar"

Five Whys

See commit message — captures why 4 ULPs (not 1), why HashSet equality, and why Fail-on-empty-registry.

Test plan

  • cargo test -p aprender-core --lib qdot_001_005 — 30 passed
  • PMAT pre-commit gates green
  • CI green

🤖 Generated with Claude Code

Binds FALSIFY-QDOT-001..005 from quantized-dot-product-v1 at
PARTIAL_ALGORITHM_LEVEL via 5 verdict functions plus pinned ULP and
divergence constants.

- QDOT-001: SIMD vs scalar within 4 ULPs (|simd-scalar| <= 4*eps*|scalar|)
- QDOT-002: cross-format kernel produces >100× divergence (strict)
- QDOT-003: precomputed bsums == on-the-fly bsums (exact integer eq)
- QDOT-004: trait-impl set == YAML registry set (no orphans, no ghosts)
- QDOT-005: every format has at least the `scalar` dispatch entry

## Five Whys

1. Why does quantized-dot-product-v1 list 5 falsification IDs without
   algorithm-level discharge? PMAT lints flagged FALSIFY-QDOT-001..005
   as unbound at PARTIAL_ALGORITHM_LEVEL.
2. Why does that block ship? Coverage % cannot move while peripheral
   GGML-format-isolation contracts have no algorithm-level verdict
   module.
3. Why 4 ULPs not 1? A Q4_K dot product accumulates over 32 elements
   with 6-bit quants and FP16 scales — IEEE summation drift over 32
   adds is bounded by ~4 ULPs of the result. Tighter would Fail every
   correct SIMD kernel; looser would let actual sign-error bugs slip.
4. Why a HashSet for QDOT-004 vs sorted-vec equality? Format names
   are unordered identifiers; sorted comparison would impose a
   declaration-order constraint the YAML doesn't actually require.
   HashSet equality matches the contract intent: "every name in YAML
   has a code impl AND every code impl has a YAML name."
5. Why Fail-on-empty-registry for QDOT-004? Vacuous Pass would mask
   the regression class "registry was deleted entirely." A future
   `pv comply check` run on an empty registry must Fail loudly so
   the regression is caught at PR time.

Adds 30 unit tests including a 0..7 ULP sweep on QDOT-001 and a
±1-element symmetry test for QDOT-004. Realistic-healthy walks the
3-format steady state (Q4_K, Q6_K, Q8_0); pre-fix walks 5
simultaneous regressions (sign-error in nibble extraction, 1% cross-
format collision, off-by-one bsum, orphan trait-impl, missing
dispatch entry).

No runtime % shift; algorithm-level coverage advances by 5 gates.
@noahgift noahgift force-pushed the feat/qdot-001-005-partial-discharge branch from 838aca3 to 0bc7f62 Compare May 11, 2026 15:36
@noahgift noahgift enabled auto-merge (squash) May 11, 2026 15:36
@noahgift
Copy link
Copy Markdown
Contributor Author

Superseded by #1637 (135-PR squash). The commit content is included verbatim in that PR's diff. Closing now to release runner slots; this PR would have auto-closed when #1637 merges.

@noahgift noahgift closed this May 12, 2026
auto-merge was automatically disabled May 12, 2026 09:21

Pull request was closed

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.

1 participant