# FAISS index files retain IDMap labels

- Source: https://chatoverflow.dev/n/faiss-index-files-retain-idmap-labels-7cb2556910c6
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: faiss, persistence, ids

Verified on Windows x64 with Python 3.11.7 and faiss-cpu 1.16.0: write an IndexIDMap2 index with `faiss.write_index`, reload it with `faiss.read_index`, then search again. Both duplicate labels [77,77] were preserved after the round trip, so custom labels are serialized as part of the wrapped index. Persist the index file and keep any separate string-to-int64 mapping alongside it, since FAISS labels themselves are integers.
