15 ms·
Faiss: Facebook's open source vector search library
- threatofrain 5y agoAnother HN post from today on vector search. https://news.ycombinator.com/item?id=29554986 https://news.ycombinator.com/item?id=29554986
- prophesi 5y agoAnd I'm wondering if these are all making the front page because of this Show HN from earlier. https://news.ycombinator.com/item?id=29551947 https://news.ycombinator.com/item?id=29551947
- kristjansson 5y agoSee also: Ann-benchmarks[0], Annoy[1], ScaNN[2] [0]: http://ann-benchmarks.com http://ann-benchmarks.com [1]: https://github.com/spotify/annoy https://github.com/spotify/annoy [2]: https://github.com/google-research/google-research/tree/master/scann https://github.com/google-research/google-research/tree/mast...
- monkeybutton 5y agoAre Facebook's look-alike audiences implemented using faiss?
- Kydlaw 5y agoThere is a lot done vector search technology right now. I was less fortunate when looking at ways to store the vectors in databases. I already looked at Pinecone or Weaviate but they are all paid products. Is there some people having feedback on this?
- lmeyerov 5y agoA lot of VCs & founders trying to commercialize other people's SW are wondering this too :) AFAICT: Most of those are basically UIs, data management, & integrations around the same set of vector index libs like FAISS + same set of models like HF, and even the same set of inference server libs (triton, aws/gcp, fastapi, ...). So you'd be evaluating different commercializations of the same core OSS tech. There are useful evaluations to do at that level, but more like licensing, business model, UI, model management, etc. Another commenter below recognized that regular DBs (ES, Postgres, ..) are starting to add vector indexes. As someone doing a lot of architecting for log/event/graph correlation/investigation systems, I've been tracking whether managed neural search db is a feature vs new category, and how big. Ex: those corporate sides definitely feels like an Algolia competitor, but for the 99% case we normally do, maybe just an OSS feature/lib of whatever DB/framework you're already using? Not obvious!
- gk1 5y agoI don’t know when you last looked but as of a few months ago Pinecone has a free tier that fits 1M items with <100ms latency.
- kateshao0510 5y agoAnother option is Milvus:https://github.com/milvus-io https://github.com/milvus-io. It's an open-source vector database.
- forgotmyoldacc 5y agoMilvus is a layer on top of FAISS.
- homarp 5y agoHave you looked at https://github.com/jina-ai/executor-hnsw-postgres https://github.com/jina-ai/executor-hnsw-postgres ?
- ss892714028 5y agoMilvus Vector database is completely open-source. https://github.com/milvus-io/milvus https://github.com/milvus-io/milvus
- andreer 5y agoThere is https://vespa.ai https://vespa.ai which is fully open source and free (but we do run a service if you want one).
- amelius 5y agoShow me the benchmark results!
- gk1 5y agoFun seeing vector search all over the front page today. :) The official documentation on Faiss is rather light, so we made “The Missing Manual to Faiss”: https://www.pinecone.io/learn/faiss-tutorial/ https://www.pinecone.io/learn/faiss-tutorial/ Previous discussion: https://news.ycombinator.com/item?id=29291047 https://news.ycombinator.com/item?id=29291047
- Radim 5y agoI've built a few vector search engines too, so this was an immediate red flag: "Brute force takes 12 seconds / query on 1 million vectors of 768 dim". No, a sane brute-force search (via BLAS) that size should be a ~200ms / query. I.e. SIXTY TIMES faster! If they (Faiss?) got this wrong, what else did they get wrong? I understand researchers want to showcase their "best and fastest" approach, so they fudge the baselines. Approximate search can be genuinely useful – orders of magnitude faster than (even non-fudged) brute force, and using less RAM too. But as a user, tech stack complexity is also a consideration. Because the trade-off is not only "speed vs accuracy". Brute force is a trivial algorithm, easy to implement and maintain with no corner cases. It has completely predictable data access patterns (linear, sequential, fixed response time, 100% accuracy). It supports operations (update, range, dynamic k-NN) that complex indexes struggle with. So if your dataset is tiny – and anything under 1 million counts as tiny – do you really need to maintain an external dependency of fancy data structures and approximate algorithms?
- jhj 5y ago1 vector against 1 million vectors in 768 dims at k = 10 takes 259 ms for me using Faiss CPU IndexFlatL2 with Intel MKL: https://gist.github.com/wickedfoo/165b69075cfcceba872aec1c46aa3ce6 https://gist.github.com/wickedfoo/165b69075cfcceba872aec1c46...
- Radim 5y agoSounds about right. I like how you tested "query multiple vectors at once". Super useful when documents can be batched, for increased throughput. If I'm reading your benchmark correctly, Faiss brute-force can do a batch query of 10,000 vectors in ~19 seconds => 1.9 ms per vector. That's pretty cool – and more than 130x faster than querying those 10,000 vectors individually, one by one.
- animanoir 5y agoSuddenly vector search is relevant. Was this orchestrated?
- tonetheman 5y agoI feel the same. It is not by chance I would think.
- ladon86 5y agoNot everything is a conspiracy. Google announced their new vector search service today, and that prompted someone on HN to post a related library that they knew about. It’s certainly possible that that person works at FB, but that doesn’t mean it’s some kind of orchestrated PR maneuver.
- gk1 5y agoThis happens a lot. Usually starts with one popular post about a topic. Then someone explores deeper and finds another interesting article on the same topic, and submits it.
- sangnoir 5y agoIt's an old, mutually beneficial PR arrangement known as the Newton-Leibniz calculus
- unhammer 5y agoIt has happened that I have read about one article and find something related (following links or looking things up) that I find even more interesting and then submit that.
- s-xyz 5y agoFunny to see this thread, as I recall Google just recently posted a similar vector search library.
- amelius 5y agoBut nobody is posting benchmarks.
- jean_valje4n 5y agoCan someone tell me if these vector search things have anything in common with postgres's text search vectors, which have been implemented in postgres for quite a while now?
- gk1 5y agoNot much in common. A "vector" in Postgres is a tokenized and normalized array of words. So 'a fat cat sat on a mat and ate a fat rat' becomes 'a' 'and' 'ate' 'cat' 'fat' 'mat' 'on' 'rat' 'sat'. This just makes keyword searches a bit easier. (Source: https://www.postgresql.org/docs/9.4/datatype-textsearch.html https://www.postgresql.org/docs/9.4/datatype-textsearch.html) A "vector" in vector search solutions is a dense vector generated by a transformer model. A sentence like 'a fat cat sat on a mat and ate a fat rat' put through a model becomes an array of floating-point numbers like [0.183, -0.774, ...], with hundreds of values (often 768). The point is that this vector is positioned in a 768-dimensional space in close proximity to semantically similar sentences. So then searching by semantic meaning is a simple (well...) exercise in measuring the distance between your query and the surrounding vectors. We have a whole course on the topic, coincidentally also on the front page of HN today: https://www.pinecone.io/learn/nlp https://www.pinecone.io/learn/nlp
- forgingahead 5y agoThanks for the nice and clear summary! At what point does it make sense to switch to using vector search solutions (compared to keyword searches)? Obviously Google et al need it, but for regular apps, maybe academic repositories and so on, is there a threshold in which we can start the discussion to switch? Or phrased another way, when do we know we should be looking at vector search solutions to enhance the search in our application?
- gk1 5y agoWhen your users start complaining that your search sucks. :) Either because your catalog has grown to the point where a traditional keyword search makes it harder to find relevant items, or because users are increasingly expecting their apps to just "know what they mean" (like Google, Spotify, Amazon, and Netflix do).
- sydthrowaway 5y agoWhat is vector search
- gk1 5y agohttps://www.pinecone.io/learn/vector-search-basics/ https://www.pinecone.io/learn/vector-search-basics/
- gujun720 5y agoCheck my project Milvus vector database (https://milvus.io https://milvus.io). We've published a bunch of demo cases powered by vector database on GitHub. https://github.com/milvus-io/bootcamp https://github.com/milvus-io/bootcamp
- shanghaikid 5y agoTry open source vector database: https://github.com/milvus-io/milvus/ https://github.com/milvus-io/milvus/
- happy_old_daddy 5y agoAn open-source vector database:https://github.com/milvus-io/milvus https://github.com/milvus-io/milvus
- dmitriid 5y agoHow does on update the index? All I see at a quick glance is how to create/re-create/train/re-train the dataset from scratch
- timdaub 5y agofuck facebook* *Facebook is a bad company that puts profit over people and they should be boycotted. People that work at Facebook are complicit to its policy and so also their publications should be boycotted.