Topic 1
Instructions and data share one stream
Prompt injection exists because a model has no separate channel for instructions. Your system prompt, the user's message, a retrieved document and a tool's result are all concatenated into one prompt and turned into tokens (Models don't read text). A sentence that reads like an instruction looks the same wherever it came from.
Predict first
Scroll sideways to see the whole diagram
An application's context comes from several places, and different people wrote each part.
Text version
- An application's context comes from several places, and different people wrote each part.
- Before the call, all of it is concatenated into one prompt and turned into tokens. Role markers are tokens too.
- The model reads one sequence. A sentence in a web page that reads like an instruction looks the same as one in your system prompt.
After AI Engineering, Ch. 5, "System Prompt and User Prompt" and "Model-level defense". Illustrative parts.
Prompt injection is text that gets the model to follow instructions the developer never meant it to follow. Greshake et al. put the cause in one line: LLM-integrated applications "blur the line between data and instructions" (arXiv:2302.12173, abstract, fetched 2026-10-21).
You saw a token-level version in Module 01: special-token injection, where user text forges a control token. That one has a clean fix, encoding untrusted text as ordinary text. Plain-language instructions have no such fix: there is no "ordinary text" mode for meaning.
The book's diagnosis (Ch. 5, "Jailbreaking and Prompt Injection"): prompt attacks work "precisely because models are trained to follow instructions." A model that follows instructions better can follow an attacker's better too.
Quick check