Controlling the semantic search similarity metric #1649
Replies: 1 comment
|
If you're referring to the vector store used by GraphRAG's semantic search, the similarity metric is determined by the underlying vector-store implementation rather than by the LLM configuration. For example, if you're using a vector store that supports both L2 and cosine distance, cosine generally needs to be selected when the vector index is created/configured. It isn't simply a ranking option applied after retrieval. I'd check which vector-store implementation your GraphRAG version is using first. If you're using the default store in that version, the relevant configuration/code path is the vector-store/index configuration rather than Also, be careful when comparing L2 and cosine: if the embeddings are L2-normalized, squared L2 distance and cosine similarity induce the same ranking (they are monotonically related), although the returned score values are different. If you share the GraphRAG version and the vector-store configuration you're using, I can point to the exact setting/code path for changing it to cosine. |
Uh oh!
There was an error while loading. Please reload this page.
I noticed in the code that the default semantic search similarity metric seems to be L2. Where can I configure it to other metric? such as cosine
All reactions