Introduction
Prompting AI models like ChatGPT can be frustrating and intimidating sometimes. You may not get what you expect and don’t know what to do.
In this tutorial, we will introduce a straightforward method for prompting: the TIRE method. Hopefully, it will give you a “tire” for your journey of learning to write effective prompts.
The TIRE Prompting Method
Here is an overview of the TIRE method. We will walk through an example task later.
“TIRE” stands for these 4 words: Task, Instruction, Refinement, and Example.
1. Task
The task refers to what we are asking the AI model to do. It should at least contain a verb and maybe also the expected result. For example:
- write a short story about a dog
- explain this question for me
- can you give me some feedback on this essay
- calculate this equation
- help me answer this question
- I’m preparing for dinner. recommend a few recipes.
It is often confusing to the AI model if you do not specify the task. For example, if you say “my teacher gave me a B on this essay”, then the AI has to guess what’s its task, which can be “explain where it needs to be improved”, “tell me how to argue with my teacher” or “can you give me your rating on my essay”.
2. Instruction
The second key component of the prompt is your instruction, which tells the AI model how to carry out the task. You can also think of this part as your specific requirements.
Why we need instructions? For a given task, there can be millions of ways for the AI to respond to it. By giving more specific instructions, we are selecting the most desirable results.
Below are some common ways to give formatting instructions:
-
Length: You can tell the AI to give a detailed or concise answer, or even specify the number of words. It will be hard for the AI to use the exact number of words, but it will be pretty close. Therefore, limiting word count is one of the most effective ways to control AI’s response length.
-
Tone: You can ask the AI to use a formal or informal tone, a casual or serious tone, a plain or technical tone, etc.
-
Output Format: Depending on the task, you can ask AI to respond in various formats, like “return the data as a table”, “give me a CSV file”, “use markdown format”, “give me bullet points”, “format your answer in 4 paragraphs”, etc.
-
AI’s Role: You can often tell AI its role, which will greatly influence how it answers, such as “Asnwer as if you are a 5th grade teacher”, “Pretend you are a corporate lawyer”, “You are a professor”, etc.
-
Your Role: You can also tell AI who you are, which is equally effective. Note that it does not have to be really who you are, but think of it as a technique to get different results from the AI. For example, you can say “I am 5-year old”, “I am retired”, “I am an expert in this topic”, etc.
Besides formatting, you can give many other types of instructions, which are highly dependent on the specific task. You can think of them as “Do-It-This-Way” or “Don’t-Do-It-That-Way” rules. Below are some examples:
- write a story about a dog. The dog must be 2 years old, has no home, enjoys eating fish and playing with rocks. I don’t like sad stories.
- summarize this article. focus on the key problem the author is addressing, and skip the discussion on the solution.
- help me solve this math problem. don’t just tell me the answer. I want to walk through it myself. Just give me some hints on the first step.
3. Refinement
After you have the task and instruction, you can start trying to use it and review the response you get. If the response is perfect, then you can stop here.
However, most of the time, you may find some issues in the response. When that happens, many people will simply think, “This AI is not smart enough,” or “This is the best I can get, so I will accept it.”
Such thoughts will leave a lot on the table. Instead, this is the time to refine your task description or instruction and keep trying until you get a high-quality answer. You should have confidence that the AI model is like a gold mine, and if you keep digging, you will discover real gold (the perfect prompt).
4. Example
Most of the time, you only need the task and the instruction, and keep refining it. However, there are times when you don’t know how to describe your requirements in words.
When this happens, you can try to provide some examples in your prompt, since AI models are very good at mimicking examples.
For example, suppose you are asking the AI to write a multiple-choice question, but you don’t know how to describe the format of the response you need. This would be a good time to provide an example for the format like this:
Give me a multiple-choice question for 6th-grade history. Use this format:
QUESTION
(The quiz question)
CHOICES
A) ...
B) ...
C) ...
D) ...
ANSWER
C
This example will make sure the AI responds in the exact format you like, which is especially useful if you plan to parse the AI response in code.
A Detailed Example - Writing a “How-To” Guide
Now let’s walk through a detailed example to illustrate how to apply the TIRE method. Suppose our task is to create a simple tool: the user can specify a goal, such as “how to become great at coding” or “how to make more friends”, and we will use AI to generate a “how-to” guide.
Step 1 - Describe the Task
Based on our TIRE method, we will start with the task. Since we will allow the user to input any goal, we need to dynamically compose the task like this:
Write a how-to guide for the following goal:
(insert user input here)
Step 2 - First Set of Instructions
Although it is tempting to just try with the task itself, we recommend that you form a habit of always giving some instructions along with the task description. In this case, suppose our target users are middle-school students, we might want to add a few instructions like this:
Write a how-to guide for the following goal:
(insert user input here)
Instructions:
1. You are talking to a middle-school student.
2. Be concise and humorous. Use no more than 200 words.
3. Reject any inappropriate topic
Notice that a header of “Instructions:” is added to tell the AI model where the instructions are clearly.
Step 3 - Try it out and evaluate the result
Now we have both the task and some initial instructions, let’s use a simple project to test it out:
play.creaticode.com/projects/679f826a69f04bc3c7cc081e
Open this project, and click “See Inside”, and you will find it only has 3 blocks:

To use it, we just need to add our prompt in the LLM block, and then click the green flag to run it. The response will be printed out in the console panel below. For example, suppose we use “how to become great at coding” as the user goal, then our prompt will look like this:

When you run it a few times, you might get a response like one of these:


Step 4 - First Refinement of the Instructions
The response above is pretty good, but we should not just stop here. Instead, we should try to identify any issues in the response, and then refine our prompt accordingly.
For example, one issue is that the AI model tends to number the bullet points from 1 to 5. This may be misleading since the bullet points are not done in a sequential order. Also, 5 points may be too many and hard to follow through in practice. To fix these issues, we can update the prompt by adding an additional instruction:

This time, you should get a response that reflects changes in our instructions pretty well:

Step 5 - Second Refinement of the Instructions
Now let’s review the response above, and see if we can improve it more. One idea is to list 3 “Do’s” and 3 “Don’ts”. This contrast often makes it easier for the user. We can refine the prompt into this:

Here is an example output:

Step 6 - Add an Example
Lastly, to precisely control the output format, we can give the AI an example format like this:
Write a how-to guide for the following goal:
how to become great at coding
Instructions:
1. You are talking to a middle-school student.
2. Be concise and humorous. Use no more than 200 words.
3. Reject any inappropriate topic
4. Give me 3 Do's and 3 Don'ts as bullet points
use this format:
3 Do's:
* Do this ... (in 10 words)
* Do this ... (in 10 words)
* Do this ... (in 10 words)
3 Don'ts
* Don't do this ... (in 10 words)
* Don't do this ... (in 10 words)
* Don't do this ... (in 10 words)
Here is what you will likely get, which matches our example format pretty well:

Practice
You have now learned the basics of the TIRE prompting method. It is very easy to understand, but it will take a lot of practice to master, especially with the continued refinement of the instructions.
For more practice, here are some tasks. Please try to compose the best prompt using the TIRE method.
-
Ask AI to write an engaging introduction to the city/state/country you live in to attract foreign visitors.
-
Ask AI to write a short science fiction that is engaging to read.
-
Ask AI to explain a hard concept that you are learning