Skip to content

[FEATURE] Enable cosine similarity to return original vectors rather than normalized vectors with Faiss Engine #3083

@navneet1v

Description

@navneet1v

Description

Currently, when using cosine similarity with Faiss Engine, OpenSearch/k-NN does not return the original non-normalized vectors with Derived Source Enabled. Since we normalize the vectors before storing them to avoid doing normalization at every distance computation phase(segment flush, merges, search query).

Due to this limitation a user who needs original vectors for re-ranking or any other purpose has to do either of this:

  1. Store vectors outside of OpenSearch too.
  2. Store the norm with the document and then reconstruct vectors at the final step using script score(which is very slow) to recover original vectors, resulting in overheads.

Request:

Add the ability to store the norm of the vector along side flat vectors and then return the original vector in derived source eliminating the need for the workarounds

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions