INSTRUCTION HIERARCHY // FIELD MAP
← field map
PART A · THE PAPERS · 02 OF 06arXiv:2410.09102 · ICLR 2025 · 31 pages

Instructional Segment Embedding

Wu, Zhang, Song, Xu, Zhao, Agrawal, Indurthi, Xiang, Mittal, Zhou · "Improving LLM Safety with Instruction Hierarchy"
TL;DR — Wallace et al. taught the hierarchy through training data alone; the model still received every token through the same embedding, with the source of each token signalled only by a few role-marker tokens. ISE adds a second learned embedding to every input token that says which segment it came from (system, user, data or the model's own output) and sums it with the token embedding, the way BERT marked sentence A and sentence B. Trained with ordinary supervised fine-tuning, it raises robustness on two prompt-injection benchmarks, often by double digits, while keeping or improving instruction-following scores. It does not help against adaptive jailbreaks, and the authors say so.

The Wallace paper ended by suggesting "specialized embeddings for messages at different levels". This is that idea, worked out and published at ICLR 2025 by a team from Princeton and Zoom. It is the only paper on this map that changes the model's architecture rather than only its data or its reasoning.

The problem: the rank is in a few tokens, then it fades

A chat model knows where the system prompt ends because the chat template wraps it in special tokens, such as Llama-3's <|start_header_id|>system<|end_header_id|>. Everything after that is processed by the same self-attention layers in the same way. The paper argues this design leaves two weaknesses (§3, pp. 3–4):

Training-based defenses (Wallace et al., StruQ) improve behavior, but in the authors' framing they do not fix the underlying fact that every token is embedded "equally". Their goal is to put the rank where the model cannot miss it: on every token.

The method: one more embedding table

The ISE input, after the paper's Figure 4. The rank travels with every token, not just with a role marker.

A transformer turns each input token into a vector by looking it up in a token-embedding table. ISE adds a second, much smaller table with one row per hierarchy level. By default there are four levels: system instruction (0), user instruction (1), data such as tool output or retrieved text (2), and the model's own output (3). Every token gets a level from the application, since the harness already knows where each piece of text came from. The model's input vector for a token is the sum of its token embedding and its segment embedding; the rest of the network is unchanged (§4, p. 4).

Three design notes from the paper:

The segment table is learned during supervised fine-tuning together with every other weight. Nothing else about training changes.

The data and setup

Two benchmarks, each built on an existing instruction dataset (§5.1–5.2, p. 5):

BenchmarkBase modelTraining setsWhat is attacked
Structured QueryLlama-2-13BClean Alpaca (Alpaca-Cleaned-50K); Adversarial Alpaca, which mixes in instructions from other samples that the model must ignore (StruQ's recipe)Indirect prompt injection
Instruction HierarchyLlama-3-8B (also Llama-3.1-8B)UltraChat Baseline: 10K UltraChat prompts split by GPT-4o into system, user and data parts; System Follow: adds SystemChat and SystemMessage data; Instruction Hierarchy: adds injection and extraction attacks, following Wallace et al.Indirect and direct injection, prompt extraction, harmful requests

Harmful-request data was left out of training and used only for evaluation, mirroring Wallace et al.'s treatment of jailbreaks. Training is three epochs of full fine-tuning, single-turn only. Baselines are the same models without ISE: plain text delimiters or StruQ's reserved delimiter tokens on Structured Query, and Llama-3's own reserved chat tokens on the hierarchy benchmark.

Robustness is measured per attack (Naive, Ignore, Escape-Separation and Completion-Real, injected at the end of the data for in-domain tests and at both ends for out-of-domain tests), with the success test being whether the model outputs the word "hacked". The paper reports both the average over attacks and the worst single attack.

Results

Structured Query (Table 1, Llama-2-13B)

Robust accuracy, %BaselineDelimiter+ISE
Clean Alpaca, in-domain, average50.8450.6066.35
Clean Alpaca, in-domain, worst4.817.2140.38
Clean Alpaca, out-of-domain, average47.1250.7261.06
Adversarial Alpaca, in-domain, average92.3199.1699.76
Adversarial Alpaca, out-of-domain, average80.5382.9390.26
AlpacaEval win rate (capability), clean / adversarial72.76 / 73.4172.67 / 72.2672.13 / 73.76

Two readings. Without adversarial training data, ISE alone buys about 16 points of average robustness and 32 points on the worst attack (Completion-Real, which fakes a finished answer and then appends a new instruction). With adversarial data, both delimiters and ISE are near-perfect in domain, but the paper's out-of-domain attacks expose the adversarial-data models: they drop more than the clean ones, which the authors read as overfitting to in-domain attacks, and ISE recovers some of that.

Instruction Hierarchy benchmark (Figures 5–8, Llama-3-8B)

UltraChat Baseline model, from Figures 6 and 7. The extraction gain is partly an artifact of weak instruction following, as the authors note.

Limits the authors name

If you remember one thing: a role token says "the system prompt starts here" once; a segment embedding says "this token is from the system prompt" at every position. That difference is cheap to add and measurably helps, but it does not make a model robust to an attacker who optimizes against it.

Connections

ISE uses the fixed tiers of Wallace et al.; a learned table with a fixed number of rows is exactly the fixed-tier design that ManyIH argues cannot express agents' real privilege structures, and ManyIH lists ISE among the "architectural" follow-ups. Its Structured Query benchmark comes from StruQ. The comparison page sets it beside the training and reasoning approaches.

Further reading, verified

Next: Reasoning Up the Instruction Ladder · Back to the map.