FB-004: Adaptive search threshold for hash vs ONNX embeddings#17
Merged
FB-004: Adaptive search threshold for hash vs ONNX embeddings#17
Conversation
Hash fallback embeddings produce similarity ~0.05-0.28 (not semantic).
The hardcoded 0.3 threshold filtered out 90% of results, causing silent
empty search results when ONNX is unavailable.
Fix: detect embedding model at runtime and apply appropriate threshold:
- ONNX (MiniLM-L6): 0.3 (meaningful similarity scores)
- Hash fallback: 0.05 (permissive, ranking is noise)
Changed files:
- memory-initializer.ts: getAdaptiveThreshold() helper, searchEntries()
- memory-bridge.ts: _getAdaptiveThreshold() with cached model detection,
bridgeSearchEntries(), bridgeSemanticSearch(), bridgeSearchPatterns(),
bridgeLoadSessionPatterns()
Co-Authored-By: claude-flow <ruv@ruv.net>
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.
Fixes #3
Detects embedding model at runtime and applies 0.05 (hash) or 0.3 (ONNX) threshold instead of hardcoded 0.3 that filtered out 90% of results with hash embeddings.