Skip to content

v0.9.3 — contract gate, isolation repair, 7.4× distance path

Choose a tag to compare

@spranab spranab released this 14 Jul 01:38

v0.9.3 — correctness + performance train

Items 1–3 of the converged improvement plan (designed in a two-round debate with gpt-5.6-sol, grounded in code audit), plus a measured speed/accuracy program.

Correctness

  • Central numeric/vector contract gate: typed InvalidEmbedding { path, index, reason } / InvalidScalar { path, field, value } on every entry path — record, record_batch (whole-batch prevalidation), record_text (including the embedder''s own output — catches external-embedder NaN like the #60 ONNX 0/0 class), record_with_rid, insert_vector, embed, recall — validated before any side effect. Wrong-dimension insert_vector was a panic; now a typed error.
  • recall_demand isolation repair (schema v33): the v0.9.0 demand table was globally keyed and stored raw query text in plaintext even on encrypted databases. Now namespace-keyed (unscopable legacy rows purged by migration), and demand capture is fully disabled on encrypted databases. knowledge_gaps(namespace=...) is scope-explicit; session_digest(namespace=...) scopes decisions + conflicts for multi-tenant hosts.
  • Text corrections refused: correct(new_text=...) paired new text with the old embedding — corrected memories kept being retrieved under their old meaning. Now a typed CorrectionRequiresReembed (HTTP 422 with the workaround) until the vector-coherent correction path ships in v0.10. Metadata/importance/valence corrections unchanged; replication replay unaffected.

Performance — measured

  • 7.39× on the distance path (818.4 → 110.8 ns/comparison, dim 384, release): stored-vector norms precomputed at insert (were recomputed on every comparison), plus SIMD dot kernels — AVX2+FMA via runtime CPU detection (one wheel exploits whatever machine it lands on) with a portable ILP-unrolled fallback (aarch64 verified on CI). Kernels pinned to the sequential reference within 1e-9. Reproduce: cargo test --release -p yantrikdb --lib kernel_timing -- --nocapture --ignored.
  • End-to-end: scaling-benchmark recall p95 roughly halved (4.0–9.5ms → 2.6–4.8ms).

Accuracy

  • Keyword-lane stopword hardening (function words like "during" were anchoring keyword_match boosts on unrelated memories). No regression on the golden-query suite; the deeper ranking work (IDF-weighted keyword boosts, composite-score rebalance) is diagnosed with measurements and scheduled for v0.10.

Published to PyPI (pip install -U yantrikdb) and crates.io.