r/Rag • u/kishorek006 • 4d ago
Tools & Resources I built an open-source tool that checks whether your RAG index still matches your source files
Hi all. I kept running into a quiet RAG failure: every ingestion job reports SUCCESS, but the vector index slowly drifts away from the source documents. The app still answers, just from the wrong content.
The cases I kept seeing:
- a document was updated, but the old chunks were never deleted, so both versions answer
- a file was deleted, but its vectors are still searchable
- a job "succeeded" but only wrote half the chunks
- a file was never embedded at all
- retries left duplicate chunks
So I built RAGGuard. It reads your source files in S3 and your vector index (Qdrant or pgvector), plus your pipeline's own records if you keep them, and compares them document by document using the content hash/version stored in each vector's payload. Every finding comes with its evidence: which points, which hashes.
A few design choices:
- Read-only. It never writes to or deletes from your systems. Fixes go to your own ingestion worker as a repair plan, and RAGGuard re-checks afterwards.
- Old vectors are only removed after the new version is verified, and by default only after a person approves.
- It doesn't grade LLM answers (Ragas, DeepEval etc. do that). It checks the index underneath them.
Limits today: S3 is the only source, and Qdrant and pgvector are the only vector stores.
If you'd rather check your own index without any tool, I wrote up eight of these drift cases, each with a SQL query you can run yourself:
https://github.com/kishore600/rag-integrity-platform/tree/main/docs/guides
Hosted (free during beta): https://rag-integrity-platform.vercel.app
Code (MIT): https://github.com/kishore600/rag-integrity-platform
CLI: pip install ragguard-cli
I'd really like feedback, especially from anyone who's hit this in production. How do you catch index drift today?
1
u/Weak_Particular_5799 3d ago
the pgvector probe filters on the tenant and orders by distance, and with an HNSW index that WHERE runs after the index scan. on a 200k row table I measured 9 of 10 searches for a one-row tenant coming back empty, so a deleted doc in a small tenant can show reachable: false when it isn't. SET LOCAL hnsw.iterative_scan = strict_order in the probe fixes it on 0.8+
1
u/Deynekin 3d ago
The reconciliation approach is right, and one shift makes it cheaper than running a diff after every ingest: store the source hash at write time and check it at query time, so drift stops answering instead of waiting to be found.
Three cases from your list map to that:
The drift detector becomes a repair plan generator, and the index refuses to answer from stale content in the first place.
1
u/Reasonable_Teach4344 3d ago
Useful distinction between “the ingestion job succeeded” and “the index matches the source.” Stale chunks are easy to overlook when the app still returns plausible answers. I like the read-only approach and the evidence attached to each finding.