Skip to main content
Practice

How to Use Delimiters for Structuring Prompts Clearly

If the prompt you wrote is hard for you to understand, it will be the same for AI.

To make your prompts easy to understand and help AI receive clear instructions, you can use Delimiters.

Delimiters are characters and strings (multiple characters) used to clearly separate and structure information within a prompt.

Below is an example of using the ### delimiter to structure the instruction, context, and input data of a prompt into blocks.

Using Delimiters to Separate Instructions, Context, and Input Data
### Instruction
Please summarize the news article below in one sentence.

### Context
The summarized sentence will be used as a meta tag for search engine optimization (SEO).

### Input Data
The rapid advancement of generative AI technology is driving innovative changes in the media, entertainment, and education sectors. In particular, generative AI is making strides in the fields of natural language processing and image generation...
(and so on)

Just as neatly structured text is easier to read, AI also prefers prompts where the context is clearly structured over ones that are listed in prose.


Commonly Used Delimiters

Delimiters can be used differently for each prompt and do not have set meanings.

However, there are some common delimiters used in prompt engineering and their roles are as follows.

1. [###]

Used to indicate headings within a prompt. It's mainly used to mark the start of a section or the title of a block of information.

Example Using ### Delimiter
### Request
Please formulate a marketing strategy to increase sales.

### Reference Material
- Sales figures for Q1 2022
- Sales figures for Q2 2022
...

Notably, you don't have to use 3 # symbols in a row; different numbers of # symbols can denote various levels of headings such as # (main heading), ## (subheading), and ### (sub-subheading).

Example Using Various Levels of Headings
# What is a Prompt?

## Components of a Prompt

### Instruction

### Context

2. ["""]

Used to encapsulate long quotes or information that requires special attention, and to separate context.

Double quotation marks are also used for emphasis as in "word".

Example Using Double Quotation Marks as Quotation Delimiters
Which philosopher is this quote attributed to?

"""
I think, therefore I am.
"""
Example Using Double Quotation Marks for Emphasis
Recommend "3 destinations" for overseas travel this summer.
Indicating Where to Print the Answer
Summarize the article above into one sentence.

"""Provide the summary here"""

3. [---]

Used to visually separate different parts of a prompt.

This can help make each section more distinct and the prompt more organized.

Example Using --- Delimiter
Please correct the following sentence.
---
I am glad to here that you are doing well.

Mixing Delimiters

Multiple delimiters can be used together as shown below.

Example Prompt
### Paragraph 1

"""
Here is the content for paragraph 1.
"""

---

### Paragraph 2

"""
The following is content for paragraph 2. The AI recognizes this as a separate unit.
"""

In the above prompt, ### delineates the titles of paragraphs, """ separates their contents, and --- visually distinguishes each section.


Besides these three common delimiters, you can use other delimiters depending on the purpose of the prompt.

Example Using Different Delimiters
Correct the following English sentence and explain at least two corrections.

* Sentence to be corrected: I am student who live in Korea. Who is you?

* Correction Result: <Corrected sentence>

1. <Correction detail 1>
2. <Correction detail 2>
3. [Additional correction details]

In the prompt above, *** is used to separate the sentence to be corrected, while < > is used for the corrected sentence and explanation of corrections.


XML Delimiters

You can also structure prompts using the XML format (a language for representing data hierarchy).

XML represents data hierarchy with tags (enclosed in < >) and makes prompts more organized. A start tag is expressed as <tagName>, and an end tag is </tagName>. Data within tags is expressed like <tagName>Data</tagName>.

Example Using XML Delimiters
<article>
It was announced that the US Consumer Price Index (CPI) rose by 0.4% compared to the previous month.
This is a slightly higher-than-expected figure indicating ongoing inflationary pressures and is expected to raise the possibility of a Federal Reserve rate hike.
</article>

<instructions>
1. Create a blog post title based on the article above.

2. Extract two keywords for search engine optimization.
</instructions>

<context>
The summarized sentence will be used as a meta tag for search engine optimization (SEO).
</context>

<output>
- Blog Post Title: [Blog Post Title]

- Keywords: [Keyword1], [Keyword2]
</output>

Practice

Compare responses to prompts that use structured delimiters with those that do not.

Example of a Concrete Prompt Using Delimiters
### Request
I plan to travel around New York City in one day.
Given the limited time, recommend 3 tourist attractions to visit.

---

### Response Format

[1] <Recommended Attraction 1> : <Reason for Selection>

[2] <Recommended Attraction 2> : <Reason for Selection>

[3] <Recommended Attraction 3> : <Reason for Selection>
Example of a Vague Prompt Without Delimiters
Please recommend some tourist attractions to see in New York City.