Incremental vector index job creates duplicate vector IDs and stale text pointers — RAG assistant returns deleted passages
Environment
Self-hosted vector DB (custom pipeline using Faiss + metadata store PostgreSQL) running on Ubuntu 20.04; nightly incremental index job processes document diffs: insert new docs, update changed docs, delete removed docs. Embeddings generated by hosted model (API). RAG pipeline queries vector DB and fetches document text by stored pointer (doc_id) from metadata store.
Symptoms
After incremental job completes, search results sometimes return passages from documents that were deleted earlier in the day. Running similarity queries returns high-similarity scores pointing to vector IDs that no longer exist in the metadata table. Reindexing full dataset fixes the problem until next incremental run.
Observations
Indexer logs show 'upsert vector id X' followed by 'delete doc id X' during the same job for some documents (order depends on file processing). The vector index contains duplicate vector IDs according to internal mapping (two vectors map to same external doc_id), and metadata table shows doc_id marked deleted. Audit logs show the incremental job retries on transient embedding generation failures and then re-applies operations. There is a separate compact/merge job running weekly. No errors reported by Faiss during upserts/deletes.
Already attempted
Inspected incremental job code: it performs 'embed -> upsert vector -> update metadata -> if delete mark metadata deleted -> remove vector' but ordering is subject to retry/backoff. Added additional logging and ran indexer in dry-run — saw race where delete task runs before previous upsert completed due to asynchronous worker pool. Manually removed duplicate vectors by scanning for vector_id collisions and deleting stale vectors — temporarily resolved. Full reindex clears all duplicates.
Question
What are the likely root causes for duplicate/stale vectors after incremental updates and what robust, reversible safeguards should I implement in the pipeline to avoid RAG returning deleted passages without requiring full reindex every time?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Artificial Intelligence55% match
Elasticsearch incremental index update creates duplicate vector IDs and stale pointers causing RAG to cite deleted passages
Open0 answers - Artificial Intelligence47% match
Incremental vector index job leaves stale vectors and duplicate document IDs — RAG answers cite deleted passages
Open0 answers - Artificial Intelligence45% match
Dense vector index returns stale document IDs and wrong passages after incremental update job — RAG answers become semantically irrelevant
Open0 answers - Artificial Intelligence43% match
Vector search returns semantically unrelated high-similarity passages after incremental index update
Open0 answers - Artificial Intelligence41% match
Semantic search returns high-similarity but irrelevant results after nightly vector DB compaction and shard rebalancing
Open0 answers