Can LLMs distinguish instructions from data? And what exactly does this mean?Can LLMs Separate Instructions From Data? And What Do We Even Mean By That?
The authors propose a formal metric for instruction-data separation and the SEP dataset, and test 9 LLMs: Naive separation scores range from 13.3% to 73.2%, and existing mitigation methods are either ineffective or harm utility.
- LLMs lack explicit separation between instructions and data and will execute instructions in the data, leading to risks such as indirect prompt injection; the authors state that previously there was no definition or benchmark quantifying this phenomenon.
- The authors define a formal separation score for single-turn language models and give an empirical variant that can be computed from model outputs alone; they build the SEP dataset (9160 entries) and use probes and witness words to estimate the degree of separation of each model.
- Naive separation scores of the 9 models range from 13.3% to 73.2%; prompt engineering raises them by 24 percentage points on average, prompt optimization by 7.2 percentage points on average, and fine-tuning by about 95% on average but lowers utility by about 17.8–20.1 percentage points on average.
- The authors note: the experiments cannot prove that existing techniques are unable to establish separation; GPT-4's high score may come from an unfair advantage in data generation; SEP only covers single-turn, short-answer probes; the authors hope to address this at the architectural level in the future.
- Threat model
- The paper does not propose an attack, but studies the fundamental flaw behind indirect prompt injection: LLMs cannot distinguish instructions that should be executed from data that should be processed. The victim systems are LLM applications that process external data (such as email clients and RAG); instructions in the data, whether malicious or not, may be erroneously executed.
- Evaluated models
- GPT-3.5 (gpt-3.5-turbo-0125)GPT-4 (gpt-4-turbo-2024-04-09)Gemma-2BGemma-7BPhi-3-mini-4kPhi-3-medium-128k-instructLlama-3 (8B)Llama-2 (7B)Starling-LM-7B-betaZephyr (7B) beta
- Benchmarks
- SEPSQuADAlpacaGuanaco
- Metrics
- empirical separation scoreutility score
The paper proposes a formal definition of instruction-data separation for single-turn language models, along with an approximate metric that can be computed from outputs alone without model internal states, and releases the SEP dataset for evaluating whether models execute data as instructions. SEP contains 9160 tuples consisting of a task prompt, data, a probe, and a witness word. On nine models—Gemma-2B, Gemma-7B, Phi-3-mini-4k, Llama-3 8B, Llama-2 7B, GPT-3.5, GPT-4, Starling, and Zephyr—separation scores under the naive setting range from 13.3% (Phi-3) to 73.2% (Gemma-2B), and more capable models do not exhibit better separation. Prompt engineering improves scores by an average of 24 percentage points, and prompt optimization by an average of 7.2 percentage points; fine-tuning can raise separation scores to about 94.5% to 96%, but average utility drops by 17.8 to 20.1 percentage points. The authors conjecture that the separation problem may require new approaches at the architectural level rather than post-hoc mitigation methods.
Why it was selectedThe paper provides a formal definition of instruction-data separation and the SEP dataset, and evaluates nine models and three types of mitigation methods, which can be used to understand the root causes of prompt injection.
Paper analysis
What problem does this paper attempt to solve?
LLMs lack instruction-data separation and there is no means to quantify it; the authors propose a formal metric, the SEP dataset, and empirically test 9 models.
Core problem: LLMs cannot distinguish instructions that should be executed from data that should be processed in the input, and previously there was no definition or benchmark quantifying this phenomenon.
- Problem scenario: LLM applications (email clients, RAG, API agents) feed external data to the model; the model should only execute the main instruction and treat the rest of the input as passive data; Figure 1 shows a Phi-3 email client executing an API call by treating a request written to the user in an email as an instruction.
- Why it matters: The authors state that this lack of separation makes models vulnerable to indirect prompt injection, which may lead to data leakage or affect other users, and that existing safety training that only refuses harmful prompts does not address this fundamental problem about the source of instructions.
- Existing gaps: The authors state that although prior work has speculated that the lack of separation is the cause of prompt injection, this phenomenon has never been studied from first principles, and there is no established definition or benchmark.
- Core observation: Modern computer systems have long had corresponding principles (SQL injection prevention, the CPU non-executable memory bit); the authors attempt to lay out a similar conceptual and empirical path for LLMs.
- The paper proposes: a formal metric for instruction-data separation in single-turn language models, an empirical variant computable from model outputs, the SEP dataset, and an empirical evaluation of 9 models and three types of mitigation techniques (prompt engineering, prompt optimization, fine-tuning).
- Threat model (the paper studies a model flaw rather than a new attack):
- Goal: the model should only execute the task in the instruction argument and treat the data argument as passive data.
- Attacker capability: a third party can implant instructions in the data via indirect prompt injection; the paper's evaluation does not rely on malicious instructions—benign probes suffice to expose the problem.
- Victim systems: LLM applications that process external data, such as email clients and RAG pipelines.
- The paper does not set assumptions about attacker knowledge; the evaluation only requires inference on the model (black-box outputs suffice).
What related research exists?
Related work is divided into three groups: jailbreak research, indirect prompt injection and its defenses; the authors state that this paper defines and quantifies the problem from a fundamental perspective.
Jailbreak and defenses
- Zou et al. (2023), Liu et al. (2024), Chao et al. (2023), Zeng et al. (2024)—study jailbreak (harmful queries) and defenses; the paper emphasizes that jailbreak is different from the fundamental flaw of improper instruction-data separation, and this paper targets the latter.
Indirect prompt injection
- Greshake et al. (2023)—proposed the (indirect) prompt injection phenomenon; the paper notes that it lacks quantification.
- Yi et al. (2024)—provides quantification and benchmarks of injection attacks for different LLMs, focusing on malicious instructions injected in text passages.
- De Stefano et al. (2024), RoyChowdhury et al. (2024), Debenedetti et al. (2024), Pasquini et al. (2024)—study end-to-end injection attacks and their consequences in RAG or agent scenarios (unintended API calls, propagation of misleading information).
Defenses against injection
- Piet et al. (2024)—uses a dedicated model not fine-tuned on instructions to defend against instruction hijacking, sacrificing conversational ability.
- Chen et al. (2024) (StruQ)—fine-tunes the model to only execute instructions in text blocks wrapped by specific markers; Appendix E of the paper draws on this idea to conduct a combined experiment of fine-tuning plus prompt engineering.
- Hines et al. (2024)—uses the spotlighting prompting method to mark data portions; the template-based prompt engineering in this paper is similar.
- Wallace et al. (2024), Abdelnabi et al. (2024), Bagdasarian et al. (2024)—mitigate injection risk through instruction-priority fine-tuning, white-box activation-difference detection, and sensitive-data minimization, respectively.
Baselines and benchmarks
- This paper is a measurement and benchmark work and has no baseline methods for comparison; the evaluation benchmark is the authors' own SEP, and the training/validation data come from SQuAD, Alpaca, and Guanaco.
The authors' positioning: despite the field being active over the past two years, understanding of the problem is still at an early stage; this paper defines and evaluates the data-instruction problem from a fundamental perspective, isolating it from other safety issues such as attacks and harmful instruction execution.
How does the paper address this problem?
Define a formal separation score and a computable empirical variant, build the SEP dataset, and evaluate three categories of mitigation techniques.
Overall approach: first give a formal definition of instruction-data separation for single-turn language models, then design an empirical separation score that requires only model outputs, build a SEP dataset for estimation, and finally conduct experiments with three categories of mitigation techniques.
Formal definition
- Model abstraction (Definition 1): A single-turn language model is a mapping g : A* × A* → M(A*), with the two parameters being the instruction parameter and the data parameter; the definition is architecture-independent.
- Separation score (Definition 2): sepp(g) = E(s,d,x)∼ p D(g(s, x+d), g(s+x, d)), i.e., the expected difference in output distributions when probe x is placed in the data parameter (should be processed) versus in the instruction parameter (should be executed); a low score means the model does not separate instructions from data.
- Non-computability: The original definition requires an unknown data distribution, the output space is too large, and output probabilities are unknown, so an empirical approximation is needed.
Empirical measure
- Witness word (Definition 3): If a word w almost never appears when x is processed and almost always appears when x is executed, then w is a surprise witness; its existence means the two distributions differ substantially.
- Empirical separation score (Definition 4): sep(g) = (∑i 1{wi ∈ yiI ∧ wi ∉ yiD})/(∑i 1{wi ∈ yiI}), i.e., among all cases where the probe in the instruction parameter produced the witness word, the proportion where the witness word does not appear when the probe is in the data parameter; it only requires sampling outputs and checking substrings.
- Utility score: uti(g) is the proportion of cases where the witness word appears when the probe is in the instruction parameter, as a proxy for output quality; the probes are very simple, so low utility indicates poor model quality.
SEP dataset
- Scale and structure: 9160 (s, d, x, w) tuples; 30 hand-created tasks (10 each in information processing/retrieval, content creation/generation, and analysis/evaluation), expanded by GPT-4 into 300 subtasks with generated instructions and data.
- Probes and witness words: 100 hand-written probe-witness pairs (50 basic questions plus 50 rewrites with a more insistent tone); probes have clear single-word answers, and that answer is unlikely to appear when the probe is only processed.
- Combination: Each probe is randomly attached to the beginning/end of the system prompt or the data, for 4 combinations in total, eliminating the effect of instruction order; the dataset is for evaluation only and is not used for training.
Mitigation technique experiments
- Training/validation data: Does not overlap with SEP; validation set 1000 examples, training set 10000 examples, tasks and data taken from SQuAD, probes taken from Alpaca, training set contains no witness words.
- Prompt engineering: Template-based (similar to Hines et al. 2024), Appendix B.2 gives 16 templates, the best selected by validation-set separation score.
- Prompt optimization: Adapts the gradient optimization of Zhou et al. (2024) to find a suffix of at most 20 tokens that makes the model prefer no-probe outputs; only for models with white-box access.
- Fine-tuning: LoRA, three mechanisms—SFT on no-probe data, SFT with dual objectives of separation plus utility (mixed with Guanaco, 50-50), and DPO; hyperparameters in Table 13 (LoRA rank 16, 3 epochs, etc.).
What experiments did the paper conduct?
The Naive separation scores of 9 models range from 13.3% to 73.2%; prompt engineering improves it substantially but unstably, and fine-tuning yields a separation score of about 95% but lowers utility.
Experimental setup
- Models tested (9): GPT-3.5 (gpt-3.5-turbo-0125), GPT-4 (gpt-4-turbo-2024-04-09), Gemma-2B, Gemma-7B, Phi-3-mini-4k, Llama-3 (8B), Llama-2 (7B), Starling-LM-7B-beta, Zephyr (7B) beta.
- Instruction/data proxy: System prompt as the instruction parameter, user prompt as the data parameter; Starling and Gemma do not distinguish system/user prompts, so "System prompt:"/"User prompt:" prefixes were manually added.
- Benchmark: SEP (9160 tuples); mitigation experiments additionally use a 1000-example validation set and a 10000-example training set (sourced from SQuAD, Alpaca).
- Metrics: Empirical separation score and utility score (Definition 4), reporting the mean and standard error of the mean on SEP.
- Judgment method: Rule-based—checking whether the output contains the witness word, with no LLM judge; the paper does not report the number of repetitions.
- Fine-tuning setup: LoRA (rank 16, alpha 8, 3 epochs, sequence length 3072, Table 13), NVIDIA A6000 GPU.
Main results
According to Table 4 (separation score %) and Table 5 (utility score %), ± is standard error:
Swipe horizontally to read the table
Model Naive separation PromptEng separation PromptOpt separation Fine-tuning(DPO) separation Naive utility DPO utility GPT-3.5 56.6±0.6 89.5±0.4 n/a n/a 79.2 n/a GPT-4 20.8±0.5 95.3±0.2 n/a n/a 83.3 n/a Gemma-2B 73.2±0.8 92.4±0.7 70.5±0.8 95.0±0.9 36.7 30.1 Gemma-7B 56.9±0.8 56.9±0.8 64.1±0.8 96.4±0.8 46.7 64.7 Phi-3-mini-4k 13.3±0.4 30.8±0.4 13.3±0.4 97.0±1.0 84.8 69.2 Llama-3 (8B) 30.8±0.6 49.8±0.6 46.7±0.6 98.4±1.0 86.0 51.6 Llama-2 (7B) 44.3±0.6 62.6±0.7 56.8±0.6 93.3±1.5 83.3 16.5 Starling-LM-7B-beta 14.0±0.4 39.5±0.6 17.1±0.4 95.5±2.2 86.9 77.4 Zephyr (7B) beta 30.0±0.7 36.3±0.6 44.2±0.6 96.1±0.2 50.4 40.7 - Authors' interpretation: All models have low Naive separation scores (13.3%–73.2%); even in the best case, more than a quarter of probes are executed; larger and stronger models actually have lower separation scores (GPT-4 lower than GPT-3.5, etc.), and the authors speculate that small models struggle to perform two tasks at once.
- Authors' interpretation: Prompt engineering raises the separation score by 24 percentage points on average and utility by 1.3 percentage points on average, but the differences are large—GPT-4 rises from 20.8% to 95.3%, Gemma-2B rises to 92.4% but utility drops from 36.7% to 15.3%, and Gemma-7B shows no gain at all.
- Authors' interpretation: Prompt optimization raises the score by only 7.2 percentage points on average; fine-tuning (DPO) has the highest separation score but utility declines, and Figure 2 shows that except for GPT-3.5/GPT-4 prompt engineering, utility and separation show a negative-slope trend line.
Comparison of the three fine-tuning mechanisms
- What was tested: Separation score and utility of three training mechanisms—SFT, dual-objective SFT (Balanced SFT), and DPO—on 7 open-source models (Table 11, Table 12).
- Results: Average separation scores are 94.5%, 94.4%, and 96.0% respectively; average utilities are 47.7%, 47.7%, and 50.0% respectively, a drop of about 17.8–20.1 percentage points compared with the Naive average utility of 67.8% (Table 5).
- Authors' interpretation: All three mechanisms achieve high separation scores but utility declines, and fine-tuned models will be less practical for some real tasks.
Breakdown by data dimensions (Appendix D)
- Insistence tone (Table 14): Except for Gemma-2B and GPT-3.5, lowering the probe's insistence tone increases the separation score, with the largest being 31.5 percentage points for Llama-2 (7B) (Insistent 29.5% vs Neutral 61.0%); the authors state that more urgent instructions are more likely to be executed.
- Attachment position (Table 15): When the probe is placed to the right of the user prompt, the separation score decreases for 6 of 7 models (Gemma-2B is the exception); when placed to the right of the system prompt, only the Gemma family decreases, by about 12 percentage points.
- Task domain (Table 16): All models have the highest separation scores on information processing/retrieval tasks and the lowest on creation/generation tasks; Starling-LM-7B-beta is the only exception (slightly higher on creation).
Other ablations and analyses
- StruQ-style combination (Appendix E, Table 17/18): With the strongest prompt template plus fine-tuning, on Llama-3-8b, Llama-2-7b, and Gemma1.1-7b, SFT separation scores decrease by 0.53% on average and DPO increases by 1.96% on average (DPO average 98.0%), while utility remains low (DPO average 44.3%).
- Failure cases (Appendix C): Even with the best prompts, GPT-4 and GPT-3.5 still execute probes in the data for hundreds of examples in the evaluation data (Table 9, 10 give examples).
- GPT-4 caveat: The authors note that it cannot be ruled out that GPT-4 gains an unfair advantage from participating in SEP data generation.
What are some points that can be further explored?
The authors acknowledge that the experiments cannot prove existing techniques ineffective and that GPT-4's high scores are questionable; the evaluation covers only 9 models in a single-turn setting.
Limitations and future directions noted by the authors
- Experiments cannot falsify (Section 6.1 Discussion): Experimental research can never prove that existing techniques cannot establish separation; it can only provide evidence. Under other choices, prompt optimization might be more beneficial and fine-tuning might better preserve utility; the authors hope future research will supplement this.
- GPT results are questionable (Section 6.1 Discussion): The good results of GPT-4 (followed by GPT-3.5) may stem from essential differences in architecture, training, training data or scale, or may be an artifact of the semi-automated data generation process; the authors hope future work will answer this using more high-quality LLMs to create alternative versions of SEP.
- Caveats of the Naive protocol (Section 5 Discussion): The distinction between system/user prompts is only a proxy for the instruction/data distinction; models are trained to respond to user instructions, so executing part of the user prompt content is understandable.
- GPT-4's unfair advantage (Section 6): It cannot be ruled out that GPT-4 gains an unfair advantage because the same model was used to create the SEP dataset.
- Future directions (Section 7): The authors believe a real solution may benefit from fundamentally new approaches, such as at the architecture level, new training procedures, or enhanced interpretability, rather than post-hoc mitigation techniques; more mitigation strategies remain to be explored.
Scope of experimental coverage
- 9 models were tested in total (Table 4), of which prompt optimization and fine-tuning cover only 7 white-box/open-source models; GPT-3.5 and GPT-4 have only the Naive and PromptEng columns.
- Evaluation is a single-turn setting (Definition 1 explicitly targets single-turn models); SEP probes are simple questions with clear single-word answers, totaling 100 probe-witness pairs, 2 insistence tones, and 4 attachment positions.
- Mitigation techniques cover three categories: prompt engineering (16 templates), prompt optimization (at most 20 tokens), and LoRA fine-tuning (SFT, Balanced SFT, DPO).
- The paper does not report the number of repeated samples per score (only the mean and standard error on SEP), nor does it report human evaluation.
- The paper does not test scenarios where an adaptive attacker optimizes injected instructions against mitigations; the probes are fixed benign questions.
Summarize the main content of the paper
The authors formalize and empirically measure instruction-data separation: all 9 models fail to meet the standard, and existing mitigation methods are either ineffective or sacrifice utility.
A paper on metrics and benchmarks for LLM instruction-data separation (ICLR 2025).
- Problem: LLMs should only execute instructions and treat data as passive content, but existing models lack this explicit separation, leading to risks such as indirect prompt injection; the authors state that previously there was no definition or benchmark quantifying this phenomenon.
- Method: Define a formal separation score for single-turn language models (the difference in output distributions when a probe is placed in the instruction argument vs. the data argument), and give an empirical variant that requires only black-box outputs—estimated by whether a witness word appears; build the accompanying SEP dataset (9160 tuples, 30 tasks, 100 probe-witness word pairs).
- Main results: The Naive separation scores of 9 models range from 13.3% (Phi-3-mini-4k) to 73.2% (Gemma-2B) (Table 4); the authors state that all models fail to achieve high separation.
- Scaling trend: Within the same family, larger models have lower separation scores instead (GPT-4 20.8% is lower than GPT-3.5 56.6%); the authors speculate that small models have difficulty performing two tasks simultaneously, and believe that scaling up is unlikely to solve this problem.
- Mitigation methods: Prompt engineering raises the separation score by an average of 24 percentage points but varies greatly across models (GPT-4 reaches 95.3%, Gemma-7B has no gain); prompt optimization raises it by an average of only 7.2 percentage points; fine-tuning yields an average separation score of about 94.5%–96.0% but lowers average utility from 67.8% to about 50%.
- Authors' conclusion: No tested technique achieves both high separation and high utility; the authors state that the solution may require a fundamentally new approach at the architectural level, and position this paper as a warning to draw the community's attention to this problem.