Safeguard
AI Security•

Training data, retrieval corpus or prompt: which carries which risk?

An LLM app takes in text through training data, a retrieval corpus and prompts. Each fails differently and needs a different control. A comparison table.

Safeguard Security Team
4 min read

An LLM application takes in text through three routes: training or fine tuning data, a retrieval corpus, and prompts. Training data risks are slow and hard to undo, retrieval risks arrive per question, and prompt risks come from templates and user text. Each needs different controls.

The three inputs

Training and fine tuning data shapes the model's weights. Once learned, it is baked in.

Retrieval corpus is the set of documents your application searches and pastes into the prompt at question time. The model's weights do not change.

Prompts are the instructions and templates your code builds for each call, including user text.

OWASP's data and model poisoning entry says poisoning can target pre-training, fine tuning and embedding data. That covers the first two routes and the vector side of the second.

Comparison

QuestionTraining or fine tuning dataRetrieval corpusPrompt
When does it take effectAfter trainingAt each questionAt each call
How fast can you fix a bad itemSlow, may need retrainingFast, remove the documentFast, change the text
Typical attackPoisoned or backdoored examplesPlanted document with instructionsInjected text in a slot
Visible in logsRarelyYes, if you log retrieved itemsYes, if you log the final prompt
Main controlProvenance, hashes, review before trainingSource vetting, access control, filteringSeparation of data and instructions, least privilege
RollbackPrevious model versionPrevious index snapshotPrevious template version

Why the difference matters

Teams often apply one control to all three. A prompt filter does nothing for a poisoned fine tuning set. A dataset hash does nothing for a malicious email pasted into a prompt at run time.

Match the control to the point of entry.

  1. Training data. Track origin and transformations, hash the files, vet suppliers and review samples before a run. OWASP notes that backdoors can leave behavior normal until a trigger appears, so testing alone is not enough.
  2. Retrieval corpus. Know who can add documents, restrict ingestion sources, and keep snapshots of the index so you can roll back. Log which documents reached each answer.
  3. Prompts. Version and review templates, mark where untrusted text enters, and limit what the model can do with it.

Where they overlap

The routes meet at the prompt. A retrieved document becomes part of a prompt, so a poisoned corpus is an indirect injection path. A fine tuned model can respond differently to the same prompt. When something goes wrong, you will want to know which input was involved, so log the model version, the index snapshot and the template version for each call.

A quick triage question

When the app misbehaves, ask three things in order. Did the prompt text change? Did the retrieved documents change? Did the model version change? The first two are quick to check and quick to fix. The third may be where a longer investigation starts.

For the retrieval side in more depth, see does RAG stop prompt injection, myth versus fact.

Quick check

Which input is easiest to roll back?

Prompts and retrieval documents, if you keep versions and snapshots. Training data effects usually need a different model version.

Should all three be in my AI inventory?

Yes. Record the model, its datasets, the corpus sources and the prompt templates, with owners.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.