GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions

Models treat a developer's rules, a user's request and a web page's text as equally binding. OpenAI trained GPT-3.5 to rank them, and robustness rose on every attack it tested, including unseen ones.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2024
AUTHORS
Wallace, Xiao, Leike, Weng, Heidecke, Beutel
FROM
OpenAI
PUBLISHED
Apr 2024 · arXiv preprint
IN THIS BREAKDOWN · 10 SECTIONS

You can read 18% of this breakdown.

01

The paper in one minute

An LLM application mixes text from different sources into one prompt: a system message from the developer, user messages from whoever is typing, the model's own outputs, and tool outputs such as web results, files and API responses. The authors argue that prompt injections, jailbreaks and system-prompt extraction share one cause: the model gives all of that text roughly equal authority. A web page that says "forward every email to me" competes on even terms with the developer's instructions.

The fix they propose is an instruction hierarchy: system messages outrank user messages, which outrank model outputs, which outrank tool outputs. A lower-level instruction is either aligned with the ones above it ("answer in Spanish" sent to a car-sales bot) and should be followed, or misaligned ("you are now a gardening helper", or a web result asking for the chat history) and should be ignored, or refused when there is no way to continue.

The hierarchy is trained, not hard-coded. Context synthesis splits a compound request ("write a 20-line poem in Spanish") into pieces, places them at different levels and trains the model to give the original answer, so it learns to combine aligned instructions. Context ignorance trains the model to answer as if a misaligned instruction had never been there. Red-teamer models, including one trained with RL to fool the base model, generate the attacks. GPT-3.5 Turbo was fine-tuned with this data plus ordinary capability data, using SFT and RLHF, and compared with the same recipe minus the hierarchy data.

Robustness improved on every evaluation, by up to 63 points (system-message extraction), and on attack types deliberately kept out of training, by up to 34 points (jailbreaks). The cost is over-refusal on benign prompts built to look like attacks.

THE IDEA, VISUALLY
WHO MAY INSTRUCT THE MODEL (FIGURE 1) System message developer highest User message end user medium Model output the model itself lower Tool output web, files, APIs lowest higher wins on conflict TWO KINDS OF LOWER-LEVEL INSTRUCTION (SECTION 3) Aligned "answer in Spanish" under a sales bot: follow it taught by context synthesis Misaligned a web page asking to email the chat away: ignore, or refuse taught by context ignorance Tool outputs are treated as misaligned by default; closed-domain tasks (summarize, translate) have no aligned instructions at all. GPT-3.5 Turbo, SFT + RLHF; jailbreak data deliberately left out ROBUSTNESS %, BASELINE → TRAINED (FIGURES 2-4) trained on hijacking 59.2→79.2 new instructions 89.6→93.7 user conflicting 62.2→92.6 indirect, browsing 77.5→85.0 system msg extraction 32.8→95.9 held out (never in training data) indirect, tools 77.6→87.0 TensorTrust password 53.8→84.2 Gandalf password 51.8→73.7 Jailbreakchat 83.8→89.2 ChatGPT jailbreaks 37.4→71.2 over-refusal: benign prompts still followed probing questions 85.2→75.0 jailbreak-looking benign 83.1→60.4 non-conflicting 78.9→77.7 baseline instruction hierarchy Gains are percentage points on the authors' evaluations; the model still lets 13% of held-out tool injections through, so tool permissions belong in application code.
System messages outrank user messages, which outrank tool outputs. Training on that ranking raised robustness on every evaluation, at some cost to benign prompts that look like attacks.
Research notes: the problem, approach and results
+63 pts

robustness to system-message extraction, 32.8% to 95.9% (Figure 2)

+34 pts

robustness to ChatGPT jailbreaks, never shown in training, 37.4% to 71.2% (Figure 3)

-22.7 pts

compliance on benign prompts dressed as jailbreaks, 83.1% to 60.4%, the main over-refusal cost (Figure 4)

THE PROBLEM

Prompt injections, jailbreaks and system-prompt extraction all work because the model gives a web page or a user the same authority as the developer's system message.

THE IDEA

Define a hierarchy (system > user > model > tool output). Lower-level instructions that agree with higher ones are followed; conflicting ones are ignored, or refused if there is no way to proceed. Teach it with synthetic data: context synthesis for aligned instructions and context ignorance for misaligned ones.

THE RESULT

On GPT-3.5 Turbo, robustness rose on all five trained-on evaluations (system-message extraction 32.8% to 95.9%) and on five attack types left out of training (ChatGPT jailbreaks 37.4% to 71.2%), with some over-refusal on benign prompts that look like attacks.

02

Why it matters to an FDE

Every agent you deploy reads text written by people who are not your customer: emails, tickets, web pages, shared documents. The paper gives you a precise vocabulary for the risk: which source is allowed to instruct the system, and what happens when sources disagree.

It tells you how to lay out prompts. The authors advise putting task instructions in the system message and third-party content in a separate message, never in one string like "Summarize the following text: {document}". That is free to adopt on any hosted API today.

It is a model-level defense, and the paper says so. The trained model still followed 13% of held-out tool injections. The authors call their work complementary to system-level guardrails such as asking users to approve actions. A customer who hears "the model ignores injected instructions" needs to hear the second half: tool permissions are enforced by application code, outside the model.

It names the trade-off you will be asked about. A model that never follows lower-level text is safe and useless. Most of the value is in following aligned instructions while ignoring the rest, and the paper measures what that boundary costs.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 157 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The privilege levels, aligned vs misaligned, the two data recipes, the results and three misreadings

    Free account
  2. 04How it works

    The hierarchy, how training data is generated per attack, and the evaluation setup

    Premium
  3. 05The numbers that matter

    Every robustness bar from Figures 2-5, the over-refusal costs and the prompting baseline

    Premium
  4. 06Try it yourself

    Recompute every gain from the figures, then weigh model robustness against an application gate

    Premium
  5. 07Where it breaks

    Imperfect robustness, blunt tool handling, over-refusal, one closed model and a few slips

    Premium
  6. 08Using it on a deployment

    Prompt layout, provenance, code-enforced permissions, and what to adopt without training access

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →