Can training models to rank instructions prevent prompt injection attacks?
Explores whether explicitly teaching LLMs to treat system messages as higher-privilege than user messages can defend against prompt injection, jailbreaks, and system prompt extraction.
The paper proposes an "instruction hierarchy" that explicitly ranks the different kinds of text an LLM receives — System Messages from the application developer, User Messages from the end user, Model Outputs, and Tool Outputs — and trains the model to defer to higher-privileged instructions when a lower-privileged one conflicts with them. Applied to fine-tuning GPT-3.5 Turbo via supervised fine-tuning and RLHF, the authors report the approach "drastically increases robustness" against prompt injection, jailbreaks, and system-message extraction: "defense against system prompt extraction is improved by 63%," and — notably — "jailbreak robustness increases by over 30%" even though jailbreaks were not directly modeled in the training data, which the authors read as generalization to "held-out attacks."
The mechanism rests on an analogy to operating-system privilege: today's LLMs execute every instruction "as if it was in kernel mode," so untrusted third-party text carries the same weight as a developer's system prompt — the same failure mode computing solved for SQL and command injection by refusing to treat user input as privileged instructions. The paper's taxonomy splits lower-privileged instructions into Aligned (consistent with the higher-level instruction, e.g. "speak in Spanish" for a car-salesman bot, which the model should follow) and Misaligned (contradictory or orthogonal, e.g. "IGNORE PREVIOUS INSTRUCTIONS," which the model should ignore or refuse). Training data is generated two ways: Context Synthesis decomposes compositional aligned requests into pieces scattered across hierarchy levels so the model learns to reassemble the original intent; Context Ignorance trains the model, for misaligned cases, to answer exactly as it would have if the lower-level instruction were never present, using red-teamer LLMs to generate the attack examples.
This sits one level below Who actually controls what AI systems say? and How well do system prompts protect commercial AI users?, both of which describe the system-prompt layer as an external governance problem — who can see or set the prompt. This paper instead treats privilege as something to train into the model's weights, so the ranking holds even where no external hierarchy document exists. It differs in kind from Can structural design patterns block prompt injection attacks?, whose patterns constrain agent architecture so injected content structurally cannot reach consequential actions; this paper's own discussion acknowledges the limit of a training-based approach, noting it is "complementary to other types of system-level mitigations" and that the resulting models are "likely still vulnerable to powerful adversarial attacks."
The excerpt reports headline percentages but not the benchmark composition, the size of the over-refusal regression, or how "drastically" is measured beyond the two cited figures; it states the regression exists ("our models sometimes ignore or refuse benign queries") without quantifying it, and defers multimodal instruction injection and architecture changes such as "specialized embeddings for messages at different levels" to future work. The implication, at the strength the excerpt allows, is that training a privilege ranking into the model measurably narrows — but by the authors' own account does not close — the gap that lets lower-privileged text override a developer's instructions.
Inquiring lines that read this note 6
This note is a source for these research framings, grouped by the broader line of inquiry each explores. Scan the bold lines of inquiry; follow any specific question forward.
What mechanisms ensure safety in deployed AI agents despite compositional risks? What makes language models vulnerable to prompt injection attacks? Can agent-created code become persistent, reusable infrastructure that improves over time? Can security defenses protect multi-agent systems as effectively as single-agent ones? Why do agents report success despite failing to complete actions?Related concepts in this collection 4
This note in its neighbourhood — explore the map, then jump to a related concept in the list below.
Click a node to walk · click center to open · click Open in graph to see this note in the full knowledge graph
-
Who actually controls what AI systems say?
Explores whether end-users have meaningful input into the foundational instructions that guide AI behavior, and whether hidden prompt edits can destabilize deployed systems.
describes the same privilege hierarchy as an external governance problem rather than a trained-in model property
-
How well do system prompts protect commercial AI users?
System prompts shape how AI products treat users, but they're rarely public. An audit of 88 commercial products asks whether these hidden instructions actually safeguard user interests.
measures the unevenness this paper's trained hierarchy aims to reduce at the model level
-
Can structural design patterns block prompt injection attacks?
This research explores whether fixing an agent's control flow architecture—rather than training or filtering—can provide provable resistance to prompt injection. It matters because general-purpose defenses have failed to guarantee safety against adversarial inputs.
contrasts a training-based privilege ranking with architectural patterns the other paper argues give provable guarantees
-
Can a fixed instruction hierarchy actually prevent prompt injection attacks?
OpenAI's Model Spec uses a five-level chain of command to resolve conflicting instructions, with root authority at the top. The question is whether this procedural approach reliably stops lower-level inputs from overriding high-authority safeguards in practice.
B's five-level chain of command extends A's privilege-ranking hierarchy with a concrete deployed instruction-privilege schema
Related papers in this collection 8
Papers most semantically related to this note, ranked by cosine similarity in the embedding space.
- The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions
- Design Patterns for Securing LLM Agents against Prompt Injections
- Defeating Prompt Injections by Design
- OpenAI GPT-5 System Card
- How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs
- LLMs Corrupt Your Documents When You Delegate
- Whose Side Is Your Agent On? Multi-Party Principal Loyalty in LLM Agents
- Persistent Pre-Training Poisoning of LLMs
Original note title
the instruction hierarchy trains LLMs to defer to higher-privileged instructions, improving system prompt extraction defense by 63 percent