Skip to content

I.3I · The modelattack

Training data - extraction and poisoning

Models memorize, so the training corpus is reachable two ways: pull secrets out (extraction) or push poison in (data poisoning) - and both are cheap and practical at the scale modern LLMs are trained on. That is why this is foundational rather than exotic.

Extraction & memorization

Carlini et al. recovered verbatim memorized sequences - including PII - from production LLMs by sampling and ranking by confidence, establishing that “the model might just say the training data” is a real privacy and compliance exposure, not a hypothetical. The production-scale follow-up (Nasr, Carlini et al. 2023, arXiv:2311.17035) showed a divergence attack - repeating a token like “poem” until the aligned model breaks form - that extracted megabytes of verbatim training data, including PII, from ChatGPT, demonstrating that alignment does not remove memorization. Membership inference and model inversion (I.4 · Adversarial machine learning) attach here too.

Web-scale data poisoning

Poisoning splits by attacker goal: availability/denial (degrade the model broadly), targeted (mislead on specific inputs while clean accuracy holds), and backdoor (a trigger induces attacker-chosen output). Clean-label is the hard case - the poisoned samples carry correct-looking labels/content, so human curation and label review will not catch them.

The uncomfortable result: poisoning the public web that models train on is cheap and practical. Carlini et al. introduced two attacks and demonstrated poisoning 0.01% of LAION-400M/COYO-700M for about $60:

  • Split-view poisoning - the annotator’s view of a dataset differs from what later downloaders fetch, because internet content is mutable.
  • Frontrunning - edit a source like Wikipedia at the moment it’s snapshotted. It works because snapshots are scheduled predictably, so a malicious edit timed just before one persists in the training data even if moderators later revert it.

Follow-ups showed pre-training poisoning persists through later SFT/DPO alignment and that the effect scales predictably with poison fraction.

Membership inference - LiRA-style calibrated test (authorized audit)
# A single global loss threshold is high-FPR. LiRA (Carlini et al. 2022) calibrates
# per-example: compare the target's loss to the loss distribution from shadow models
# trained WITH vs WITHOUT each record, then take a likelihood ratio.
import numpy as np
from scipy.stats import norm
# shadow_in[x] = losses on x from models trained INCLUDING x
# shadow_out[x] = losses on x from models trained EXCLUDING x
mu_in, s_in = shadow_in[x].mean(), shadow_in[x].std() + 1e-6
mu_out, s_out = shadow_out[x].mean(), shadow_out[x].std() + 1e-6
l = target_model.loss(x) # observed loss on the audited model
score = norm.logpdf(l, mu_in, s_in) - norm.logpdf(l, mu_out, s_out)
member = score > 0 # LR > 1 => likely in the training set
# Report TPR at low FPR (e.g. TPR@0.1%FPR), not accuracy - that is the field-standard metric.
# Tooling: privacy_meter (ML Privacy Meter) or tensorflow_privacy's membership_inference_attack.
# Extraction scales the same idea: prompt the model to continue a known prefix and
# watch for verbatim training data (names, keys, PII) emerging in the completion.
# DEFENSE: DP-SGD training, dedup + PII scrub, output filters for verbatim/secret patterns.

The advisory point for a client: anything memorized is potentially extractable, so the corpus must be treated as eventually-public - the defense is upstream (what you train on and how), not just an output filter.

Defenses

  • Differential privacy in training - bounds how much any single record can influence the model; the principled defense against memorization/extraction, at a utility cost.
  • Data curation & sanitization - source vetting, PII scanning/redaction, deduplication (dedup measurably reduces memorization).
  • Dataset governance & integrity - signed/checksummed corpora, provenance tracking, controlled snapshots to defeat split-view/frontrunning.
  • Memorization auditing - empirically test a trained model for leakage before release.
  • Machine unlearning & model editing - post-hoc removal of specific memorized data or facts from a trained model (e.g. gradient-ascent unlearning, ROME/MEMIT-style weight edits) without full retraining. This is the practical answer to a GDPR Article 17 / PDPA erasure request, but it is a mitigation, not a guarantee: unlearning is hard to verify, often only suppresses rather than truly removes (residuals resurface under paraphrase, fine-tuning, or relearning attacks), and can degrade utility. Retraining from scratch is the only complete removal - and usually infeasible on cost.

Pick-your-control matrix - which attack, where it lands, the cheapest control that dents it. Nothing new here; it is the controls above, indexed by attack class so you can choose fast under review.

Attack classLifecycle stage it hitsPrimary defenseCost / trade-off
Membership inference (I.4)Inference - query the deployed model/APIDifferential privacy (DP-SGD) in training; verify residual leakage with privacy_meter (TPR@0.1%FPR)Utility drop from the DP noise budget
Model inversion (I.4)Inference - reconstruct inputs from model outputsDP-SGD, plus rate-limit and monitor the prediction APIUtility cost; monitoring and latency overhead
Training-data extractionPost-deployment - prompt the model to continue a known prefixDedup + PII scrub upstream, output filters for verbatim/secret patterns, memorization auditing before releaseCuration effort; output filters miss novel secrets
Data poisoning (II.2)Data collection / pre-training (and RAG ingest)Dataset governance & integrity - signed/checksummed corpora and controlled snapshots to defeat split-view/frontrunningProvenance and snapshot overhead on every source
Embedding inversion (I.4)Inference - recover text from exposed embedding vectorsDifferential privacy; rate-limit and guard the embeddings endpoint the same as any prediction APIUtility cost; weaker signal when vectors are withheld or perturbed

Sources

  • Carlini 2021 - Extracting Training Data from LLMs - USENIX Security; arXiv:2012.07805
  • Nasr/Carlini 2023 - Scalable Extraction of Training Data from (Production) LLMs - arXiv:2311.17035
  • Carlini 2023 - Poisoning Web-Scale Training Datasets is Practical - arXiv:2302.10149
  • Zhang 2024 - Persistent Pre-training Poisoning of LLMs - arXiv:2410.13722
  • Anthropic / UK AISI / Alan Turing Institute 2025 - Poisoning Attacks on LLMs Require a Near-Constant Number of Poison Samples - arXiv:2510.07192