RAG
Multi-tenant indexes
One index per tenant, a shared index with tenant filters, or something in between.
What it is and why it exists
SaaS RAG must isolate tenants. Options: separate index/namespace per tenant (strong isolation, more overhead), shared index with a mandatory tenant filter (cheap, one bug away from a leak), or tiered (big tenants isolated, small ones shared).
Quick prototype
One index for everyone.
In production, at scale
Tenant ID injected from the authenticated session server-side (never from the prompt), namespaces or partitions per tenant where the store supports them, per-tenant quotas, tenant-scoped caches, and an isolation test in CI.
Vendors and tools
| Pinecone namespaces | Per-tenant partitions |
|---|---|
| Qdrant / Weaviate multi-tenancy | Tenant-aware collections |
| pgvector + row-level security | Tenant filters enforced by Postgres |
On AWS: OpenSearch per-tenant indexes or document-level security; Bedrock Knowledge Bases metadata filters per tenant.
How it fails
- Tenant filter taken from the request body
- Shared semantic cache returning tenant A’s answer to tenant B
What the interviewer asks next
Where do cross-tenant leaks usually come from?
Not the vector DB but the glue: a filter missing on one code path, a shared cache keyed only by question, logs and traces visible across tenants.