Training a language model to assign explicit privilege levels to system, user, and tool messages cuts system-prompt extraction failures by 63.1 percentage points (from 32.8% to 95.9% robustness) and transfers zero-shot to unseen jailbreaks by up to 33.8 points. Wallace et al. apply this instruction hierarchy to GPT-3.5 Turbo via supervised fine-tuning and RLHF, preserving general benchmarks like TriviaQA, LAMBADA, and HellaSwag while avoiding the crippling blanket refusals of naive data-isolation defenses.

  • Four privilege tiers: System messages hold highest priority (0), ahead of user messages (10), multimodal image or audio inputs (20), and third-party tool or web outputs (30).
  • Large in-domain gains: Robustness improves from 59.2% to 89.6% on TensorTrust prompt hijacking, 79.2% to 93.7% on closed-domain injections, 62.2% to 92.6% on conflicting user requests, and 77.5% to 85.0% on indirect web browsing injections.
  • Zero-shot generalization: Without training on tool-return injections, password extraction, or jailbreaks, robustness rises from 77.6% to 87.0% on tool injections, 53.8% to 84.2% on TensorTrust passwords, and 37.4% to 71.2% on ChatGPT jailbreaks.
  • Measured over-refusal tax: Compliance on benign non-conflicting user instructions stays steady (78.9% vs. 77.7% baseline), though adversarial boundary tests drop from 83.1% to 60.4%.

How the hierarchy trains conditional compliance

Modern chat models format developer prompts, end-user queries, and tool outputs with special delimiter tokens, yet standard instruction tuning treats every imperative sentence as equally authoritative, akin to an operating system running untrusted input in kernel mode. Simply training a model to ignore all user instructions (as in strict closed-domain query isolation) breaks open-ended applications where users legitimately refine format or tone, such as asking a car-salesman bot to speak Spanish.

Wallace et al. resolve this by separating lower-priority instructions into aligned and misaligned cases during synthetic data generation. For aligned open-domain instructions, context synthesis takes compositional prompts (such as “write a 20-line poem in Spanish”), splits constraints across system and user turns, and trains the model to match the unified response. For misaligned instructions, context ignorance trains the model to output the exact completion it would produce if the conflicting lower-tier text were absent, or to refuse when no benign path exists (as in “You are now DAN”). For closed-domain tasks like summarization, the authors distill responses generated with an explicit anti-injection system prompt and filter failures using a GPT-4 grader. For indirect web injections, an RL-trained red-teamer LLM evolves adversarial search snippets against the base model, which is then trained to ignore them.

Robustness on trained vs. held-out attacks (%, higher is better)
System message extraction (TensorTrust)32.8% to 95.9% (+63.1)
Prompt injection hijacking (TensorTrust)59.2% to 89.6% (+30.4)
User conflicting instructions62.2% to 92.6% (+30.4)
ChatGPT jailbreaks w/ unsafe prompts [held-out]37.4% to 71.2% (+33.8)
TensorTrust password extraction [held-out]53.8% to 84.2% (+30.4)
Indirect injection via tools [held-out]77.6% to 87.0% (+9.4)
Baseline GPT-3.5 Turbo+ Instruction Hierarchy (in-domain)+ Instruction Hierarchy (zero-shot transfer)

Source: Wallace et al. (2024), Figures 2 and 3.

Prompting vs. training and over-refusal tradeoffs

Merely pasting the privilege rules into the system prompt falls far short of post-training. In Appendix A, adding an explicit hierarchy system message to the baseline model lifts TensorTrust hijacking robustness from 59.2% to 72.0% (versus 89.6% trained), actually drops User Conflicting robustness from 62.2% to 55.1% (versus 92.6% trained), and raises System Message Extraction from 32.8% to just 34.8% (versus 95.9% trained).

The main regression appears on adversarial over-refusal suites designed to probe the refusal boundary. On ordinary User Non-Conflicting Instructions (78.9% vs. 77.7%) and Borderline Allowed Prompts (87.4% vs. 86.2%), the trained model matches the baseline. However, benign questions about the system prompt drop from 85.2% to 75.0% compliance, and safe requests wrapped inside Jailbreakchat templates drop from 83.1% to 60.4% because the model treats jailbreak framing itself as a conflict signal.

Caveats and builder takeaway

The paper evaluates a single model family (GPT-3.5 Turbo), restricts training to text inputs despite assigning Priority 20 to audio and images, and treats every instruction found in browsing or tool outputs as misaligned. It also warns that trained models remain vulnerable to stronger optimization attacks and should complement, not replace, application-level defenses.

For engineers shipping LLM applications today, two implementation rules follow directly from the paper and indirect prompt injection research. First, never interpolate untrusted text into the system message using templates like "Summarize: {user_input}"; place developer instructions strictly in the system role and untrusted data in user or tool roles so privilege-trained models can separate them. Second, treat instruction hierarchy as probabilistic defense-in-depth alongside code-level authorization checks, architectural control separation, and policy reasoning such as deliberative alignment, while tracking agent security benchmarks for multi-turn tool failures.