Retrieval-augmented generation adds three core data planes to a chat application: the source documents, the embedding index and the retrieved context sent to the model. Privacy depends on where each plane lives and who can query it.
Most private RAG projects focus on the model. The leaks usually happen elsewhere: an embedding API outside the boundary, a shared vector collection, a log that stores full chunks, or an access filter applied after retrieval. This guide covers the architecture decisions that decide whether the system is actually private.
| Pattern | Components | Isolation | Ops burden | Best for |
|---|---|---|---|---|
| Postgres and pgvector | Postgres with HNSW or IVFFlat index | Row-level and schema controls | Low to medium | Teams already on Postgres |
| Self-hosted Qdrant | Qdrant with payload or shard tenancy | Collection, shard or payload filter | Medium | Many tenants and large indexes |
| Managed search with private endpoint | Azure AI Search or similar | Private network plus index controls | Low | Azure-standardised enterprises |
| Air-gapped bundle | Local models, local embeddings, local index | No egress | Very high | Classified or defence workloads |
What makes RAG private
A private RAG system keeps four things inside an approved boundary: the source documents, the embeddings and index, the prompts and retrieved context, and the logs and evaluation data. The model is only one part of the path.
The boundary can be a VPC, an on-premises network or an air-gapped environment. What matters is that every component in the path honours it. A local vector database queried through a managed embedding API is not a private pipeline.
The OWASP Top 10 for LLM applications names sensitive information disclosure and vector and embedding weaknesses as distinct risks. That framing is useful: the vector store is not a neutral index, and the embedding is not anonymised data.
- Documents and chunks.
- Embeddings and the vector index.
- Prompts and retrieved context.
- Logs, traces and evaluation sets.
Where the leaks happen
The first leak is the embedding call. Teams often keep the generation model local but send every chunk to a hosted embedding API. The embedding provider sees the full text, which defeats the boundary.
The second leak is the vector store. A managed service may replicate the index across regions, and a shared collection may expose one tenant's chunks to another through a missing filter. Qdrant's documentation notes that a separate collection per tenant is rarely the most efficient approach and recommends payload-based isolation or dedicated shards, with collection limits on managed clusters.
The third leak is logging. A retrieval trace often contains the query, the top-k chunks and the final prompt. That is a copy of the sensitive data in a system the security team may not have reviewed.
The fourth leak is evaluation. Golden sets, human review notes and failed-answer examples are often stored in a shared spreadsheet or a third-party tool outside the boundary.
Tenant isolation is not a metadata filter you add later
Filtering by tenant after the vector search is a correctness bug and a security bug. The search has already scored another tenant's chunks; a permissive filter or a missing index can return them. The filter must be part of the query plan, backed by an index.
Qdrant supports a tenant field with an is_tenant flag, or dedicated shards for larger tenants. Postgres can use row-level security with a tenant column, though the vector index still needs care. The right choice depends on tenant count, size and isolation requirements.
For the strongest isolation, use a separate database or cluster per tenant. That is expensive at scale, but it is the right answer for a small number of high-value tenants or for regulated data with a contractual separation requirement.
- Filter before search, not after.
- Index the tenant field.
- Test with a user who should see nothing.
- Separate clusters for the highest-risk tenants.
Access control at retrieval time
Document-level permissions change. A user who could read a file last month may have lost access today. The retrieval layer must use the current permission set, not a copy embedded in the document metadata at ingest time.
The practical pattern is to resolve the user's groups at query time, translate them into a filter, and apply that filter to the vector search. Cache the group lookup briefly, but invalidate on membership change. A stale ACL cache is a quiet data leak.
The same logic applies to citations. A citation that points to a document the user cannot open is a usability failure and a signal that the filter was applied to the answer but not the retrieval.
Embeddings, models and reindexing
The embedding model used at ingest must match the model used at query time, including its version and dimension. A silent upgrade can make the index incompatible or degrade recall. Pin the model and record the version with the index.
Changing the embedding model means reindexing the corpus. That is a scheduled project, not a configuration toggle. Estimate the cost and the downtime before choosing a model that may be deprecated.
pgvector supports HNSW and IVFFlat indexes, and its documentation notes that approximate indexes trade recall for speed and can return different results after creation. That is normal. The team should measure recall on a golden set rather than assume exactness.
Evaluation and operations
A private RAG system needs an evaluation set that reflects the real corpus: questions with known answers, questions with no answer, and questions the user is not allowed to ask. Measure retrieval recall, answer faithfulness and refusal behaviour separately.
Operate the index like a database. Track document counts, reindex lag, failed ingests, embedding version and query latency. A retrieval system that silently stops ingesting new documents looks healthy until a user asks about last week.
Plan for deletion. When a document is removed from the source, its chunks and embeddings must be removed too, including from backups and caches. A deletion runbook is part of the privacy design.
When a competitor wins
A managed search service wins when the buyer is standardised on its cloud and needs private networking, encryption and identity integration without operating a database. Microsoft's Azure AI Search documentation, now presented as Foundry IQ, describes TLS 1.2 or 1.3 in transit, AES-256 at rest, optional customer-managed keys and a region within a geography, with replication possible inside that geography.
Postgres and pgvector win when the team already runs Postgres, the corpus is modest and operational simplicity matters more than peak vector performance. Qdrant wins when tenant count and index size make a dedicated vector database worthwhile.
A private model endpoint completes the stack. Plugsky offers 39 public model IDs behind an OpenAI-compatible API, flat plans at $20, $60 and $120, per-key access, RBAC, SSO, audit export and BYOK, with private VPC, on-premises and air-gapped deployment by contract. It is a model API, not a vector database, so the retrieval layer remains the buyer's choice.
Verdict
Design the data planes before choosing a model. Keep documents, embeddings, prompts, logs and evaluation data in the same approved boundary, and prove tenant isolation with a negative test rather than a policy document.
Choose pgvector for simplicity, Qdrant for multi-tenant scale, and a managed search service when the cloud contract and private networking are already in place. Pair the index with a model endpoint whose residency and key model you have reviewed. The decision rule: if the embedding call leaves the boundary, the rest of the architecture does not matter.
Frequently asked questions
What is private RAG?
Retrieval-augmented generation where the documents, embeddings, index, prompts and logs stay inside an approved boundary, rather than being sent to public services.
Can I use a public embedding API in a private RAG system?
Only if the boundary allows it. A hosted embedding API sees the full chunk text, which may defeat the privacy design even when the generation model is local.
Is a metadata filter enough for tenant isolation?
No. The filter must be part of the indexed query path and tested with a user who should see nothing. High-risk tenants may need separate collections or clusters.
Which vector database should I use?
pgvector for teams already on Postgres, Qdrant for large multi-tenant indexes, and a managed search service when private networking and cloud identity are the priority.
How do I keep RAG access control current?
Resolve the user's groups at query time and apply the filter before the vector search. Invalidate the cache when membership changes.
Related
Sources
- pgvector repository · 23 Nov 2026
- Qdrant multitenancy documentation · 23 Nov 2026
- Azure AI Search security overview · 23 Nov 2026
- PostgreSQL row security policies · 23 Nov 2026
- OWASP Top 10 for LLM applications · 23 Nov 2026