Course contentsShow
← Machine Learning and Deep Learning
Lesson 1845 of 3,53839. Prompt Engineering FundamentalsFree lesson

Delimiters and Formatting Markers

Employ delimiters like triple quotes, XML tags, or special tokens to clearly separate prompt sections.

Delimiters and Formatting Markers

What You'll Learn

You'll learn how to use special characters and markers to clearly separate different sections of your prompt, making it easier for language models to understand what you want.

The Core Idea

When crafting prompts for LLMs, ambiguity is your enemy. Without clear boundaries, the model might confuse instructions with examples, or context with the actual task. Delimiters are special characters or sequences that act as visual "fences" to separate prompt components.

Think of delimiters like punctuation in a sentence—they tell the reader (or model) where one idea ends and another begins. Without them, everything runs together and meaning gets lost.

Common Delimiter Patterns

Triple Quotes (""" or '''): Often used to wrap user input or data to process:

Summarize the following text:
"""
[User's long text here]
"""

XML-Style Tags: Provide semantic meaning to sections:

<instruction>Translate to French</instruction>
<input>Hello world</input>

Special Tokens: Using markers like ###, ---, or ===:

### Instruction ###
Extract all dates

### Text ###
The meeting is on March 15th

Why They Matter

Delimiters prevent injection attacks (where user input looks like instructions), reduce ambiguity in complex prompts, and help models understand structure. They're especially crucial when your prompt includes multiple examples, variable user content, or nested information.

Key Takeaway: Delimiters act as structural boundaries in prompts—use triple quotes, XML tags, or special tokens to clearly separate instructions, context, examples, and user input, preventing confusion and improving model performance.