# Nearest Neighbor Indexes for Similarity Search

**URL:** <https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72>\
**Category:** General\
**Created:** [February 1, 2022, 7:58pm UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72 "2022-02-01T19:58:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![discobot](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/discobot/32/2_2.png) [@discobot](https://community.pinecone.io/u/discobot)\
**Post date:** [February 1, 2022, 7:58pm UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/1 "2022-02-01T19:58:10Z")

</div>

Vector similarity search is a game-changer in the world of search. It allows us to efficiently search a huge range of media, from GIFs to articles — with incredible accuracy in sub-second timescales for billion+ size datasets.

One of the key components to efficient search is flexibility. And for that we have a wide range of search indexes available to us — there is no ‘one-size-fits-all’ in similarity search.

* * *
This is a companion discussion topic for the original entry at [https://www.pinecone.io/learn/vector-indexes/](https://www.pinecone.io/learn/vector-indexes/)

---

<div class="post-metadata">

**Author:** ![Prabhat](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@Prabhat](https://community.pinecone.io/u/Prabhat)\
**Post date:** [July 7, 2022, 11:47am UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/2 "2022-07-07T11:47:49Z")

</div>

How does efConstruction have an impact on search time for IVFHNSW (as mentioned in this description)? I am observing something in my experiments but can’t figure out why.

---

<div class="post-metadata">

**Author:** ![jamesbriggs](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jamesbriggs/32/52_2.png) [@jamesbriggs](https://community.pinecone.io/u/jamesbriggs)\
**Post date:** [July 12, 2022, 3:50pm UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/3 "2022-07-12T15:50:02Z")

</div>

efConstruction primarily effects your build time (eg larger efConstruction == longer build time). It has been some time since working with HNSW so take this with a pinch of salt, different efConstruction values create a more or less optimized graph, so search times could be slower or faster because of that.

Generally, greater efConstruction means more optimized graph, and faster search times. But I don’t think there is a perfect correlation.

---

<div class="post-metadata">

**Author:** ![Jerome](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jerome/32/127_2.png) [@Jerome](https://community.pinecone.io/u/Jerome)\
**Post date:** [July 22, 2022, 5:54pm UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/4 "2022-07-22T17:54:40Z")

</div>

Hi guys,  
regarding the efConstruction parameter, I have a question about the performance graphs shown in the HNSW section. How can M be greater than efConstruction ? In my understanding of the paper algorithms 1 and 2 by Malkov and Yashumin, during the node insertion, the edges are created between the inserted node and the M (or Mmax) nearest neighbors among the efConstruction ones returned for a given layer… So it seems to me that M is always less or equal to efConstruction. Same for the efSearch parameter which is by construction less or equal to the efConstruction, the maximum possible value for M (Mmax).  
Thanks for your clarification  
Best regards  
Jerome

---

<div class="post-metadata">

**Author:** ![tang-hi](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tang-hi](https://community.pinecone.io/u/tang-hi)\
**Post date:** [February 9, 2023, 5:41am UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/5 "2023-02-09T05:41:16Z")

</div>

Great article  
I found a typo in  
`This is a strong result — 90% of the performance could certainly be a reasonable sacrifice to performance if we get improved search-times.`

It should be accuracy?

---

<div class="post-metadata">

**Author:** ![don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@don](https://community.pinecone.io/u/don)\
**Post date:** [May 29, 2023, 2:57pm UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/6 "2023-05-29T14:57:43Z")

</div>

Two problems with the sample code.

I think ‘data’ was defined in the previous lesson. When I try to call the add function to an index, I get an assertion error from faiss. Is there a modification to ‘data’ that would make this work?

Later, a new variable is used ‘wb’. It doesn’t seem to be defined anywhere.

---

<div class="post-metadata">

**Author:** ![yangtaohehe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/yangtaohehe/32/662_2.png) [@yangtaohehe](https://community.pinecone.io/u/yangtaohehe)\
**Post date:** [June 6, 2023, 1:56pm UTC](https://community.pinecone.io/t/nearest-neighbor-indexes-for-similarity-search/72/7 "2023-06-06T13:56:15Z")

</div>

Hi, I can’t found any ‘Voronoi diagrams’ info in source code of Faiss(IndexIVF.h and IdexIVF.cpp)  
So, why did you said “It(IVF) works on the concept of Voronoi diagrams”
