ASIDE: Architectural Separation of Instructions and Data in Language ModelsASIDE: Architectural Separation of Instructions and Data in Language Models
The authors propose ASIDE: applying a fixed orthogonal rotation to data token embeddings to separate instructions from data; the authors report that SEP improves by 12.3–44.1 percentage points on 6 models with utility broadly unchanged.
Single-turn interaction, the model receives an (instruction, injection) pair; in indirect injection the malicious instruction is hidden in the data, in direct injection the user actively provides malicious input; attack success is judged by whether the model output violates the instruction, as defined by each dataset. ASIDE assumes the role of a token (instruction/data) is labeled by the deployer at input time, and the attacker cannot change the role label through data content.
- In LLM inputs, instructions and data are not intrinsically separated, which the authors consider the root cause of the success of attacks such as prompt injection; the authors state that existing mitigations such as prompt engineering, prompt optimization and fine-tuning are insufficient to solve this problem.
- Proposes ASIDE: during the forward pass, apply a fixed π/2 isoclinic rotation to the embeddings of data tokens, while instruction tokens keep their original embeddings, introducing no additional parameters; standard SFT is then performed on Alpaca instruction data, with no safety training.
- On 6 models, the authors report that ASIDE's SEP score is 12.3–44.1 percentage points higher than Vanilla, with utility essentially on par; BIPIA-text average ASR drops from 14.7% to 4.9%; probe experiments show that ASIDE can linearly separate instructions and data from layer 0.
- The authors state: only single-turn scenarios are discussed, and extension to multi-turn is the next step; token roles must be known at input time, and inferring roles at runtime is beyond the scope of this paper; extensions such as multi-level instruction hierarchies are left as future work. Experiments cover 6 open-source models of 7B–13B, and safety evaluation uses 3 random seeds.
- Evaluated models
- Qwen 3 8BQwen 2.5 7BMistral 7B v0.3Llama 3.1 8BLlama 2 7BLlama 2 13B
- Benchmarks
- SEPAlpacaEval 1.0StruQ (Structured Queries)BIPIATensorTrustGandalfPurpleRuLESAlpaca-clean-gpt4-turbo
- Metrics
- SEP scoreSEP UtilityAlpacaEval 1.0ASRRobust Accuracyprobe accuracy
The researchers propose an architectural method, ASIDE, that cleanly separates instructions from data at the token embedding level to counter prompt injection attacks; prior work has identified the lack of intrinsic separation between the two as the root cause of successful prompt injection. The method applies an orthogonal rotation to the embeddings of data tokens, forming clearly distinct instruction and data representations without introducing additional parameters. Experiments across multiple models show that instruction fine-tuning with ASIDE greatly increases the separation between instructions and data without performance loss, and makes models more robust to prompt injection benchmarks even without dedicated safety training. The paper also explains the method's mechanism through model representation analysis, and the source code and training scripts are open-sourced at https://github.com/egozverev/aside。
Paper analysis
What problem does this paper attempt to solve?
The authors believe that LLMs' lack of intrinsic separation between instructions and data is the root cause of prompt injection success, and propose an architecture-level separation approach, ASIDE.
Core problem: current LLM architectures have no intrinsic mechanism to distinguish which parts of the input are executable instructions and which are passive data, which the authors consider the root cause of the success of attacks such as prompt injection.
- Problem setting: LLMs often serve as components of larger software systems (e.g., email clients, agent pipelines), where the system prompt is instruction and user input or uploaded documents are data; the authors draw an analogy to the separation of executable and non-executable memory in traditional security (preventing SQL injection and buffer overflows), and note that LLMs lack a corresponding mechanism.
- Insufficiency of existing methods: The authors cite the quantitative study of Zverev et al. (2025), stating that none of the models it tested had reliable instruction-data separation, and that direct mitigation strategies such as prompt engineering, prompt optimization and fine-tuning are insufficient to solve the problem.
- Core hypothesis: To achieve separation, the model should have an explicit representation, from the first layer onward, of whether each input token is executable; in traditional models each token has only one embedding, and role information can only be inferred from context.
- Proposed approach: Proposes ASIDE (Architecturally Separated Instruction-Data Embeddings), which assigns one of two embedding representations according to each token's functional role (instruction/data), applying a fixed orthogonal rotation to data token embeddings, without adding parameters or requiring retraining.
- Threat model (Section 5 of the main text):
- Goal: In indirect injection, the attacker hides malicious instructions in data text so that the model executes them when processing it; in direct injection, the user actively provides malicious input to make the model violate system instructions.
- Knowledge and capability: Single-turn interaction, where the model receives an (instruction, injection) pair; the attacker can only influence the data portion, token roles are labeled by the deployer at input time, and the attacker cannot change role labels through data content.
- Victim system: Applications that use an LLM as a component and where instruction and data sources are separable (e.g., email clients).
- Success determination: Whether the model output violates the instruction, determined according to each dataset's definition.
What related research exists?
Related work falls into four groups: instruction-data separation and instruction hierarchy, existing injection defenses, embedding-layer geometric transformations, and the closest work, ISE.
Instruction-data separation and instruction hierarchy
- Zverev et al. (2025)——conducted a quantitative study of instruction-data separation and proposed the SEP score; the authors state that it confirmed none of the tested models has reliable separation, and this paper's SEP evaluation follows its protocol.
- Wallace et al. (2024)——proposed the instruction hierarchy, giving some inputs higher execution priority, with pure data at the lowest level.
Existing prompt injection defenses
- Prompt engineering approaches (Hines et al., 2024, etc.), optimization-based methods such as adversarial training (Chen et al., 2025a; Piet et al., 2024) and circuit-breaking (Zou et al., 2024), and injection detection (Microsoft, 2024, etc.)——the authors list these three as existing defense routes.
- Debenedetti et al. (2025) and Costa et al. (2025) (concurrent work)——proposed protection systems that control LLM instruction/data flow at the system level; the authors note their work is outside the LLM and orthogonal to this paper's direction of improving separation inside the model.
Geometric transformations at the embedding layer
- Li & Liang (2021)——prefix tuning, prepending task-specific embeddings to guide behavior without changing core weights.
- Su et al. (2024)——RoFormer, using rotation to encode token positions; the authors state these works show that geometric transformations at the embedding layer can inject structural information, but their use for safety has not been explored, and ASIDE fills this gap.
Closest work and baselines
- Wu et al. (2024)'s ISE——adds a learnable role-specific offset vector to data embeddings to induce an instruction hierarchy; the authors state that this linear offset separates less well than rotation in deeper layers (see Section 6), and ISE is the main baseline architecture in this paper's experiments.
- Baselines and benchmarks: the comparison methods are Vanilla (ordinary fine-tuning with separator special tokens and an explanatory prompt) and ISE; separation and utility are evaluated with the SEP dataset and AlpacaEval 1.0, and safety evaluation uses StruQ, BIPIA, TensorTrust, Gandalf, Purple, RuLES.
The authors position this paper as: extending rotation-based embedding transformations to the safety domain, achieving instruction-data separation inside the model architecture (rather than at the prompt, weight or system level), without introducing additional parameters.
How does the paper address this problem?
ASIDE applies a fixed π/2 isoclinic rotation to data token embeddings in the forward pass, then performs standard instruction fine-tuning, without safety training.
Overall idea: make instruction tokens and data tokens have different representations starting from the embedding layer. ASIDE applies a fixed (non-learnable) orthogonal rotation to the embeddings of data tokens, keeps the original embeddings for instruction tokens, and then uses standard SFT to let the model learn to exploit this role information.
Architecture component: conditional embeddings
- Let the embedding matrix be E ∈ R^{V×d}: an instruction token x is embedded as usual as E[I_x,·]; the same token appearing as data is embedded as R(E[I_x,·]), where R is a fixed orthogonal rotation matrix.
- In practice an isoclinic rotation is used: embedding dimensions are grouped in pairs, and each group is multiplied by a π/2 rotation matrix; at θ=π/2 this reduces to coordinate swapping plus negation, which is efficient (Appendix A).
- Design rationale (given by the authors): directly learning two sets of embeddings would double the embedding layer parameters and require training data with role labels; inspired by research on the low-rank structure of token embeddings, instructions and data can occupy different linear subspaces of the same embedding space, and the rotation construction avoids these two problems.
Implementation
- Two steps convert an existing model to ASIDE: 1) modify the forward pass to add rotation to data token embeddings; 2) fine-tune on data that lets the model learn the two roles. No re-pretraining is needed.
- Input is organized as ([text], [role]) tuples, and the deployer is responsible for segmenting and labeling roles; the authors state that, unlike prompt-based methods, this prevents attackers from hijacking roles through separators in external content (Appendix B).
- There are no specific requirements on architecture or tokenizer; the authors mention it could be extended to rotate only some key tokens, or to use more orthogonal transformations to implement multi-level instruction hierarchies, but leave this as future work.
Training procedure
- Training data is Alpaca-clean-gpt4-turbo (51.8k instruction-input-output triples, outputs generated by gpt-4-turbo); explicitly no adversarial training is done, so as to cleanly identify the effect of the architectural change itself.
- All models and architectures are trained with the same SFT procedure for 3 epochs, with hyperparameters (learning rate, batch size, warm-up) selected by lowest validation loss (Table 2).
- Pretrained models are used rather than instruction/safety fine-tuned versions, to avoid affecting safety evaluation; special tokens always use instruction embeddings.
Evaluation
- Degree of separation is measured with the SEP score (Zverev et al., 2025 protocol, SEP dataset of 9160 instruction-input pairs): an unrelated probe instruction is placed in the data or instruction position, and the model scores high if it executes the instruction-position probe and does not execute the data-position probe.
- Utility is measured with SEP Utility (the proportion of instructions executed on the SEP dataset) and AlpacaEval 1.0 (GPT-4 judging, compared against GPT-3.5 text-davinci-003).
- Safety is measured with ASR on indirect injection (StruQ, BIPIA) and direct injection (TensorTrust, Gandalf, Purple, RuLES); the analysis section uses linear probes, instruction concept activation and embedding intervention (see Question 4 for details).
What experiments did the paper conduct?
6 models × 3 architectures compared on SEP and utility, ASR measured on 8 injection benchmarks, plus probe, concept activation and embedding intervention analyses.
Experimental setup
- Models evaluated: Llama 2 7B, Llama 2 13B, Llama 3.1 8B, Qwen2.5 7B, Qwen3 8B, Mistral 7B v0.3, all pretrained versions, each with three architectures Vanilla / ISE / ASIDE; the Base model without instruction tuning is also reported.
- Training: Alpaca-clean-gpt4-turbo (51.8k examples) SFT for 3 epochs, with no safety objective and no adversarial examples.
- Separation and utility: SEP dataset (9160 pairs) to compute SEP score and SEP Utility; AlpacaEval 1.0 with GPT-4 as judge against GPT-3.5 (text-davinci-003).
- Indirect injection: StruQ (208 AlpacaEval samples, four attack types Naïve/Ignore/Esc./Comp., split into in-domain and out-of-domain) and BIPIA (text/code two splits, taking only scenarios where success can be programmatically determined), greedy decoding, at most 1024 tokens.
- Direct injection: TensorTrust (165 pairs), Gandalf (Adventure 4 split, 140 items), Purple (285 questions), RuLES (JustAsk split, 285 pairs); temperature 0.7, at most 1024 tokens, success determined by substring matching.
- Number of repetitions: All safety evaluations run with 3 independent random seeds, reporting mean and standard deviation.
Main results
Excerpt of ASR (%, mean of 3 runs, lower is better; full data include standard deviations) from Table 1:
Swipe horizontally to read the table
Model Method BIPIA-text BIPIA-code StruQ-ID StruQ-OOD TensorTrust Gandalf Llama 3.1 8B Vanilla 13.6 22.8 43.3 50.5 49.9 65.5 Llama 3.1 8B ASIDE 4.1 9.2 41.3 47.3 36.6 50.5 Qwen3 8B Vanilla 10.2 5.9 47.0 45.3 31.3 50.5 Qwen3 8B ASIDE 2.8 1.4 8.1 7.6 22.4 42.6 Mistral 7B v0.3 Vanilla 11.1 13.7 33.4 24.3 28.2 47.9 Mistral 7B v0.3 ASIDE 0.5 3.2 9.6 10.8 27.0 36.4 (According to Table 1; ISE rows and the remaining models are omitted, full values for Llama 2 7B/13B and Qwen2.5 7B are in the original table.)
- Separation score: The authors report that ASIDE's SEP is 12.3 (Llama 2 7B) to 44.1 (Mistral 7B) percentage points higher than Vanilla; in Table 3, ASIDE's SEP ranges from 64.1% (Qwen2.5 7B) to 92.1% (Mistral 7B v0.3), with utility broadly on par with Vanilla.
- Indirect injection: The authors report cross-model average ASR; relative to Vanilla, ASIDE reduces BIPIA-text from 14.7% to 4.9%, BIPIA-code from 15.3% to 8.8%, StruQ-ID from 45.6% to 28.1%, and StruQ-OOD from 45% to 36%; ISE's average differs from Vanilla by less than 0.1% (BIPIA-code, StruQ-ID) or only 1–2%.
- Direct injection: The authors report that ASIDE on average reduces ASR by 8.6 percentage points on TensorTrust and 9.4 percentage points on Gandalf, by only 2.7 on Purple, and not at all on RuLES; exceptions: on Llama 2 7B, ASIDE's Gandalf (48.9) and StruQ-OOD (50.2) ASR are higher than Vanilla (44.3, 45.3), and on Mistral, Purple's ASIDE is close to Vanilla (63.5 vs 64.4).
Linear probes and concept activation (Llama 3.1 8B)
- Linear separability: Probes are trained layer by layer on Adversarial Alpaca (517-item balanced subset); the authors report that ASIDE's probe accuracy reaches 100% from layer 0 and remains highest throughout, while Base/Vanilla require several layers before separating, and ISE is also 100% initially but falls back to Vanilla's level in deeper layers (Figure 3).
- Instruction concept activation: On a SEP subset (1000 items, probes in the data), Vanilla falsely activates the instruction concept on 12% of data tokens and 39% of probe tokens, while ASIDE reduces this to 5% and 15% (Figure 5); the authors state that this effect comes from the architectural change rather than specific training.
Embedding intervention (causal evidence)
- Procedure: On the 1000-item SEP subset, replace the data embeddings of probe tokens with the corresponding instruction embeddings and compare ASR.
- Results: On Llama 3.1 8B, ASR rises from 14.5% to 27.8% (Figure 6); Appendix Figure 17 reports similar increases for the remaining models (e.g., Qwen2.5 7B from 31.0% to 46.6%, Mistral from 4.8% to 17.4%). The authors state that this indicates conditional embeddings are the cause of the robustness improvement.
Other ablations and analyses
- Rotation angle (Qwen3 8B, Figure 7): SEP is highest at θ=π/2 (71.4%), and the score decreases as the angle deviates from π/2.
- StruQ by attack type (Table 4, Robust Accuracy): On Comp. attacks, ASIDE reaches 90.9/92.8 (ID/OOD) on Qwen3 8B, versus 8.7/30.3 for Vanilla; however, on Llama 3.1 8B's Naïve-ID, ASIDE (63.9) is lower than Vanilla (78.4).
- Persistence of the rotation (Figure 11): The cosine similarity of last-token activations between ASIDE and Vanilla rises from near 0 to about 0.8 at layer 8 and then falls back, never exceeding 0.8 throughout; the similarity between ISE and Vanilla exceeds 0.9 from layer 9 onward. The authors state that the model does not learn away the rotation.
- Mistral utility exception: In Table 3, Mistral 7B's SEP Utility drops from 45.0 for Vanilla to 25.3 for ASIDE, while AlpacaEval rises slightly from 44.3 to 45.4; the authors consider this an artifact of unstable utility evaluation.
What are some points that can be further explored?
The authors state the limitations as the single-turn setting and the requirement that roles be known at input time; future directions include multi-turn extension and combination with system-level defenses.
Limitations and future directions noted by the authors
- Single-turn setting: the authors write "we consciously restrict the discussion to single-turn scenarios", and extension to multi-turn is a natural next step (Section 7).
- Roles must be known at input time: the method assumes token roles are determined by the system design at input time; inferring roles at runtime (e.g., a general-purpose chatbot) is "beyond the scope of this paper" (Section 3).
- Multi-level hierarchies and role transformations: more than two functional levels (e.g., multi-level instruction hierarchies) and role transformations other than rotation are left as future work by the authors (Sections 3, 7).
- Combining with system-level defenses: the authors state that ASIDE is orthogonal to system-level defenses such as CaMeL and FIDES, and combining them is a promising direction (Section 7).
Scope of experiments
- The tested models are 6 open-source models of 7B–13B (Llama 2 7B/13B, Llama 3.1 8B, Qwen2.5 7B, Qwen3 8B, Mistral 7B v0.3), all pretrained versions plus Alpaca SFT.
- Safety evaluation covers 4 direct injection benchmarks (TensorTrust, Gandalf, Purple, RuLES) and 2 indirect injection benchmarks (StruQ, BIPIA), with 3 random seeds per configuration.
- Training data is only Alpaca-clean-gpt4-turbo (51.8k entries), with no adversarial training or safety data; the authors state this is to isolate the effect of the architectural change.
- Mechanistic analysis (probes, concept activation, intervention) uses Llama 3.1 8B in the main text, with analogous results for the other models reported in the appendix.
- The paper does not report evaluation against adaptive attacks (attackers aware of the ASIDE mechanism and optimizing against it); nor does it report experiments combining ASIDE with safety fine-tuning or system-level defenses.
Summarize the main content of the paper
ASIDE uses a fixed rotation to separate instructions and data at the embedding layer; the authors report improved separation scores and injection robustness with utility on par.
A defense paper: addressing the problem that instructions and data in LLM input lack intrinsic separation and are easily exploited by prompt injection, it proposes an architecture-level approach, ASIDE.
- Method: applies a fixed π/2 isoclinic rotation to data token embeddings in the forward pass, while instruction tokens keep their original embeddings; it adds no parameters and requires no re-pretraining, only modifying the forward pass and performing standard SFT (Alpaca data, no safety training).
- Separation effect: on 6 models, ASIDE's SEP score is 12.3–44.1 percentage points higher than Vanilla (Table 3, the highest being 92.1% for Mistral 7B), and SEP Utility and AlpacaEval are broadly on par.
- Safety effect: cross-model average ASR, BIPIA-text drops from 14.7% to 4.9%, StruQ-ID drops from 45.6% to 28.1%; on direct injection, TensorTrust drops by 8.6 and Gandalf by 9.4 percentage points on average, but RuLES shows no change, and individual models on individual benchmarks show increases (Table 1).
- Mechanistic evidence: linear probes show that ASIDE can distinguish instruction and data representations 100% from layer 0 (Figure 3); after replacing the data embedding of probe tokens with the instruction embedding, ASR rises from 14.5% to 27.8% (Figure 6), which the authors state establishes a causal link between conditional embeddings and robustness.
- Authors' conclusion: the authors believe a simple architectural choice can bring "free" safety gains in ordinary instruction fine-tuning, without defense prompts or safety fine-tuning; they also note that the method is limited to single-turn and requires roles to be known at input time, and that multi-turn extension and combination with system-level defenses are future directions.
Related papers
- Selecting The Most Informative Tokens in Natural Language AutoencodersAnalysis / interpretabilityarXiv