You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(search): real HNSW default + real relevance scores end-to-end
Two correctness fixes that make vector search genuinely real at the
product boundary (Week-2 truth sweep):
- HNSW is now the default vector backend. verisim-vector shipped a
complete ~670-LOC HNSW (Malkov-Yashunin) that was built but orphaned:
the API's in-memory ConcreteOctadStore used BruteForceVectorStore, so
the documented "HNSW similarity search" was aspirational. Swapped the
type alias + construction to HnswVectorStore. (Persistent/redb vector
backend stays brute-force for now — separate follow-on.)
- Search scores are now real, not fabricated. text/vector/similar-query
handlers reported score = 1.0 - 0.1*i (a synthetic rank sequence),
discarding the BM25 (Tantivy) and cosine (vector index) scores the
stores already compute. Added additive OctadStore::search_text_scored
/ search_similar_scored (-> Vec<(Octad, f32)>); the unscored methods
become thin wrappers, so gRPC/VQL callers are unchanged. The three
handlers surface the real scores.
Test test_vector_search_returns_real_cosine_scores pins the distinction:
the second hit carries its true ~0.994 cosine, which the old synthetic
scheme would have reported as exactly 0.9. KNOWN-ISSUES #9 updated
(HNSW now the default), new #27 records the score-fabrication fix.
Workspace: 628 passed / 0 failed; clippy clean under -D warnings.
Closes Week-2 items 6-7 of docs/reviews/2026-06-11-deep-review-and-july-1-plan.adoc
https://claude.ai/code/session_01E8BpV19yxhf67UrCrvkfTr
**Current state:** The HNSW (Hierarchical Navigable Small World) implementation in `verisim-vector` is a genuine, functional implementation at approximately 670 lines of Rust. A previous audit incorrectly claimed this was brute-force search. This is **not** an issue -- it is a correction of a previous mischaracterization.
114
+
**Current state:** The HNSW (Hierarchical Navigable Small World) implementation in `verisim-vector` is a genuine, functional implementation at approximately 670 lines of Rust (real Malkov–Yashunin layered graph, configurable `M`/`ef_construction`/`ef_search`, cosine/euclidean/dot metrics).
115
115
116
-
**Impact:** None (this is a positive clarification). The vector modality store uses a real approximate nearest-neighbor algorithm, not a naive linear scan.
116
+
**Resolved (wiring):** 2026-06-13. Until now this module was *built but orphaned* — the API's `ConcreteOctadStore` used `BruteForceVectorStore` (exact O(n) linear scan), so the "HNSW similarity search" claim was aspirational at the product boundary. The in-memory `ConcreteOctadStore` now uses `HnswVectorStore` as its vector backend, so the default build performs real approximate nearest-neighbor search. (The persistent/redb vector backend remains brute-force over an mmap'd store — a separate follow-on.)
117
117
118
118
**Note:** This entry exists to prevent future audits from repeating the same incorrect claim.
119
119
@@ -267,3 +267,11 @@ Added `rescript.json` for build configuration.
267
267
* `temporal_consistency_drift` works at 1-second timestamp resolution, so two writes within the same second register as a (mild) conflict signal.
268
268
269
269
**Original issue:** The product's core claim — drift detection — ran on no real data anywhere in the system.
270
+
271
+
=== 27. Search Scores Were Fabricated From Rank — ✅ RESOLVED
**Resolved:** 2026-06-13. The text, vector, and similar-query search endpoints all reported `score: 1.0 - (i as f32 * 0.1)` — a synthetic sequence derived from result position, discarding the real relevance scores the modality stores already compute (Tantivy BM25 for documents, cosine similarity for vectors). The octad store now exposes `search_text_scored` / `search_similar_scored` (returning `Vec<(Octad, f32)>`); the three handlers surface those real scores. Test `test_vector_search_returns_real_cosine_scores` pins the distinction (the second hit reports its true ~0.994 cosine, not synthetic 0.9).
276
+
277
+
**Original issue:** API search responses carried fabricated scores, so any client ranking or thresholding on `score` was meaningless.
0 commit comments