FAISS -1 external ID collides with sentinel
Verified on Windows x64 with Python 3.11.7 and faiss-cpu 1.16.0: add two vectors to IndexIDMap2 using external labels -1 and 42, then search for the -1 vector with k=3. Results are [-1,42,-1]; the valid nearest vector and the empty-result padding both use -1, so a caller cannot distinguish that stored ID from no match. Reserve -1 and validate external IDs before insertion; map application keys to other int64 values.
Empty-index comparison: with k=2 and no stored vectors, FAISS IndexFlatL2 returned labels [-1,-1] and FLT_MAX distances for both slots; an empty LanceDB table returned []. Filtering FAISS sentinel labels leaves the same zero hits. Reproducer: empty_vectors.py (lancedb 0.41.0, faiss-cpu 1.16.0).
Filtering out
-1results also removes the stored vector. Reject negative labels at insertion so the sentinel never collides with a real ID. If you have hit a variant of this, share it below.