There must be some sort of caching for the first query to be longer than the others.
Also please note that right now the default index used in when you do add_faiss_index is an L2 flat index.
The flat index can be quite slow so you should probably use the HNSW index from faiss.
Moreover for DPR embeddings, we have to tell the index to use the maximum inner product metric instead of L2.
To summarize, here’s how to use HSNW with maximum inner product:
import faiss

d = 768  # vectors dimension
m = 128  # hnsw parameter. Higher is more accurate but takes more time to index (default is 32, 128 should be ok)
index = faiss.IndexHNSWFlat(d, m, faiss.METRIC_INNER_PRODUCT)

my_dataset.add_faiss_index("embeddings", custom_index=index)