AI - The T.I.R.E. Prompting Method (Difficulty: 3)
-
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 is simply what you want the AI to do. It usually starts with a verb and may include the result you expect. For example:- Write a short story about a dog
- Explain this question for me
- Give me some feedback on this essay
- Calculate this equation
- Answer this question
- Recommend a few recipes.
If you don’t clearly tell the AI what you want, it has to guess, and it might guess wrong. 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 the essary needs to be improved”, “how to argue with my teacher” or “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 do we need instructions? While an AI may grasp what needs to be done, there are still countless ways of how it could be done. Instructions help you get the style and details you need.
Below are some common ways to give 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.
There are many other types of instructions, which are highly dependent on the specific task. You can write them in the format of “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 tell me the answer directly. I want to walk through it myself. Just give me some hints on the first step.
Task + Instruction Examples
In many situations, you might find that “task + instruction” is all that you need to get a good response. Below are some more examples of them. Try to identify which part is the task and which part is the instruction.
-
Example 1
Write a short story about a dog character that learned how to fly an airplane. -
Example 2
You are teaching me how to make salads. Give me instructions step by step, and keep it slow. Don’t give me too many numbers. -
Example 3
I’m taking a physics class and I need you to help me understand friction better. Can you explain to me like I’m 10 years old? I hate complex equations. -
Example 4
Translate the article below into Spanish. Make sure you use simple words, but don’t change the meaning of the original:
<The content of the article…>
Now give me the translation and say nothing else. -
Example 5
Let’s play a word game. You think of a secret word and I’ll guess. I can ask for hints, but you should never give me the answer directly. -
Example 6
You are General Eisenhower. Describe what you did during the Normandy Landings on D-day. Include all details, and write it like a friction. Keep it interesting.
3. Refinement
After you have the task and instructions, you can start using them to get an initial response. 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 response. Think of the AI as a gold mine—keep digging, and you’ll strike gold (the perfect prompt).
4. Example
Most of the time, you only need the task and the instructions, and keep refining them. 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 following examples.
For instance, 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 ensures the AI responds in the exact format we prefer, which is especially useful if we plan to parse the AI response in code. It will be much harder to explain such a format in words, right?
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 that allows the user to specify a goal, such as “becoming great at coding” or “making 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 insert the user goal like this:
Write a how-to guide for the following goal: (insert user input here)
Step 2 - First Set of Instructions
Next, 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
Step 3 - Test and Evaluate
Now we have both the task and some initial instructions, let’s write a simple program 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:
If you run it a few times, you might get responses like these:
Step 4 - First Refinement of the Instructions
The responses above are pretty good, but we should not 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 actions may not have to be done in the given order. Also, 5 points may be too many. 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 further. 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. You can still use the same project for testing your prompts: play.creaticode.com/projects/679f826a69f04bc3c7cc081e
Please try to compose the best prompt using the TIRE method. Feel free to provide more details to make it fun.
-
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 story that is engaging to read.
-
Ask AI to explain a complex concept that you are learning
-
info-creaticode