Security checklist for preventing LLM data leakage

How to Prevent LLM Data Leakage: A Practical Security Checklist

LLM Data Leakage Prevention Checklist

  • Prevent LLM data leakage by securing both training and inference: minimize and sanitize training data; avoid sending sensitive information to unapproved services; use privacy-preserving training or private hosting where appropriate; configure provider retention and access controls; scan and redact inputs and outputs; enforce DLP, authentication, least privilege, monitoring, and incident-response controls.
  • Data minimization and sanitization before training or inference.
  • Prompt and response guardrails with DLP, secret detection, redaction, and blocking.
  • Provider governance: no-training or zero-retention terms where available, data residency, approved model versions, and contractual controls.
  • Private or isolated hosting when the risk and compliance requirements justify it.

Prevent LLM data leakage by securing both training and inference: minimize and sanitize data, govern providers, scan inputs and outputs, enforce access and monitoring, and prepare incident response.

These controls reduce risk rather than guarantee zero leakage. Protection must cover training data, prompts, retrieved context, APIs, outputs, logs, endpoints, integrations, and downstream applications.

LLM Data Leakage: Training-Time and Inference-Time Risks

Training-time leakage occurs when sensitive information enters training data and is later reflected in model behavior. Examples include PII, health or financial information, passwords, credentials, API keys, proprietary information, and confidential business content. For related examples, risks, and mitigations, see sensitive information disclosure in LLM applications.

Inference-time leakage occurs during normal operation. An employee may paste confidential information into a prompt, an application may retrieve data the user is not authorized to access, or a model may send sensitive content to a user, plugin, workflow, or downstream system.

Common leakage paths include:

  • Prompts: customer records, source code, contracts, credentials, or internal discussions.
  • Retrieved context: unauthorized documents, permission mismatches, poisoned content, or untrusted instructions in a RAG system.
  • Outputs: sensitive information returned to a user or passed to another application.
  • APIs and integrations: data sent to an unapproved provider or exposed through an insecure workflow.
  • Logs and storage: prompts, responses, queries, and retrieved documents retained beyond the immediate task.
  • Endpoints and tools: shadow AI, unmanaged devices, BYOD, and native desktop AI applications.

Leakage may be direct, such as unauthorized access to a file, or model-mediated, where sensitive information moves through a prompt, retrieval pipeline, response, or application workflow.


1. Secure Training Data Before It Reaches the Model

Before data enters a training dataset, classify it and determine whether the model needs it at all. Removing unnecessary sensitive content is safer than trying to control it after it has been incorporated into training material.

Minimize, curate, and sanitize the dataset

Use data discovery and classification to identify information that should not be used for training. Then minimize, curate, deduplicate, anonymize, mask, redact, or remove it before training begins.

  • Remove unnecessary PII and health information.
  • Mask or redact financial and other regulated information.
  • Exclude passwords, credentials, API keys, and other secrets.
  • Protect proprietary information, intellectual property, and confidential business content.
  • Keep only information with a documented training purpose.

Apply the same discipline to data prepared for retrieval. A document unsuitable for training may also be unsuitable for indexing and retrieval. Sanitization should happen before data reaches the training pipeline, vector or retrieval system, prompt, or output.

Use privacy-preserving training when appropriate

Differential privacy and federated learning can reduce training-data leakage risk. Select these options according to data sensitivity, the training objective, and governance requirements; neither is mandatory for every deployment.

2. Protect Inference, APIs, and Application Workflows

Clean training data does not eliminate operational exposure. Treat every prompt, retrieved document, API request, response, log, and connected application as a possible data boundary.

Use approved providers and deployments

Route organizational workloads through approved providers or private or isolated deployments when the risk and requirements justify them. Review provider terms and settings for:

  • retention and data-use practices;
  • hosting or data residency;
  • access controls and approved model versions; and
  • contractual controls, including no-training or zero-retention terms where available.

Private hosting and zero-retention terms reduce exposure but do not guarantee prevention. They cannot stop an employee from oversharing information, an authorized user from receiving excessive retrieved context, or a downstream system from storing a sensitive response.

Secure RAG and connected data

RAG, or retrieval-augmented generation, supplies an LLM with information retrieved from connected sources. The retrieval layer must enforce the user’s authorization rather than treating every indexed document as available to the model. For a structured way to test retrieval, authorization, and leakage risks, see red-teaming a RAG application.

  • Apply authorization before sensitive context is retrieved or inserted into a prompt.
  • Check retrieval provenance so the application can identify where context came from.
  • Monitor documents, queries, and outputs for each request.
  • Investigate permission mismatches that could expose one user’s or group’s information to another.

Connected repositories, plugins, APIs, and downstream systems need the same controls. A secure model does not make an insecure integration safe.

Defend against prompt injection and malicious retrieved content

Prompt injection occurs when instructions embedded in a user prompt, retrieved document, or other untrusted content manipulate the model into ignoring intended controls, revealing information, or taking an unsafe action. Treat external content as data, not as trusted instructions.

  • Separate system instructions, user input, and retrieved content.
  • Inspect prompts and retrieved material for malicious or poisoned instructions.
  • Keep retrieval authorization independent from the model’s instructions.
  • Validate outputs and tool actions before they reach users or connected systems.
  • Test representative injection and data-extraction scenarios.

Control retention and external exposure

Reduce unnecessary retention of prompts, responses, queries, and related logs. Stored data creates another location where sensitive information may be accessed, copied, or disclosed.

3. Scan Prompts and Outputs With AI-Aware DLP

AI-aware DLP inspects data moving through LLM workflows, not only conventional files or network transfers. It should cover semantic, application-level, model-mediated, and pipeline data flows.

Scan and filter inputs before submission

Scan prompts in real time before they reach the model. Detection should cover PII, health and financial data, passwords, credentials, API keys, proprietary information, and other regulated content.

Based on policy and business purpose, the control can:

  • Block a request when the content must not leave the organization.
  • Redact sensitive fields before submission.
  • Mask values while preserving enough context for an approved task.
  • Validate the request and route it through a safer approved workflow.

Validate and filter outputs

Inspect model responses before delivering them to users or downstream systems. Output controls can detect sensitive information and then block, redact, mask, or validate the response according to policy. For detailed validation and sanitization guidance, see securing LLM outputs before use.

This matters especially when a response feeds an automated workflow, support system, report, plugin, or another application. A useful response may still disclose confidential information or pass it into a system with broader retention or access.

Prompt-submission check

  1. Classify: Does the prompt contain PII, health or financial data, credentials, secrets, or confidential business information?
  2. Choose: Is the selected provider, model, and workflow approved for that data?
  3. Sanitize: Can the task work with minimized, masked, anonymized, or redacted values?
  4. Block or escalate: If the data cannot be safely transformed or submitted, stop and use an approved internal workflow.

4. Enforce Identity, Least Privilege, and Zero Trust

Use strong authentication and least privilege so users, models, applications, and integrations receive only the access needed for the task. Restrict access to repositories, models, plugins, APIs, endpoints, and connected applications independently.

Use role-based or context-aware authorization. Access decisions may consider the requester’s identity and role, the purpose of the request, timing and session context, the source device or application, and the applicable data and model policy. For a deeper guide to identity, authorization, and governance, see identity and access management for AI applications.

Zero-trust controls reinforce this approach by requiring access decisions at each relevant boundary. Identity-based masking can ensure that different users receive different views of the same underlying information.

5. Govern Shadow AI, Endpoints, and BYOD

Shadow AI means using unapproved AI tools or services outside organizational governance. Inventory sanctioned and unsanctioned tools, then restrict unapproved public LLMs, domains, applications, and integrations where appropriate. For a broader detection and governance framework, see shadow AI security.

  • Maintain an inventory of approved models, providers, applications, and integrations.
  • Set enforceable rules for public AI tools and sensitive business data.
  • Apply endpoint-level controls to managed devices.
  • Govern BYOD and unmanaged-device access to work data.
  • Use work-data isolation where personal devices are permitted.
  • Include native desktop AI applications, not only browser access.
  • Pair technical restrictions with acceptable-use rules and recurring employee education.

Prompt-hygiene guidance should tell employees what must not be submitted, how to redact or mask information for an approved task, and when to use a sanctioned internal workflow instead.

6. Monitor, Test, and Audit LLM Data Flows

Monitoring is a detection and assurance layer, not a substitute for prevention. Log and review enough information to understand how LLM data moves through the organization while avoiding unnecessary retention of sensitive prompts and responses. For a practical monitoring checklist, see AI security monitoring.

Useful audit context includes:

  • the request and requester identity;
  • the data accessed and policy context;
  • API calls, database queries, and retrieval activity;
  • retrieval provenance and connected documents;
  • the model output and downstream outcome; and
  • policy decisions, blocks, redactions, and other guardrail actions.

Test controls with representative leakage and prompt-injection scenarios. Check whether sensitive prompts are blocked, retrieved context follows authorization, malicious instructions are contained, and outputs are filtered before delivery. Investigate anomalies, then tune policies, retrieval controls, access decisions, and user guidance.

Maintain compliance and audit evidence

Document the purpose and permitted use of sensitive data, consent where applicable, data-minimization decisions, provider controls, access decisions, and incident handling. Maintain audit trails that support the organization’s relevant compliance obligations, and review them for compliance drift as models, providers, data sources, and workflows change.

7. Respond and Recover After a Leakage Signal

Prepare an incident-response and remediation process before an exposure occurs. When a leakage signal is detected:

  • restrict or change access;
  • redact exposed content where it is stored or displayed;
  • preserve and review relevant logs;
  • investigate prompts, retrieved documents, outputs, identities, and downstream recipients;
  • change retrieval or integration controls;
  • communicate with affected users or teams;
  • tune policies and provide targeted education; and
  • remove affected model or data components where applicable.

Follow containment with testing to confirm that the exposure path is closed. Review what failed, update the relevant controls, and repeat the test. The appropriate remediation depends on the affected workflow and deployment.

Practical Implementation Checklist

Leakage stageMain exposurePreventive controlsDetection or response controls
Training dataMemorized PII, health data, financial data, secrets, or confidential contentClassify, minimize, curate, deduplicate, mask, anonymize, redact, or remove dataReview datasets, investigate suspected memorization, and remove or remediate affected data where applicable
Prompts and APIsSensitive information sent to an unapproved serviceApproved tools, input scanning, DLP, redaction, blocking, authentication, and provider controlsLog requests, identities, policy decisions, and alerts; investigate suspicious submissions
RAG and connected dataUnauthorized or poisoned context enters a promptAuthorization-aware retrieval, provenance checks, permission controls, and query monitoringReview retrieval activity, mismatches, source documents, and affected outputs
Model outputsResponses disclose sensitive information to users or downstream systemsOutput scanning, validation, filtering, masking, and redactionAlert on leakage signals, contain distribution, and review downstream recipients
Logs and endpointsPrompts, responses, or work data remain in logs, devices, or shadow AI toolsReduce unnecessary retention, govern endpoints and BYOD, and restrict unapproved toolsAudit data flows, investigate access, change permissions, and test controls again

What These Controls Can and Cannot Guarantee

No single measure guarantees prevention. Private hosting, isolated deployment, zero-retention terms, AI-aware DLP, access controls, privacy-preserving training, and employee education each address different parts of the risk.

The practical goal is layered control: prevent unnecessary exposure, detect suspicious movement, and respond quickly when a control fails. Verify provider settings, RAG authorization, retrieval monitoring, endpoint governance, retention design, audit access, and incident procedures for the specific environment.