experiment(search): productionize hybrid fusion and evaluate HDC - #406
Open
ajroetker wants to merge 11 commits into
Open
experiment(search): productionize hybrid fusion and evaluate HDC#406ajroetker wants to merge 11 commits into
ajroetker wants to merge 11 commits into
Conversation
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.
Decision
This PR changes the product direction:
The production goal is to combine lexical, dense, sparse, exact structured, and explicit graph evidence through bounded candidate generation, calibrated fusion, exact candidate scoring, optional reranking, and explainable final scores.
Packed-bipolar HDC is evaluated only as an optional candidate-local structural interaction feature. On the current held-out workload it makes the learned reranker worse, so it remains a no-go.
The existing
hypervectorprototype stays experimental. If HDC is ever revived, it should be a distinct logical representation/index that lowers to existing dense-vector storage and ANN machinery—not a barehdcoption on ordinary embeddings, not a new physical engine, and not an implicit graph-index creator.Hybrid path implemented
withmembership scored over the full retrieved candidate uniontop_ntruncates only after scoringexplain: trueoutput containing raw score, rank, calibrated score, weight, contribution, fused score, final score, and reranked statetotal.relation: "gte"Graph-index creation remains explicit and independent.
UX
{ "full_text_search": { "match": {"field": "description", "text": "quiet waterfront city"} }, "semantic_search": "quiet waterfront city with mountain access", "indexes": ["location_embedding"], "with": { "pacific_region": { "term": {"path": "/region", "value": "pacific_northwest"} } }, "graph_searches": { "near_transit_hub": { "type": "neighbors", "index_name": "travel_graph", "start_nodes": {"keys": ["hub:west-coast"]}, "params": {"edge_types": ["SERVES"], "direction": "out", "max_depth": 1} } }, "merge_config": { "strategy": "rsf", "window_size": 100, "weights": { "full_text": 0.35, "location_embedding": 1.0, "pacific_region": 0.2, "near_transit_hub": 0.15 } }, "reranker": { "provider": "antfly", "model": "cross-encoder/ms-marco-MiniLM-L-6-v2", "field": "description", "top_n": 10 }, "limit": 100, "explain": true }window_sizeis the per-ranked-source retrieval/calibration budget.limitis the final page size without a reranker; with a reranker it is the fused candidate pool, andreranker.top_nis the final count. Exact filters, tenant constraints, deletion visibility, and graph facts remain authoritative.HDC evidence
The pinned WANDS protocol uses:
The new candidate-local follow-up fixes embedding RaBitQ as candidate generation and compares:
Held-out NDCG@10:
[-0.017478, -0.000973][-0.015767, -0.000181][-0.016230, 0.001916]At 200 candidates, learned non-HDC reranking beats fixed fusion by
+0.009121, CI[0.002248, 0.017206]. HDC is significantly worse at 50 and 100 candidates and has no demonstrated advantage at 200. Graph-answer top-1 also drops from0.9785to0.9677.Packed HDC uses 42,994,000 bytes at 8,000 dimensions. Its 200-candidate feature computation is fast (
0.0674 ms/queryon the recorded arm64 ReleaseFast run), but the feature does not improve relevance.Machine-readable result:
zig/bench/baselines/hdc-wands-candidate-reranker-2026-07-27.jsonFull protocol, earlier exact/RaBitQ/packed experiments, lifecycle design, UX, references, and limitations:
zig/HDC.mdRemaining production gates
This PR is a production-shaped hybrid execution prototype, not completion of the full product goal. Before advertising one stable cross-deployment contract, it still needs:
Validation
zig build root-test— 222 passedzig build serverless-test— 337 passed, 2 opt-in object-store integrations skippedzig build root-test -- --test-filter hybrid— 9 passedzig build root-test -- --test-filter fusion— 10 passedzig build api-table-reads-docid-test -- --test-filter reranks— 21 passedzig build hdc-wands-bench-testmake zig-generated-checkgit diff --check