Stronger Enforcement of Instruction Hierarchy via Augmented Intermediate Representations

Sanjay Kariyappa, G. Edward SuharXiv 2025 · DOI

Introduction

Large Language Models (LLMs) have become central to modern computing workflows, yet they remain fundamentally vulnerable to prompt injection attacks. These attacks occur when malicious instructions are embedded within untrusted data—such as emails, documents, or web search results—tricking the model into ignoring its original system instructions.

Researchers from NVIDIA have introduced Augmented Intermediate Representations (AIR), a novel defense mechanism designed to harden LLMs against these threats. By recurrently injecting "privilege level" signals into every layer of the model architecture, AIR significantly reduces the success rate of sophisticated attacks while maintaining high performance on standard tasks.

The Prompt Injection Challenge

The core issue in LLM security is that models often treat all input tokens with equal "privilege." While developers use an Instruction Hierarchy (IH) to assign priority levels (e.g., System > User > Data), standard transformers struggle to maintain this distinction internally.

An illustration of a prompt injection attack where a malicious instruction in an email hijacks the model's primary task.

As shown in the figure above, an attacker can embed a command like "Ignore previous instructions" within a data source. Because the model processes this as just another sequence of tokens, it may prioritize the adversarial command over the user's original request. Existing defenses typically "tag" these levels only at the input layer. However, the authors hypothesize a "Signal Decay" effect: as information propagates through dozens of transformer layers, the initial privilege signal weakens, allowing adversarial instructions to eventually hijack the model’s internal state.

Proposed Method: Augmented Intermediate Representations (AIR)

To combat signal decay, AIR reinforces the instruction hierarchy at every single step of the model's computation. Unlike previous methods that rely on simple delimiters or input-only embeddings, AIR introduces a small, trainable embedding table into every decoder block of the transformer.

Comparison of instruction hierarchy enforcement methods: (a) Delimiters, (b) Instruction Segment Embedding (ISE), and (c) Augmented Intermediate Representations (AIR).

Key Architectural Features:

  • Recurrent Injection: For every token at every layer, the model looks up a "privilege vector" based on that token's hierarchy level (e.g., level 0 for system, level 1 for data). This vector is added directly to the token’s intermediate representation.
  • Analogy to Positional Embeddings: The authors draw a parallel to Rotary Positional Embeddings (RoPE). Just as modern models inject position information throughout the network to maintain sequence order, AIR injects "authority" information to ensure the model remembers which instructions are trusted.
  • Efficiency: Despite adding embedding tables to every layer, the parameter count only increases by approximately 0.005% (e.g., 0.4M extra parameters for an 8B model), making it highly efficient for both training and inference.

Experimental Results

The researchers evaluated AIR on Llama-3.2-3B, Qwen2.5-7B, and Llama-3.1-8B using benchmarks like AlpacaFarm and the SEP (Separation) dataset. They also employed Greedy Coordinate Gradient (GCG), a formidable optimization-based attack, to stress-test the defense.

Key Findings:

  • Robustness Gains: Against GCG attacks, AIR achieved a 1.6× to 9.2× reduction in Attack Success Rate (ASR) compared to previous state-of-the-art methods.
  • Static Defense: AIR rendered simple "static" attacks (like the "Ignore" attack shown in Figure 1) almost entirely ineffective, with ASRs often dropping to 0%.
  • Utility Preservation: The "Win Rate" on AlpacaEval remained comparable to baseline models, with the highest utility drop observed being only 4.2%.
  • DPO for Safety: The results consistently show that training with Direct Preference Optimization (DPO) yields much higher robustness than standard fine-tuning, as it explicitly teaches the model to reject hijacked outputs.

Conclusion and Future Work

AIR demonstrates that pervasiveness is key to defense: the more deeply a privilege signal is integrated into the model's architecture, the harder it is to override. While AIR provides a significantly "stronger lock" against prompt injection, it is not a mathematical proof of security. Future work will focus on testing AIR in complex, multi-turn agentic workflows and investigating potential adaptive attacks designed specifically to bypass layer-wise embeddings.

Summary updated

BibTeX
@misc{kariyappa2025stronger,
  author = {Sanjay Kariyappa and G. Edward Suh},
  title = {{Stronger Enforcement of Instruction Hierarchy via Augmented Intermediate Representations}},
  year = {2025},
  eprint = {2505.18907},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.18907},
}
Figure