Structural Fortification: Context Isolation & Delimiters

A more robust pre-response defense separates system instructions from user input using explicit structural boundaries, such as `<Untrusted>` tags. Google's Spotlight research demonstrated that even simple delimiters significantly reduce prompt injection success rates.

The top 3

  1. Top 3 Delimiters for LLM Prompt Structure: Triple quotes ("""), triple hyphens (---), and backticks (```) are commonly employed delimiters to clearly separate distinct sections like user input or code within LLM prompts, enhancing parsing accuracy and reducing ambiguity. XML-like tags (<tag> </tag>) also serve as effective markers for context boundaries.
  2. Essential Context Isolation Principles for Secure LLMs: A foundational defense against prompt injection involves structurally separating system-level instructions from user input. Major LLM APIs offer distinct parameters for system prompts and user messages, preventing the dilution of critical instructions by untrusted user data.
  3. Delimiters' Proven Impact on Prompt Injection Defense: Delimiters significantly enhance prompt injection defense, with some LLMs showing a notable increase in defense rates, for example, from 36.6% to 100% for Gemini 2.5 Flash when untrusted content is properly delimited. While not a complete solution, they markedly improve the model's ability to differentiate instructions from data, leading to more predictable and secure outputs.

Sources

Open the full topic