Abstract
Current Large Language Models (LLMs) are vulnerable to prompt injections and jailbreaks because they treat developer instructions and untrusted third-party text with equal priority. This paper introduces an instruction hierarchy that explicitly teaches models to prioritize privileged instructions (like system prompts) over lower-level ones (like tool outputs). By applying novel synthetic data generation techniques, the researchers demonstrate significant increases in model robustness against adversarial attacks while maintaining core performance on standard benchmarks.
Introduction: The Problem of Flat Privilege
The fundamental security flaw in modern LLMs is a lack of "instruction privilege." In a traditional operating system, code runs with different levels of access; however, in an LLM, every piece of text in the context window—whether it is a hard-coded safety guardrail from the developer or a malicious "IGNORE ALL PREVIOUS INSTRUCTIONS" snippet from a random website—is executed as if it were in "kernel mode."
This "flat" priority structure makes models susceptible to several classes of attacks:
- Prompt Injections: Users or third parties overriding the model's original purpose.
- System Message Extraction: Adversaries tricking the model into revealing its internal developer instructions.
- Jailbreaks: Bypassing safety filters to generate harmful content.
The Instruction Hierarchy Framework
To address these vulnerabilities, the researchers propose a formal hierarchy of trust: System Messages (Highest Privilege) > User Messages (Medium Privilege) > Tool Outputs (Lowest Privilege). This structure ensures that instructions from a trusted developer cannot be overridden by potentially malicious data fetched from external tools or provided by the user.
Methodology
To bake this hierarchy into the model, the authors developed two novel data generation techniques to fine-tune GPT-3.5 Turbo using a mix of supervised fine-tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF):
- Context Synthesis (for Aligned Instructions): To ensure the model still follows valid user requests, complex instructions are decomposed. For example, a request to "Write a 20-line poem in Spanish" might place "Write a poem" in the system prompt and "Use Spanish" in the user prompt. The model is trained to combine these correctly.
- Context Ignorance (for Misaligned Instructions): Using "red-teamer" LLMs to generate adversarial attacks, the researchers train the target model to produce the response it would have given if the attack text were absent, effectively teaching the model to ignore injections that conflict with higher-level instructions.
Key Results and Evaluation
The study utilized a mix of existing benchmarks, including TensorTrust for prompt hijacking, the Gandalf Game for password extraction, and Jailbreakchat for safety bypasses. The results showed massive robustness gains across the board.
Key findings include:
- Massive Robustness Gains: Defense against system prompt extraction improved by approximately 63%.
- Zero-Shot Generalization: Robustness against jailbreaks increased by over 30%, despite no jailbreak data being used in the hierarchy training. This suggests the model learned a general principle of "trust the system prompt first."
- Minimal Performance Tax: The model maintained comparable performance to the baseline on standard NLP benchmarks like TriviaQA and HellaSwag, proving that security does not have to come at the cost of intelligence.
Discussion and Limitations
While the instruction hierarchy significantly improves security, the authors noted a minor "paranoia" effect where the model occasionally refuses benign queries that resemble attacks. Furthermore, the current work focuses exclusively on text; future research is required to address "cross-modal" injections, such as malicious instructions hidden in images or audio files. The authors also suggest that future LLM architectures might benefit from specialized "privilege embeddings" to structurally distinguish between different input types.
Summary updated