Last updated: 01 December 2026
Data poisoning is an attack on a machine learning system that happens before the model ever reaches users. An attacker corrupts the data the model learns from, so the flaw is baked into the weights. It is one of the most underrated threats in adversarial machine learning because it is quiet, cheap to attempt and hard to spot afterwards.
This guide explains how data poisoning works, what recent research says about how little data an attacker may need, and which defenses are worth your time. The commands and snippets are illustrative and have not been tested here.
What is data poisoning in adversarial machine learning?
Adversarial machine learning studies how ML systems can be attacked and how to defend them. NIST’s report Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations (NIST AI 100-2 E2025, published March 2025) organizes attacks by life cycle stage, attacker goals, capabilities and knowledge. For predictive AI it names three main families: evasion, poisoning and privacy attacks. For generative AI it adds supply chain attacks and prompt injection.
Poisoning is the training-phase family. The attacker introduces corrupted data, or tampers with a model artifact, so the resulting model behaves wrongly. OWASP lists the same risk for LLM applications as LLM04:2025, Data and Model Poisoning, covering tampering with pre-training, fine-tuning and embedding data.
Why it is underrated
- Evasion gets the headlines. Adversarial images and jailbreaks are easy to demonstrate. Poisoning is slower and less visible.
- The damage is hidden. A backdoored model can score normally on standard tests and misbehave only when a trigger appears.
- Data is rarely vetted like code. Teams scrape the web, buy datasets and accept user feedback with far less review than they give a software dependency.
- Fixing it is expensive. Once poisoned data is in the weights, the usual remedy is retraining.
How data poisoning works

Availability attacks
The goal is to degrade overall accuracy or make the model unusable. Mislabeled or noisy samples are enough in simple cases.
Targeted attacks
The attacker wants specific inputs to be misclassified while everything else stays normal. This makes detection harder, because aggregate metrics barely move.
Backdoor attacks
The attacker plants a trigger, such as a pixel pattern, a rare token or a phrase, paired with a chosen behavior. The model works normally until the trigger shows up. OWASP describes this pattern as a model that behaves normally until a specific trigger activates the altered behavior.
Where the poison enters
- Web-scraped pre-training corpora that anyone can publish into.
- Third-party or crowdsourced labeling and purchased datasets.
- Fine-tuning sets and user feedback loops.
- Retrieval and embedding stores that feed a deployed application.
- Shared model files, where a tampered artifact can even run code on load.
What the research says: 250 documents
A study by Anthropic, the UK AI Security Institute and the Alan Turing Institute, published in October 2025, challenged a common assumption. Earlier thinking held that an attacker would need to control a percentage of the training data, which becomes impractical as datasets grow. The researchers found that the number of poisoned documents mattered more than their share.
- Models ranged from 600 million to 13 billion parameters.
- The backdoor made the model output gibberish when it saw a trigger. The trigger used in the experiments was
<SUDO>. - 100 poisoned documents did not robustly backdoor any model, but 250 or more succeeded reliably across sizes.
- For the 13B model, 250 documents were roughly 0.00016% of the training data, according to press coverage of the paper.
Important limits. The authors state the backdoor was narrow, producing gibberish, and is unlikely to pose significant risk in frontier models. It is not yet known whether the result carries over to more dangerous behaviors, such as bypassing safety guardrails, or to far larger models. Read it as a warning about attacker economics, not proof of an easy catastrophic attack.
Comparison of poisoning types
| Type | Attacker goal | Visibility | Typical defense |
|---|---|---|---|
| Availability | Lower overall accuracy | High, metrics drop | Data validation, outlier removal |
| Targeted | Misclassify chosen inputs | Low | Provenance, per-slice evaluation |
| Backdoor | Trigger-activated behavior | Very low | Trigger probing, red teaming, data audits |
| Model or artifact tampering | Compromise shared weights | Low | Signed artifacts, safe file formats |
Defenses that work in practice
1. Know your data’s provenance
Record where every dataset came from, who touched it and which version trained which model. OWASP suggests data version control tools such as DVC to detect tampering, and an ML bill of materials such as CycloneDX to track provenance.
2. Vet vendors and sources
Treat dataset suppliers and labeling vendors like software suppliers. Prefer sources with clear curation, and limit the weight of unverified content.
3. Filter and audit before training
Deduplicate, look for rare repeated strings, odd token patterns and clusters of near-identical documents. Because small counts can matter, rely on targeted checks rather than only percentage-based thresholds.
4. Test for triggers after training
Evaluate on held-out clean data, sliced by category, and probe the model with unusual tokens and phrases. Red-team fine-tuned models before release.
5. Monitor training and production
Watch training loss for anomalies, as OWASP suggests, and watch production outputs for sudden shifts after data refreshes.
6. Isolate and secure artifacts
Sandbox training so models cannot pull in unverified data. Verify checksums on downloaded models and prefer formats that cannot execute code on load.
Hands-on exercise: a simple poisoning check
This hypothetical exercise shows how to scan a text dataset for suspicious repeated strings. It is a sketch and has not been tested.
import sys
from collections import Counter
# usage: python -I scan.py data.txt
counts = Counter()
with open(sys.argv[1], encoding="utf-8") as f:
for line in f:
for tok in set(line.split()):
counts[tok] += 1
# Rare-but-repeated tokens (for example 50 to 1000 documents) deserve review
for tok, c in counts.items():
if 50 <= c <= 1000 and not tok.isalpha():
print(c, tok)
Then check whether the flagged tokens co-occur with odd content, such as long runs of random text. Tune the thresholds to your corpus size. This is a starting heuristic, not a complete detector.
Common mistakes
- Trusting percentages. Assuming a huge dataset dilutes any attack is exactly what the 250-document result questions.
- Checking only overall accuracy. Backdoors hide from aggregate metrics.
- No dataset versioning. Without it, you cannot trace or roll back a bad batch.
- Ignoring fine-tuning and retrieval data. These smaller stores are often easier to tamper with than pre-training corpora.
- Treating poisoning as only a research issue. It is in the OWASP LLM Top 10 for a reason.
FAQ
Is data poisoning the same as prompt injection?
No. Poisoning corrupts training or reference data ahead of time. Prompt injection manipulates a model through inputs at run time. Indirect prompt injection through retrieved content can blur the line, which is why both appear in modern taxonomies.
Can a poisoned model be fixed?
Sometimes fine-tuning on clean data or other mitigation helps, but the reliable fix is to find and remove the bad data and retrain.
Does model size protect against it?
The 2025 study found no protection from size across 600M to 13B parameters for its narrow backdoor. Results for larger models and other behaviors remain open questions.
What should I read next?
Start with NIST AI 100-2 E2025 for vocabulary and the OWASP LLM04 entry for practical mitigations. NIST has also released a later draft in this series, so check for the current version before citing it.
Key takeaways
- Data poisoning attacks the training stage, and the harm persists in the model.
- Recent research suggests the absolute number of poisoned samples can matter more than their share, at least for narrow backdoors.
- Defend with provenance, vetting, pre-training audits, trigger testing and monitoring.