Your retriever and vector store
Retained per your own indexing and storage policy — entirely outside Privian's visibility or control.
Solution
Secure RAG architecture for teams shipping retrieval-augmented generation.
In most RAG incidents, the user typed nothing sensitive. The retrieved documents did the damage — pasted into the prompt, in full, by a retriever that was never asked to evaluate sensitivity. Mask the assembled prompt at the generation hop, after retrieval, without touching your retriever.
How do you keep personal data out of RAG prompts?
Retrieved chunks are assembled into the prompt unreviewed, so the practical control is at the generation hop: scan the fully assembled prompt — question plus retrieved context — for supported identifiers, mask them with deterministic placeholders before the call to the model provider, and restore the originals in the response. This is complementary to, not a replacement for, access control and redaction earlier in the pipeline.
Summary
RAG prompts carry identifiers from documents nobody reviewed at query time — the user's question is usually clean, but the retrieved context is not, and it is assembled into the prompt at volume on every request.
Mask the assembled prompt — question plus retrieved chunks — at the generation hop, after retrieval has finished, then rehydrate the response so the application still sees real values.
When your RAG pipeline retrieves from a document set that was never classified for sensitivity, when embedding or generation providers receive full chunk content, or when a security review asks what a retrieved document exposes downstream.
Masking is best-effort over a supported entity set, applies only at the generation call, and does not evaluate whether a document should have been retrieved, embedded, or indexed in the first place.
Problem
A RAG pipeline has more hops than a simple chat completion, and each one has a distinct privacy exposure. The user's question is rarely the risk — it is short, and typed with intent. Everything after retrieval is content nobody in the request path chose to disclose.
Framework
Ingest
Documents enter the index as-is. Whatever sensitivity they contain enters with them, usually without per-document review.
Chunk
Splitting documents into passages does not remove identifiers — it just distributes them across more retrievable units.
Embed
Chunks are typically sent in full, unmasked, to a hosted embedding provider before a vector is ever stored.
Vector store
Stored vectors and their associated text sit at rest with whatever access control the store enforces — or doesn't.
Retrieve
A query pulls the top-k chunks by similarity, not by sensitivity. Relevance ranking has no concept of PII.
Assemble prompt
Retrieved chunks are concatenated into the prompt verbatim. This is where identifiers from documents, not from the user, enter the request.
Generate
The assembled prompt — question plus context — is sent to the model provider as one request.
Response
The model's answer may echo back identifiers it was given in context, extending exposure into the output.
Logs
Prompt logging, tracing and analytics frequently persist the full assembled prompt, including retrieved content, long after the request completes.
Three of these deserve particular attention because they are easy to miss: embedding-time exposure to a hosted provider, over-retrieval that pulls more of a document than the query needed, and stale or over-permissive index entries that keep surfacing content that should have been removed or restricted.
Access control at the retrieval layer answers "who may see this document." It does not answer "what leaves our boundary when this document is pasted into a prompt."
Common confusion
Teams often reach for one of these and assume it covers the other two. Each answers a different question and fails differently when asked to cover for the others.
Framework
Retrieval access control
Governs who may retrieve a document at all. Right tool when the concern is authorization — e.g. a customer's data should never surface in another customer's retrieval results. Does nothing about what a document's content exposes once it is legitimately retrieved.
Document-level redaction at ingest
Removes or masks identifiers before a document enters the index. Right tool when you control the ingest pipeline and can afford to re-run it as documents change. Does not help with documents indexed before redaction existed, or with content added outside that pipeline.
Egress masking at generation
Masks the assembled prompt — including retrieved content — immediately before the provider call, regardless of what the index contains or how it got there. Right tool as a backstop that applies uniformly across every retriever and every document, including ones nobody redacted.
These are complementary, not competing. A defensible RAG pipeline typically uses access control to gate retrieval, redaction to reduce what enters the index, and egress masking as the control that catches whatever the first two missed.
Scope
Privian sits at exactly one hop: the call from your application to the LLM provider, after your retriever has already run. It does not index, embed, chunk or retrieve anything, and it has no visibility into your vector store, your ranking logic or your document permissions.
This division of responsibility is deliberate: a gateway that also tried to govern ingest and retrieval would need to understand your document permissions, your chunking strategy and your embedding provider — none of which it can safely infer from a single API request.
Provenance
Example
The identifiers below did not come from the user's question — they came from the retrieved chunk the application assembled into the prompt for context.
Assembled prompt sent to Privian
Question: What's the status of this
customer's onboarding?
Retrieved context:
"...call notes from Priya Nair
(priya.nair@acmecorp.com,
+1-415-555-0199) regarding
account ACC-88213, escalated
after a failed payment on card
ending 4242..."Privian sends to the provider
Question: What's the status of this
customer's onboarding?
Retrieved context:
"...call notes from PERSON_1
(EMAIL_1,
PHONE_1) regarding
account ACC-88213, escalated
after a failed payment on card
ending CREDIT_CARD_1..."The question was clean to begin with. Masking still ran on it — the whole assembled prompt is scanned every time — but the identifiers it caught all came from the retrieved passage.
Mechanics
The placeholder mapping for a request — including any identifiers pulled from retrieved chunks — is held in memory only for the life of that request. It is applied in reverse to the provider's response and then discarded; unknown placeholders in a response pass through untouched. See rehydration for the mechanics.
Retained per your own indexing and storage policy — entirely outside Privian's visibility or control.
If retrieved context or assembled prompts are logged upstream of Privian, that retention is governed by your logging configuration, not by the gateway.
Does not persist raw prompts or responses, including the retrieved context portion. Only structural counters are retained for billing and observability.
Governed by the provider's own terms and your configuration for that account — check the provider's current documentation.
Architecture
Retriever — Your vector store returns the top-k chunks for the query, using your existing ranking logic — unchanged.
Application assembles prompt — Your code concatenates the question and retrieved chunks into the final prompt, exactly as it does today.
Privian masks — The assembled prompt is scanned for the supported entity set and detected values are replaced with deterministic placeholders.
Provider — The masked request is forwarded to the model provider using your own encrypted credentials.
Rehydrate — Placeholders in the response are replaced with original values from the in-memory mapping, which is then discarded.
Application — Your code receives an ordinary provider-shaped response with real values — no retriever or prompt-assembly changes required.
Checklist
Framework
Who can retrieve which documents?
Access control at the retrieval layer, verified per index and per user role — not assumed from application-level auth.
What was reviewed for sensitivity before ingest?
If nothing was, assume retrieved chunks may contain identifiers and plan for a control downstream of retrieval.
What does your embedding provider receive?
Chunk content is usually sent to it in full and unmasked — evaluate that hop separately from generation.
What leaves the boundary at generation?
The assembled prompt, including retrieved context — this is the hop egress masking addresses.
Can a retrieved document surface identifiers unrelated to the query?
Over-retrieval can pull more of a document than the question needed, exposing content the query never asked about.
How stale is the index?
Documents removed or reclassified upstream may still be retrievable if the index wasn't updated with them.
What do prompt logs and traces retain?
Full assembled prompts, including retrieved content, are a common and often-overlooked retention point.
Can the response echo identifiers back to the user?
A model can restate context it was given — worth checking who receives the final answer.
Fit
Scope
FAQ
Enterprise review
Trust assets procurement and security teams routinely request.
Plans & pricing
BYOK, zero retention and masking of the assembled prompt before the provider call. Beta plans may change as the product matures.