LLM & RAG

GDPR-compliant RAG: permissions, hosting and deletion

To use RAG with personal data under GDPR, define a lawful purpose, filter retrieval by permissions, limit model inputs and make every stored copy traceable.

Artem SynytskyiArtem Synytskyi Co-founder · AIPublished · Updated · 6 min read

Key takeaways

  • Redact PII before indexing, and again before each model call.
  • Run embeddings and inference in the EU, or self-host an open-weights model.
  • Enforce document-level permissions at retrieval time, not in the prompt.
  • Keep only the audit events you need, redact unnecessary personal details and define log access and retention.

Why RAG creates GDPR risk

A RAG system retrieves passages from your documents and sends them to a language model. If those passages contain personal data, GDPR applies to ingestion, embeddings, retrieval, model calls and logs. Set a lawful purpose and legal basis, enforce document permissions before retrieval, and define retention and deletion across the whole system.

Settle the legal basics first

  • Roles: you are normally the controller, and each vendor that touches the data (embedding service, vector database host, model host) is a processor that needs an Article 28 agreement.
  • Lawful basis: write down the purpose of the assistant and the legal basis for each kind of data it can reach.
  • Impact assessment: where the processing is likely to be high-risk, for example health or HR documents, carry out a DPIA under Article 35 before launch.
  • Transparency: tell staff or customers that an AI assistant works on this data, under Articles 13 and 14.
  • Models: ask each vendor whether your data is used for training, and get the answer in the contract.

Reference architecture

  1. Ingestion: detect and mask PII, keep a reversible mapping only where strictly needed, and record the source, owner and date of every document.
  2. Index: an EU-hosted vector store with per-document access labels, and a stored link from every chunk back to its document so that it can be deleted.
  3. Retrieval: filter by the user's permissions before ranking, so a chunk the user may not see is never a candidate.
  4. Generation: an EU-region or self-hosted model with no training on your data, a second redaction pass on the prompt and an instruction to answer only from the retrieved passages.
  5. Audit: an append-only log of query, sources and answer, with redacted values and a defined retention period.

Choosing where the model runs

OptionData residencyEffort
Vetted provider, EU regionEU, under DPALow
Open-weights model, EU cloudEU, your accountMedium
Open-weights model, on-premYour serversHigher

An EU region settles where the servers are, not which country's law can reach the operator, so for the most sensitive documents we lean towards EU-based providers or your own servers. Our guide to EU-hosted AI platforms walks through the options and the questions to ask.

Which platforms are recommended for RAG with on-prem data residency and GDPR compliance?

There is no single recommended platform, because on-prem RAG is a stack of layers and each one has good open-source and EU-based options. What matters is that every layer runs on infrastructure you control, so nothing leaves it. A typical self-hosted set-up looks like this.

LayerOptions that can run on your serversWhat to check
Vector storeQdrant (Apache 2.0), Postgres with the pgvector extension, Weaviate or MilvusPer-document access filters, backups and encryption at rest. Pgvector keeps vectors beside your other data, while some stores have more components to operate
Model servingvLLM (Apache 2.0) for production traffic, Ollama or llama.cpp for small deployments and testingGPU capacity, how many requests run at once, and an OpenAI-compatible API so you can swap models
OrchestrationHaystack, LlamaIndex or your own codeHow easily you can inspect each step and test retrieval separately from generation
ModelsOpen-weight language and embedding models that you host yourselfLicence terms for commercial use, language coverage and accuracy on your own documents
AccessYour existing single sign-on with role-based accessPermissions applied at retrieval, not in the prompt
GovernanceRedaction, audit log, retention and deletionThe architecture above, tested end to end

What happens when someone asks you to delete their data?

When Article 17 requires erasure, trace the data through source documents, chunks, embeddings, caches and logs. Delete or restrict copies according to the applicable obligation, and handle backups under your documented restoration and expiry process. Record what changed and check that retrieval no longer exposes the data.

Treat embeddings as personal data when they are made from personal data. Text can sometimes be inferred from vectors, so a vector database is not an anonymisation step.

Security risks specific to RAG

RiskHow it shows upControl
Prompt injectionA document contains hidden instructions that the model followsTreat retrieved text as data, limit what the model can do, filter outputs
Sensitive information disclosureThe answer reveals data the user should not seePermission filter at retrieval, redaction, output checks
Vector and embedding weaknessesPoorly isolated indexes mix tenants or leak contentSeparate indexes or strict filters per tenant, access control on the vector store
MisinformationA confident answer not supported by the passagesCitations, an answer-only-from-sources instruction and a fallback when retrieval is weak

Checklist before go-live

  1. Processor agreements signed with every vendor in the chain, including sub-processors.
  2. DPIA completed where required, with the redaction and hosting choices recorded.
  3. Permission filtering tested with accounts that must not see certain documents.
  4. Erasure tested end to end on a dummy document.
  5. Log retention set, and logs redacted.
  6. A set of real questions with expected sources, used to test retrieval and answers.

Tell us which documents your assistant needs and who should access them. We can scope a RAG pipeline with permissions, redaction and traceable deletion.

Scope your RAG system

FAQ

Can I use a US-based model provider?

Assess the provider’s actual processing locations, contracts and access arrangements. Transfers outside the EEA need a valid Chapter V basis and the relevant safeguards. An EU region is a deployment choice, not a complete GDPR assessment.

Are embeddings personal data?

They should be treated as personal data when they are derived from personal data, because content can sometimes be inferred from them. Protect them and delete them with the source document.

Do we need a DPIA for an internal knowledge assistant?

If it reaches health, HR or other sensitive documents, or processes personal data at scale, you probably do. For a harmless public knowledge base, a short written screening note is usually enough.

Sources

  1. Regulation (EU) 2016/679 (GDPR), Articles 5, 17, 25, 28, 32 and 35
  2. EDPB guidance on data protection by design and by default
  3. European Data Protection Board, Opinion 28/2024 on AI models
  4. OWASP Top 10 for LLM Applications
  5. Qdrant, open-source vector database (Apache 2.0)
  6. vLLM, open-source LLM inference and serving library (Apache 2.0)
Artem Synytskyi

About the author

Artem Synytskyi · Co-founder · AI

Artem runs AI at ESADEX, building LLM, RAG and speech-to-text systems for regulated environments.

Build your compliant AI or software project

Tell us your workflow and compliance requirements. We reply within four business hours and usually prepare a scope and architecture document in about five days.