{"course":{"slug":"ai-and-you","title":"AI, Safety and What Goes Wrong","url":"https://addaly.com/learn/ai-and-you","level":"beginner","track":"start"},"lesson":{"slug":"poisoning-the-well","title":"Attacks on the model itself","url":"https://addaly.com/learn/ai-and-you/poisoning-the-well","position":46,"of":73,"minutes":9,"answer":"A backdoor can be installed with a roughly constant number of poisoned documents rather than a constant proportion, so bigger training sets are not protective, and at the distribution end.","keyIdea":"A backdoor can be installed with a roughly constant number of poisoned documents rather than a constant proportion, so bigger training sets are not protective, and at the distribution end, the safetensors format is the difference between loading numbers and executing a stranger's code."},"body":{"format":"markdown","text":"## Attacking the training, not the prompt\n\nEverything so far attacked a model at the moment of use. There is an earlier point of attack: the data it learns from, and the files it is distributed in.\n\n**Data poisoning** means inserting text into a training corpus so that the resulting model behaves as the attacker wants. It works because large models are trained on scraped material that nobody reads, from sources anyone can write to: web pages, forums, code repositories, comment sections, collaboratively edited encyclopaedias.\n\nA **backdoor** is the sharpest version. The poisoned examples associate an unusual trigger phrase with a specific behaviour. Without the trigger the model behaves normally and passes every evaluation. With it, it does the attacker's thing. Because the trigger is arbitrary and rare, no benchmark will find it, and inspecting the weights will not reveal it either.\n\n## The finding that changed the picture\n\nThe intuition used to be that poisoning a large model would require poisoning a proportional share of an enormous dataset: that scale was itself a defence.\n\nWork published in 2025 by Anthropic with the UK AI Security Institute and the Alan Turing Institute tested this directly, training models from 600 million to 13 billion parameters, and found that a backdoor could be installed with a roughly **constant number of poisoned documents (around 250) regardless of model size**.\n\nIf that holds more broadly, the arithmetic of the threat inverts. Two hundred and fifty documents is something one determined person can publish. Larger models, trained on more data, are not automatically safer; if anything the larger corpus makes 250 documents easier to hide.\n\n> Figure: Poisoned documents needed to install a backdoor. Line chart of Poisoned documents against Model size, billions of parameters: Measured: about 250, whatever the size (0.6, 250) (2, 250) (7, 250) (13, 250); If a constant proportion of the data were needed (0.6, 250) (2, 833) (7, 2917) (13, 5417). The 2025 study found a roughly constant count of about 250 documents from 600 million to 13 billion parameters, not a constant proportion. One study, on models far smaller than frontier systems, testing a narrow class of backdoor; it nonetheless points the wrong way for the belief that scale protects.\n\nHold this with appropriate caution: it is one study, on models much smaller than frontier systems, testing a narrow class of backdoor. The researchers say so themselves.\n\n## Poisoning at the other end\n\nTwo related attacks matter more day to day.\n\n**Retrieval poisoning.** Where a system retrieves documents before answering, an attacker who can add a document to the corpus controls what gets retrieved. A crafted page optimised to match likely queries and containing false claims, or instructions, is far cheaper than poisoning training data and hits production systems immediately. Any system that indexes the open web or accepts user-uploaded documents is exposed.\n\n**Search-result poisoning.** The same idea aimed at the summarisers of the previous module. Content created to be picked up and repeated by AI search products, sometimes called generative engine optimisation when done for marketing and something else when done for fraud.\n\n## The supply chain\n\nModels are files, downloaded from repositories, and files can be malicious.\n\nThe historical problem is Python's older serialisation format, which was for years the default for distributing model weights. Loading such a file executes code by design. A malicious model file therefore runs whatever it likes on your machine the moment you load it, and real examples have been found on public model hubs.\n\nThe fix exists and you should use it: the **safetensors** format, which stores only numbers and cannot execute anything. It is now the default on the major hubs. When downloading a model, prefer safetensors, prefer publishers you can identify, check that a model with a familiar name is from the organisation you expect rather than a lookalike account, and treat `trust_remote_code=True` in a loading script as what it is: permission for someone else's code to run as you.\n\nThe same applies one layer up. Model-serving frameworks, agent libraries and plugin ecosystems are ordinary software supply chains with the ordinary problems: typosquatted packages, abandoned dependencies, and now model-context servers that ask for broad permissions.\n\n## What is realistic for you\n\nThree things are within reach.\n\nUse safetensors and known publishers when you download models. Understand that any AI system reading a corpus you do not control (the web, user uploads, a shared drive) can be fed by whoever can write to that corpus. And when a system gives you a strange answer in a narrow area, consider that the corpus may have been shaped rather than assuming the model is confused."},"check":{"question":"Why does a backdoor installed by data poisoning typically survive standard evaluation?","options":[{"text":"It fires only on a rare trigger, so the model acts normally on every test input","correct":true},{"text":"Tests measure average performance, and the backdoor lowers the average only a little","correct":false,"tempting":"Assumes a measurable drop exists to be averaged away. A well-built backdoor leaves normal performance untouched."},{"text":"Evaluations run on the training data, where the poisoned examples look like any text","correct":false,"tempting":"Evaluations normally use held-out data, and the backdoor would survive a clean held-out set just as easily."},{"text":"The weights are too large to inspect, so the poisoned parameters cannot be found","correct":false,"tempting":"The weights are uninterpretable, but the backdoor is missed for a behavioural reason: nothing in the test set triggers it."}],"why":"A benchmark contains ordinary inputs. The trigger is chosen so that none of them contains it."},"prev":{"slug":"jailbreaks-and-why-they-persist","title":"Why safety training is a surface, not a wall","url":"https://addaly.com/learn/ai-and-you/jailbreaks-and-why-they-persist"},"next":{"slug":"scams-that-scale","title":"Fraud, now that language is cheap","url":"https://addaly.com/learn/ai-and-you/scams-that-scale"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Attacks on the model itself', in AI, Safety and What Goes Wrong. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/ai-and-you/poisoning-the-well (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Attacks on the model itself","courseTitle":"AI, Safety and What Goes Wrong","module":{"index":6,"slug":"manipulation-and-security","title":"Manipulation, attack and abuse"},"answer":null,"keyIdea":"A backdoor can be installed with a roughly constant number of poisoned documents rather than a constant proportion, so bigger training sets are not protective, and at the distribution end, the safetensors format is the difference between loading numbers and executing a stranger’s code.","hero":{"kind":"figure","figure":{"t":"figure","label":"Figure","figure":{"caption":"The 2025 study found a roughly constant count of about 250 documents from 600 million to 13 billion parameters, not a constant proportion. One study, on models far smaller than frontier systems, testing a narrow class of backdoor; it nonetheless points the wrong way for the belief that scale protects.","series":[{"label":"Measured: about 250, whatever the size","points":[[0.6,250],[2,250],[7,250],[13,250]]},{"label":"If a constant proportion of the data were needed","points":[[0.6,250],[2,833],[7,2917],[13,5417]]}],"title":"Poisoned documents needed to install a backdoor","type":"line","xLabel":"Model size, billions of parameters","yLabel":"Poisoned documents"},"alt":"Figure: Poisoned documents needed to install a backdoor. Line chart of Poisoned documents against Model size, billions of parameters: Measured: about 250, whatever the size (0.6, 250) (2, 250) (7, 250) (13, 250); If a constant proportion of the data were needed (0.6, 250) (2, 833) (7, 2917) (13, 5417). The 2025 study found a roughly constant count of about 250 documents from 600 million to 13 billion parameters, not a constant proportion. One study, on models far smaller than frontier systems, testing a narrow class of backdoor; it nonetheless points the wrong way for the belief that scale protects."}},"blocks":[{"t":"h2","id":"attacking-the-training-not-the-prompt","runs":[{"text":"Attacking the training, not the prompt"}]},{"t":"p","runs":[{"text":"Everything so far attacked a model at the moment of use. There is an earlier point of attack: the data it learns from, and the files it is distributed in."}]},{"t":"p","runs":[{"text":"Data poisoning","b":true},{"text":" means inserting text into a training corpus so that the resulting model behaves as the attacker wants. It works because large models are trained on scraped material that nobody reads, from sources anyone can write to: web pages, forums, code repositories, comment sections, collaboratively edited encyclopaedias."}]},{"t":"p","runs":[{"text":"A "},{"text":"backdoor","b":true},{"text":" is the sharpest version. The poisoned examples associate an unusual trigger phrase with a specific behaviour. Without the trigger the model behaves normally and passes every evaluation. With it, it does the attacker’s thing. Because the trigger is arbitrary and rare, no benchmark will find it, and inspecting the weights will not reveal it either."}]},{"t":"h2","id":"the-finding-that-changed-the-picture","runs":[{"text":"The finding that changed the picture"}]},{"t":"p","runs":[{"text":"The intuition used to be that poisoning a large model would require poisoning a proportional share of an enormous dataset: that scale was itself a defence."}]},{"t":"p","runs":[{"text":"Work published in 2025 by Anthropic with the UK AI Security Institute and the Alan Turing Institute tested this directly, training models from 600 million to 13 billion parameters, and found that a backdoor could be installed with a roughly "},{"text":"constant number of poisoned documents (around 250) regardless of model size","b":true},{"text":"."}]},{"t":"p","runs":[{"text":"If that holds more broadly, the arithmetic of the threat inverts. Two hundred and fifty documents is something one determined person can publish. Larger models, trained on more data, are not automatically safer; if anything the larger corpus makes 250 documents easier to hide."}]},{"t":"p","runs":[{"text":"Hold this with appropriate caution: it is one study, on models much smaller than frontier systems, testing a narrow class of backdoor. The researchers say so themselves."}]},{"t":"h2","id":"poisoning-at-the-other-end","runs":[{"text":"Poisoning at the other end"}]},{"t":"p","runs":[{"text":"Two related attacks matter more day to day."}]},{"t":"p","runs":[{"text":"Retrieval poisoning.","b":true},{"text":" Where a system retrieves documents before answering, an attacker who can add a document to the corpus controls what gets retrieved. A crafted page optimised to match likely queries and containing false claims, or instructions, is far cheaper than poisoning training data and hits production systems immediately. Any system that indexes the open web or accepts user-uploaded documents is exposed."}]},{"t":"p","runs":[{"text":"Search-result poisoning.","b":true},{"text":" The same idea aimed at the summarisers of the previous module. Content created to be picked up and repeated by AI search products, sometimes called generative engine optimisation when done for marketing and something else when done for fraud."}]},{"t":"h2","id":"the-supply-chain","runs":[{"text":"The supply chain"}]},{"t":"p","runs":[{"text":"Models are files, downloaded from repositories, and files can be malicious."}]},{"t":"p","runs":[{"text":"The historical problem is Python’s older serialisation format, which was for years the default for distributing model weights. Loading such a file executes code by design. A malicious model file therefore runs whatever it likes on your machine the moment you load it, and real examples have been found on public model hubs."}]},{"t":"p","runs":[{"text":"The fix exists and you should use it: the "},{"text":"safetensors","b":true},{"text":" format, which stores only numbers and cannot execute anything. It is now the default on the major hubs. When downloading a model, prefer safetensors, prefer publishers you can identify, check that a model with a familiar name is from the organisation you expect rather than a lookalike account, and treat "},{"text":"trust_remote_code=True","code":true},{"text":" in a loading script as what it is: permission for someone else’s code to run as you."}]},{"t":"p","runs":[{"text":"The same applies one layer up. Model-serving frameworks, agent libraries and plugin ecosystems are ordinary software supply chains with the ordinary problems: typosquatted packages, abandoned dependencies, and now model-context servers that ask for broad permissions."}]},{"t":"h2","id":"what-is-realistic-for-you","runs":[{"text":"What is realistic for you"}]},{"t":"p","runs":[{"text":"Three things are within reach."}]},{"t":"p","runs":[{"text":"Use safetensors and known publishers when you download models. Understand that any AI system reading a corpus you do not control (the web, user uploads, a shared drive) can be fed by whoever can write to that corpus. And when a system gives you a strange answer in a narrow area, consider that the corpus may have been shaped rather than assuming the model is confused."}]}],"check":{"question":[{"text":"Why does a backdoor installed by data poisoning typically survive standard evaluation?"}],"options":[{"text":[{"text":"It fires only on a rare trigger, so the model acts normally on every test input"}],"correct":true,"tempting":null},{"text":[{"text":"Tests measure average performance, and the backdoor lowers the average only a little"}],"correct":false,"tempting":[{"text":"Assumes a measurable drop exists to be averaged away. A well-built backdoor leaves normal performance untouched."}]},{"text":[{"text":"Evaluations run on the training data, where the poisoned examples look like any text"}],"correct":false,"tempting":[{"text":"Evaluations normally use held-out data, and the backdoor would survive a clean held-out set just as easily."}]},{"text":[{"text":"The weights are too large to inspect, so the poisoned parameters cannot be found"}],"correct":false,"tempting":[{"text":"The weights are uninterpretable, but the backdoor is missed for a behavioural reason: nothing in the test set triggers it."}]}],"order":[2,1,0,3],"why":[{"text":"A benchmark contains ordinary inputs. The trigger is chosen so that none of them contains it."}]},"prev":{"slug":"jailbreaks-and-why-they-persist","title":"Why safety training is a surface, not a wall","minutes":8},"next":{"slug":"scams-that-scale","title":"Fraud, now that language is cheap","minutes":8}}}