5. How to prompt an AI tool
What is prompting?
Prompts are the input instructions for AI tools to perform tasks. They can include text, data (such as tables) or images.
The input of a prompt is converted into tokens by the AI tool. Tokens represent the prompt elements converted into a form that the tool understands. These are processed and converted back into words or other outputs. The tool prompt length is limited by the number of tokens allowed to be input.
The University of Sydney’s AI in Education offers many examples prompts if you need more ideas.
Components of a good prompt
The more specific your prompt details are, the more relevant your output will be. Provide plenty of details, and define the task and the output you want.
Prompting tips
- Use instructional verbs: summarise, classify, write, and compose.
- Expand on prompts iteratively — your first go doesn’t have to be perfect!
- Write short but detailed prompts. Break down your tasks into a subtask list if needed.
- Tell the AI what to do rather than tell it what not to do. Negative prompts can be useful in image generators.
Read Please Be Polite to ChatGPT on why being polite to your chatbot makes for better responses.
Types of easy prompts
Simple prompts
A simple prompt or zero-shot prompt relies on the LLM training data to answer a question without any examples.
- Provide a list of ten ideas for a report on housing issues in Australia.
- Write a poem about The University of Queensland.
Few-shot prompting
Few-shot prompting provides examples of how a task is to be solved. It is used to provide guidance for the required output. An easy example is a sentiment analysis.
Input:
Here are a few examples of movie reviews and what sentiment they have:
- Review: “This movie was absolutely fantastic! I loved every minute of it.”
- Sentiment: Positive
- Review: “The plot was confusing and the acting was terrible. What a waste of time.”
- Sentiment: Negative
- Review: “It was okay. Not great, not terrible, just average.”
- Sentiment: Neutral
Now, classify the sentiment of this review: “The special effects were amazing, but the story was predictable and the characters were flat.”
Output:
Chain-of-thought prompting
Chain-of-thought prompting is a technique in which the model is encouraged to provide reasoning for its answer in a series of logical steps to solve a problem provided it initially got wrong in its output. It also increases the transparency of the answer and prompts users to use critical thinking when evaluating the responses.
Input:
Yes or no: would a pear sink in water? Provide a reasoning for your answer in logical steps before providing an answer.
Output:
Watch Four Methods of Prompt Engineering (YouTube, 12m 41s) by IBM Technology: