Most Robust Delimiter Formats for LLM Safety
Top delimiter formats for LLM security include triple backticks (```), triple quotes ("""), pipes (|||), dashes (---), and XML tags (<tag></tag>), with XML and JSON providing marginally more robust boundaries for security-sensitive systems.
The top 3
- Leading Delimiter Formats for LLM Safety: Triple backticks (```), triple hashes (###), and XML-like tags (<tag>...</tag>) are highly recommended for robust LLM safety, providing clear boundaries for instructions and content, especially for structured data or code blocks. These multi-character delimiters are less ambiguous and more effective than single characters.
- Unique Tags: The Ultimate Prompt Injection Shield: Custom, unique alphanumeric tags (e.g., `<user_input_12345>`) or model-specific tokens (like Llama 3's `<|start_header_id|>`) offer superior protection against prompt injection. These highly distinct boundaries ensure LLMs correctly interpret trusted system instructions versus external user input, significantly increasing defense rates.
- Key Practices for Maximizing Delimiter Effectiveness: Beyond the specific characters, robust delimiter usage hinges on consistency, clearly defining their meaning at the prompt's start, and avoiding excessive nesting. These practices ensure LLMs accurately parse distinct sections, reducing ambiguity and enhancing overall prompt understanding and security against manipulation.
Sources
Open the full topic