RAG interview question · Most asked
How do you enforce permissions and tenant isolation in RAG?
Summary
Filter by tenant and access rights inside the search query (metadata filters or SQL WHERE clauses), not after retrieving top-k, and back it with isolation below the application (per-tenant indexes or namespaces, or row-level security) so a missing filter fails closed. Sync access lists at indexing time and test cross-tenant isolation automatically.
Longer Answer
Post-filtering both leaks data when a code path forgets the filter and returns nothing for small tenants whose documents never reach the top k. Check recall of filtered queries with approximate indexes.
Key Points
- Filter inside the query.
- Isolation below the app.
- Sync document permissions.
- Automated cross-tenant tests.
Deep dive: Filters, Permissions and Tenant Isolation
More most-asked RAG questions
- RAG leaf: Explain query rewriting and multi-query retrieval.
- Why use hybrid search in RAG, and how do you combine the results?
- How do you make RAG answers grounded and verifiable?
- How do you evaluate a RAG system?
- RAG leaf: How do you measure retrieval quality independently of generation?
- RAG leaf: How do you prevent prompt injection via retrieved documents?
- How do you choose a chunking strategy for RAG?
- RAG leaf: How do you evaluate faithfulness of answers?