Skip to content
Gavan Infotech
  • Applied AI
  • Security

How to keep company data private in an enterprise RAG system

By Gavan Infotech · Published

To keep company data private in a retrieval-augmented generation (RAG) system, keep the documents and their index inside your own environment, enforce each user's access rights at retrieval time, and make sure nothing you send to a model is used for training.

What is retrieval-augmented generation?

Retrieval-augmented generation (RAG) is a way of letting a language model answer questions using your own documents. When a user asks a question, the system first retrieves the most relevant passages from an index of your content, then passes those passages to the model along with the question. The model writes an answer grounded in what was retrieved.

The model itself is not retrained on your documents. That is what makes a private setup possible.

Where can data leak in a RAG system?

There are four places to look:

  1. The index. Documents are converted into vectors and stored. If the vector store is a third-party service outside your control, a copy of your content now lives there.
  2. The model call. Retrieved passages are sent to a language model. Depending on the provider and the terms, that content could be retained or used for training.
  3. Retrieval without access control. If the system retrieves from everything for everyone, a user can be shown content they were never allowed to read.
  4. Logs. Prompts and answers often contain sensitive text and tend to end up in logs with weaker protection than the source systems.

How do you design a RAG system that stays private?

Keep the index in your own environment. Store vectors in a database you run, such as pgvector on PostgreSQL inside your own virtual private cloud (VPC). The index then sits under the same network controls, encryption and backups as your other data.

Enforce access control at retrieval. Carry each document's permissions into the index and filter results by the user's role before anything reaches the model. Role-based access control has to apply to search results, not only to the application screen.

Control the model boundary. Use a model deployment whose terms state that your inputs are not used for training, or run a private model. Send only the passages needed to answer the question.

Treat prompts and answers as sensitive data. Apply the same retention and access rules to logs as to the source documents.

Clean the data first. A RAG system exposes whatever it indexes. Consolidating and cleaning operational data before indexing avoids surfacing outdated or duplicated content.

What should you ask a vendor building a RAG system for you?

  • Where will the vector index be hosted, and who can access it?
  • How are document permissions enforced when results are retrieved?
  • Which model is used, and what do its terms say about retention and training?
  • What is logged, where, and for how long?
  • Who owns the pipelines, the index and the code?

How does Gavan Infotech approach it?

Gavan Infotech builds private enterprise RAG search on pgvector with role-based guardrails, indexing proprietary documents and operational databases in private vector stores inside the client's own VPC, with no training leakage to public models. The client owns the source code and infrastructure scripts from day one.

Talk to the engineers who would build it

Book a confidential 45-minute architecture call with our founder and lead architect. We respond within 24 business hours.

Request a proposal