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.

The top 3

  1. Triple Backticks: Code & Raw Text Isolation: The '```' delimiter is ideal for clearly marking code blocks or literal text segments, instructing the LLM to treat the enclosed content as programming syntax or raw data, improving accuracy in code generation and text processing tasks.
  2. Triple Quotes: Encapsulating User Inputs & Text Blocks: Using triple quotes (''' or """) effectively isolates larger sections of text or user inputs, preventing prompt injection attacks and ensuring the LLM processes a specific block of content distinctly, such as for summarization or rephrasing tasks.
  3. Triple Hashes: Structuring Multi-Step Instructions: The '###' delimiter is highly effective for breaking down complex prompts into distinct, sequential steps or sections, particularly beneficial for 'chain-of-thought' prompting where the LLM needs to follow a logical progression to complete a task.

Sources

Open the full topic