keepcalculator

06 Numbers and Powers

RAG for Private Data: Ground AI in Company Documents

Card No. 06·58909 · Updated · Standard formula, shown below

Retrieval-augmented generation (RAG) grounds an AI assistant in selected company documents by retrieving relevant passages at question time and supplying them to a language model as context. To use private data safely, combine that retrieval pipeline with document permissions, careful data handling, source citations, and tests that check whether answers are supported.

What RAG means for company documents

A general-purpose language model generates responses from patterns learned during training and the context provided in a conversation. It does not automatically know a company’s current policies, contracts, product manuals, or internal procedures. RAG adds a searchable information layer: the system looks up material relevant to a user’s question and asks the model to answer using that material.

“Private” describes the data and access requirements, not a special kind of RAG. A company might index employee handbooks, support guides, or engineering documentation, while excluding payroll records and customer files. The design must respect the sensitivity of each source and the permissions of the people asking questions.

RAG is not the same as training a model on company documents. In a typical RAG setup, documents are processed into a separate index, and selected passages are retrieved for individual queries. The index and prompts still contain sensitive information, so this approach reduces some risks but does not remove the need for security controls.

How the retrieval process works

A basic pipeline has two parts: preparing the document collection and answering a question. During preparation, a system extracts text from approved files, divides it into smaller sections, and creates a searchable representation for each section. Many systems use embeddings—numeric representations of text—to find passages with related meaning; others combine semantic search with keyword search.

  1. Ingest approved sources. Connect only repositories the project is authorized to use. Record source, owner, access rules, and update information.
  2. Prepare and divide content. Extract text and useful metadata, then split long documents into passages. Keep headings or nearby context where possible so a passage remains understandable.
  3. Index the passages. Store searchable representations and metadata in an index, such as a vector database or search service.
  4. Retrieve for each question. Search for relevant passages, apply access controls, and select a limited set of results.
  5. Generate and check an answer. Provide the passages and instructions to the model. Return citations or links so users can inspect the underlying material.

For example, if an employee asks how to request a replacement laptop, the system might retrieve the current equipment policy and the relevant support procedure. The answer should point to those sources, rather than relying on a similar but outdated document.

Designing access for private data

The key security principle is that retrieval must not give a user access to material they could not otherwise read. Apply permissions during search, not just in the application interface after results have been retrieved. If a document is restricted to a team, its passages should remain restricted in the index too.

  • Use least privilege. Limit access for users, service accounts, and the application to what each needs.
  • Preserve source permissions. Map repository groups and document-level rules into retrieval checks, and decide how quickly permission changes reach the index.
  • Minimize data. Exclude unnecessary sensitive fields and repositories. Avoid indexing secrets, personal information, or regulated records unless there is a clear, approved use and suitable controls.
  • Protect the whole path. Review security for source systems, extracted files, indexes, logs, prompts, model endpoints, backups, and administrative tools.
  • Set retention and deletion rules. Decide how updates, deletions, and expired documents are reflected in indexes and backups.

Check how the chosen model and infrastructure handle submitted prompts and retrieved text, including retention, access by service operators, and whether data may be used to improve services. These terms vary by provider and configuration; do not assume that using a private cloud or a RAG architecture alone guarantees confidentiality.

Choosing documents and improving answer quality

RAG quality depends heavily on the source material. Duplicate policies, scanned PDFs with poor text extraction, missing headings, and conflicting versions can all produce poor retrieval. Start with a small, high-value collection of maintained documents rather than indexing every file the company owns.

Use metadata that helps filter results, such as document title, department, effective date, content type, and access group. Keep the original source available, and make it possible to distinguish a current policy from an archived one. For tables, diagrams, and forms, check that extraction preserves relationships; plain text alone may lose essential meaning.

Chunk size and retrieval settings involve trade-offs. Very small passages may omit context; very large ones can bury the useful detail and consume more of the model’s context. Test realistic questions, including questions whose answers appear in several documents, and inspect whether the retrieved passages actually support the response.

Tell the model to answer from retrieved evidence, cite sources, and say when the available documents do not answer the question. This can reduce unsupported claims, but it cannot guarantee that the model will always obey. Users should be able to open citations and verify important answers themselves.

Common problems and limits

RAG can return a confident but incorrect answer when retrieval misses the right document, finds an obsolete version, or supplies ambiguous evidence. A model may also combine details from separate passages incorrectly. Retrieval scores are not proof that an answer is true.

  • Stale content: Set an update process and test whether edits and deletions propagate promptly.
  • Permission leaks: Test with accounts from different roles, including users who should receive no matching results.
  • Prompt injection in documents: Treat retrieved text as untrusted content. A document can contain instructions that should not override system rules or access controls.
  • Weak citations: Check that each citation points to the passage supporting the associated claim, not merely to a related file.
  • Unclear failure behavior: Decide whether the assistant should ask a follow-up question, report no evidence, or route the request to a person.

RAG also does not make a language model a reliable calculator, policy authority, or substitute for expert review. For consequential decisions, define who must review the answer and which systems remain the official source of truth.

How to evaluate a RAG system

Before broad deployment, create a test set based on real tasks, with expected sources and acceptable answers. Include straightforward questions, ambiguous requests, questions with no answer in the corpus, outdated-document traps, and access-control cases. Ask people who understand the documents to judge both retrieval and final responses.

Track whether the correct source appears near the top of results, whether answers are supported by citations, and whether the system appropriately declines unsupported questions. Also test operational behavior: document updates, revoked permissions, logging, deletion, and recovery. Re-run these checks when changing chunking, retrieval, prompts, models, or source repositories.

Start with a limited pilot and a clear owner for content quality and access rules. Monitor user feedback and recurring failure types, but avoid putting unnecessary sensitive text into logs or evaluation datasets. A successful pilot demonstrates not only useful answers but also predictable boundaries.

Frequently Asked Questions

Does RAG train an AI model on company documents?
Usually not. In a typical RAG system, documents are indexed separately and relevant passages are provided as context when a question is asked. Confirm the handling of prompts and data with the systems and service providers you use.

Is RAG safe for confidential company information?
It can be designed for confidential use, but RAG itself is not a security guarantee. Safety depends on permissions, data minimization, encryption and operational controls, provider terms, monitoring, and testing for leaks.

Can RAG enforce existing document permissions?
Yes, if the system correctly carries source permissions into retrieval and checks them for each user. Test this directly; filtering results only after the model has already received restricted text is not sufficient.

Why does a RAG assistant give wrong answers?
It may retrieve the wrong passage, use stale or conflicting documents, lose context during extraction, or misinterpret the evidence. Evaluate retrieval and generation separately, and make citations easy to verify.

Should every company document be indexed?
No. Begin with approved, useful, well-maintained material. Exclude irrelevant or especially sensitive content unless a defined need, permission model, and appropriate safeguards justify its inclusion.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →