PR6 — i8 hot-path measure + ε/recall/fidelity safety net (LOC-64)#68
Merged
Conversation
…et (LOC-64) Brainstorming output for the next work-stream: apply the PR1 "measure before changing" pattern to the SHIPPED hot path (i8), which every prior review/bench scrutinized only on the f32 fallback. Non-destructive — kernels unchanged. Captures i8 bench baseline + numeric ε parity + a recall@k quantization-quality gate, all fail-closed in CI on the shipped faer+quant compile tree. Implementation follows via writing-plans.
…elity, measured baselines) (LOC-64) Plan and spec for the i8 measure-first + safety-net work, finalized after an adversarial pre-flight that (a) compiled the test/bench code on the shipped vector_quant_i8,vector_faer tree and (b) measured real baselines: recall@10 = 0.996875 (i8@768 is ~lossless), max|cosine_i8 - cosine_f32_true| = 0.00121. Net 2 redesigned to recall floor (>= 0.98) + deterministic cosine-fidelity backstop (<= 0.005), f64 ground truth (kills x86/ARM ULP jitter), const-assert + CI name guards against vacuous gates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies the PR1 "measure before changing" pattern to the shipped int8 hot path — every prior review/bench scrutinized only the f32 fallback, while the release build (
vector_faer,vector_quant_i8) actually scores candidates via the i8 kernel. Non-destructive:vector_math.rs0-diff;vector_quant.rschanges only insidemod tests; everything else additive.What
exact_scan_i829.98 µs vsexact_scan[faer]452.82 µs @ 2000×768.recall@10 ≥ 0.98— measured 0.996875 (i8@768 is ~lossless). Deterministic: f64 GT + integer-exact i8, total-order(score, index)tie-break.max|cosine_i8 − cosine_f32_true| ≤ 0.005— measured 0.00121. Ranking-free, fully deterministic, sensitive backstop against a lossier future quantizer.vector_faer,vector_quant_i8tree, with per-net name guards so cfg-excluding a net fails closed.const _: () = assert!(...)compile guards.Finding: the shipped i8 path is both ~15× faster than the f32 fallback and ~lossless on recall@10 — the right call to ship, now CI-guarded.
Spec / plan / journal:
docs/perf/vector-math-refactor/PR6-spec-…md,PR6-plan-…md,PR6.md.Note: build emits one pre-existing unrelated warning (
source_rag.rs:2280dead_code, 0 diff on this branch).