feat: Add configurable embedding similarity threshold for graph store node matching#3593
Merged
prateekchhikara merged 2 commits intomem0ai:mainfrom Oct 18, 2025
Merged
Conversation
… node matching - Added `threshold` parameter to GraphStoreConfig (default: 0.7, range: 0.0-1.0) - Updated all graph memory implementations to use configurable threshold: * Neo4j (graph_memory.py) * Kuzu (kuzu_memory.py) * Memgraph (memgraph_memory.py) * Neptune Analytics (neptunegraph.py) * Neptune DB (neptunedb.py) * Neptune base (base.py) - Replaced hardcoded 0.9 threshold with self.threshold in node matching - Backward compatible with graceful fallback to 0.7 - Pydantic validation ensures threshold is between 0.0 and 1.0 Closes mem0ai#3590
Contributor
|
Hey @ron-42 can you update the docs please? Thank you for the implementation. |
…d feature - Added detailed guide at docs/platform/features/graph-threshold.mdx - Included use cases, examples, and troubleshooting - Added navigation entry in docs.json - Addresses maintainer feedback on PR mem0ai#3593
Contributor
Author
|
@parshvadaftari I've updated the docs parts also, now review the changes and do let me know in case of further enhancement. |
Contributor
|
Hey @ron-42 The tests are failing can you please check? |
This was referenced Oct 19, 2025
garciaba79
pushed a commit
to garciaba79/mem0
that referenced
this pull request
Feb 12, 2026
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
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.
Added
thresholdparameter to GraphStoreConfig (default: 0.7, range: 0.0-1.0)Closes #3590
Description
This PR adds a configurable
thresholdparameter to the graph store configuration to solve UUID collision issues during graph node ingestion.Problem: The hardcoded threshold (0.9) caused similar UUIDs like
MXxBUE18QVBQTElDQVRJT058MjM3MTM4NjI5andMXxBUE18QVBQTElDQVRJT058MjA2OTYxMzMto be incorrectly matched as the same node, leading to data loss where relations for one UUID were attached to another UUID's node.Solution: Made the embedding similarity threshold configurable per client, allowing users to set stricter thresholds (e.g., 0.95) for UUID scenarios or more permissive thresholds (e.g., 0.6) for natural language entities.
Usage:
Type of change
How Has This Been Tested?
Checklist:
Maintainer Checklist