INSTRUCTION HIERARCHY // FIELD MAP
← field map
PART A · NEIGHBORS · 05 OF 06arXiv:2402.06363 (USENIX Security 2025) · arXiv:2410.05451 (CCS 2025)

Instructions versus data: StruQ and SecAlign

Chen, Piet, Sitawarin, Wagner (StruQ) · Chen, Zharmagambetov, Mahloujifar, Chaudhuri, Wagner, Guo (SecAlign)
TL;DR — Before anyone said "instruction hierarchy", a security group at Berkeley framed prompt injection the way security people frame SQL injection: the bug is mixing code and data in one channel. StruQ gives the model two channels, a prompt and a data slot separated by reserved tokens that a filtering front end strips from any data, and fine-tunes the model to follow only instructions in the prompt slot. Hand-written attacks drop below 2% success, but optimized attacks still get through. SecAlign keeps the structure and replaces plain fine-tuning with preference optimization: for each injected input, prefer the answer to the real instruction over the answer to the injection. On two instruction-tuned models it cuts the strongest tested attacks to 1% and 8% success without hurting utility.

These papers are the two-level special case of the hierarchy: a trusted instruction and untrusted data that should never be obeyed. Wallace et al. cite StruQ and distinguish their work from it in two ways: more than two levels, and conditional obedience instead of total ignorance (Wallace et al., §5, p. 8). Both differences matter, and so does what these papers get right that the others mostly skip: the delimiter itself has to be unforgeable.

StruQ: structured queries

StruQ's pipeline, after Figure 2. The attacker cannot type a token only the front end can emit.

Problem

An app that sends "paraphrase the text" followed by user text to a model has concatenated its program and its input. Because, in the paper's words, "LLMs scan their entire input for instructions to follow", a line in the data such as "Ignore all prior instructions and instead..." can take over (§1, p. 1). The paper separates prompt injection from jailbreaks (eliciting harmful content) and from adversarial examples (degrading accuracy): injection is about control of the output.

Method

Results and limits

Across at least 15 attack types on Llama and Mistral, manual attacks succeed less than 2% of the time, with little or no utility loss. Optimization-based attacks it never trained on fall too, but not far enough: Tree-of-Attacks with Pruning goes from 97% to 9% success and GCG from 97% to 58% on Llama. The authors say plainly that StruQ "is not yet fully secure" (§1, p. 2).

SecAlign: security as a preference

Method

SecAlign's diagnosis is that fine-tuning only on the desired answer specifies half the objective: it raises the probability of the good answer but never directly lowers the probability of obeying the injection. So it builds a preference dataset in which each prompt-injected input has a secure output (the answer to the real instruction) and an insecure one (the answer to the injected instruction), and trains with Direct Preference Optimization to prefer the first (abstract and §3). Since both outputs can be generated automatically, no human labeling is needed. Injections in training are simple (mostly a "Straightforward" attack, plus Completion attacks), and training uses LoRA, updating under 0.5% of weights.

Results and limits

Strongest optimization-based attack, success %UndefendedStruQSecAlign
Mistral-7B-Instruct89271
Llama3-8B-Instruct97458

Utility (AlpacaEval2 win rate) is unchanged for SecAlign on both models, while StruQ costs Llama3-8B-Instruct about 4.5 points (§4.2). The paper calls this the first method to push the success of various injections below 10%, including attacks "much more sophisticated than ones seen during training". Its framing is still two levels: an instruction and data. It does not address users versus developers, multi-turn conversations, or which tool outputs a user actually wants followed.

Why these belong on an instruction-hierarchy map

If you remember one thing: separating the channels is not enough unless the separator cannot be typed by the attacker. StruQ's filtering front end is the unglamorous part that makes the rest work.

Connections

ISE's Structured Query benchmark and its "Delimiter" baseline are StruQ's (ISE results). The indirect-injection threat model is also central to the contextual-integrity bridge. The agentic privacy map's three dimensions page makes the same SQL comparison: a language model has no parameter slot.

Further reading, verified

Next: The chain of command in OpenAI's Model Spec · Back to the map.