Skip to content

[BUG] KNN Query using FAISS score is incorrect #2592

@NitinAggarwal1

Description

@NitinAggarwal1

What is the bug?
We have used the KNN plugin in open search to try doing the vector search .

Details of the index are as follows :

  • Index Mapping : "description_dense_vector": {
    "type": "knn_vector",
    "dimension": 768,
    "method": {
    "engine": "faiss",
    "space_type": "innerproduct",
    "name": "hnsw",
    "parameters": {}
    }
    }

  • Query we use to get result set :
    GET ml-products/_search
    {
    "track_total_hits": true,
    "profile": "true",
    "_source": {
    "includes": [
    "product_id",
    "description",
    "p_product_catalog_search",
    "Brand_s",
    "multifield_text"
    ]
    },
    "size": 15,
    "query": {
    "neural": {
    "description_dense_vector": {
    "query_text": "mini kobalt tool kt",
    "model_id": "b_wGhJUB8vZIfNtyHHkc",
    "min_score": "0.1"
    }
    }
    }
    }

Issue 1 : For min_score = 0.8 we are getting 60 results , while for min_score = 0.9 we are getting 3356 results .
Issue 2 : Issue 2 : For max_distance = 0.8 we are getting 3 results , while for max_distance = 0.9 we are getting 0 results
It is just opposite the normal behaviour where min_score if reduced the recall should increase.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What is the expected behavior?
A clear and concise description of what you expected to happen.

What is your host/environment?

  • OS: Container-Optimized OS with containerd (cos_containerd)
  • Version : 2.19
  • Plugins : KNN Native Plugin

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
We see the faiss

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions