Module 00 · Lesson 07
Training is not a boundary
"We told the model not to." "The model was trained to refuse." These are the most common first answers to agent security, and the most important thing this lesson can do is show why each is worth having and why neither is a boundary.
There is one stream
A chat model receives a sequence of tokens. Roles (system, user, assistant, tool) are marked by delimiter tokens that the serving template inserts. After that, the transformer processes one sequence; nothing in the architecture treats a "system" span as more binding than a "tool" span. Any difference in how the model treats them is learned, from training examples, as a statistical regularity.
flowchart TD S["system: be an ops assistant"] --- U["user: summarise the report"] U --- T["tool result: file contents,<br/>which includes whatever the author wrote"] T --> Q["one sequence"] Q --> M["model"] M --> N["next token"]
You can see it for yourself in Module 1, lesson 8, where you print the exact string your lab's model receives.
What training buys
The instruction hierarchy (Wallace et al., 2024) names the root problem precisely: models treat system prompts as no higher in priority than text from users and third parties. Their remedy is data: train the model to follow privileged instructions over lower-privileged ones when they conflict, and they report that it substantially increases robustness, including to attack types not seen in training, at small cost in capability. Other work (preference-trained resistance, structured queries) is in the same family and Module 4 covers it.
This is real and worth using. It lowers the rate at which opportunistic and accidental injections succeed.
What it does not buy
Nasr, Carlini and co-authors (2025) took 12 recent defences, covering several families, and attacked each with adaptive methods: gradient descent, reinforcement learning, random search and human-guided exploration, each tuned to the defence's design and given a large budget. They report attack success above 90% for most, and note that the majority of those defences had originally reported near-zero attack success rates.
Read that as a statement about evaluation, not only about those defences. A defence evaluated on a fixed set of attack strings, or on weak optimisers not designed against it, is measured under a distribution the attacker will not use. Its reported number is the success rate against an attacker who never saw the defence, which is not the attacker that exists. This is the fourth problem of lesson 5 (an adversary who moves second), now with a measured size.
Module 1 has a small version of the same observation, in reference runs of the attack its build asks you to write (qwen3:4b, October 2026): the same request, placed at the end of a document, landed 0 times in 5; placed at the top of the file as a note to the assistant, 5 times in 6. Your own runs will differ; the direction is the point. A person found that difference by moving the request and recasting it as a note. A search procedure tries every move and phrasing its budget allows, and finds the next one.
So what is the boundary?
Training is a probabilistic property of one model on one distribution. A boundary is a structural property that holds for every input, including the ones an optimiser finds:
| Statement | Holds for | |
|---|---|---|
| Training | "this model resists injections like those in the test set" | the test distribution |
| Structure | "no value derived from untrusted input can reach an external send" | every input |
The CaMeL design (Debenedetti et al., 2025) is the cleanest example: the control flow is extracted from the trusted request alone, so untrusted data "can never impact the program flow", and capabilities on values stop private data leaving over unauthorised flows. On AgentDojo it solved 77% of tasks with provable security, against 84% for an undefended system. That seven-point gap is the price of structure, measured; Module 11 has you measure your own.
Use both, in the right order
Training and structure are not rivals; they fail differently (Module 2, lesson 7 on correlation). The mistake is to count the first as the second. In this course "the model was trained to refuse" is worth a number, measured on your own attack set, with adaptive attackers, and it is never worth "secure".
Check yourself
- A paper reports attack success falling from 70% to 1% with a new fine-tune, on 200 fixed prompts. List three things you would ask before believing it protects a deployment.
- An instruction hierarchy ranks the system prompt above the user, and the user above tool results. When does it help against a malicious user, and when does it not? Which writer in lesson 1's table does it rank lowest, and so guard against most directly?
- Write the structural statement that would make incident 1 of lesson 2 impossible, in one sentence, without mentioning any detector.
Answers
- Whether it was attacked adaptively, by optimisers tuned against the fine-tune with a real budget, not 200 fixed prompts (the gap Nasr et al. measured). What the interval is: 1% of 200 is 2 successes, with a one-sided 95% upper bound of 3.1%. And what it costs: task completion and false refusals on benign traffic shaped like the deployment's, not the benchmark's.
- It helps when the malicious user's instruction conflicts with the system prompt, such as asking the agent to ignore the developer's restrictions. It does not help when the harmful request is within what the system prompt allows: the user is the principal, and the agent's legitimate capabilities do the harm. It ranks tool results lowest, so it guards most directly against whoever wrote the files, e-mails and pages the agent reads.
- After the agent reads an e-mail from outside the organisation, no
send_emailto an external address may carry any value read from the CRM.