fix: apply similarity threshold on raw cosine before normalization - #22
Open
yugalkaushik wants to merge 2 commits into
Open
fix: apply similarity threshold on raw cosine before normalization#22yugalkaushik wants to merge 2 commits into
yugalkaushik wants to merge 2 commits into
Conversation
yugalkaushik
commented
Aug 26, 2026
Collaborator
- The similarity threshold is now checked on the raw cosine score before normalization, so normalization can no longer stretch a weak pair to 1.0 and let it pass. Floor, normalize, and tag/link/temporal bonuses are kept, but they only rank pairs that already passed.
- Default similarity threshold raised from 50% to 70%.
| export const SEMANTIC_FLOOR = 0.3; | ||
|
|
||
| export const DEFAULT_THRESHOLD = 0.5; | ||
| export const DEFAULT_THRESHOLD = 0.7; |
There was a problem hiding this comment.
Note: According to its model card, multilingual-e5-small (the model Joplin uses for word embedding) distributes cosine similarity scores in the range [0.7, 1] (related Joplin issue).
Contributor
There was a problem hiding this comment.
Good point, thanks for flagging this. The absolute threshold doesn’t really separate related and unrelated pairs for this model. We should use a relative cutoff, with a small absolute floor for tiny vaults
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.