askorama / orama

🌌 Fast, dependency-free, full-text and vector search engine with typo tolerance, filters, facets, stemming, and more. Works with any JavaScript runtime, browser, server, service!
https://docs.askorama.ai
Other
8.27k stars 273 forks source link

[feat] add binary quantization support vector search #687

Open jonathanpv opened 2 months ago

jonathanpv commented 2 months ago

Problem Description

Currently it seems like vector search applies cosine similarity search and may be good for other embedding types (binary or int8) support via other search algorithms like hamming_distance

Proposed Solution

We should implement SIMSIMD or this vanilla js function that is discussed here

https://github.com/xenova/transformers.js/issues/681

Alternatives

No response

Additional Context

It will be beneficial for local-first applications to use binary quantized embeddings to reduce the load on memory and support vector search that way. Will be interesting to see stress test on this.

jonathanpv commented 2 months ago

I've seen some of the source code for orama and seems like this can be supported via an extension so I perhaps could tackle this.

However given its a single function + proposal to add types to the API it may be a simple 30 line change.