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:
- Review: "The special effects were amazing, but the story was predictable and the characters were flat".
- Sentiment: Mixed.
- Reasoning: The review contains both positive and negative aspects. While it praises the special effects, it criticizes the story and characters. This balance of contrasting opinions classifies it as a mixed sentiment.
[Prompted 29 November 2024, OpenAI (2024), ChatGPT 4.0 response on topic]
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:
- Density determines floating or sinking:
An object floats in water if its density is less than that of water (approximately 1 g/cm³). If the object’s density is greater, it sinks. - Examining a pear’s composition:
A pear is composed of water, sugars, fibers, and air pockets within its cellular structure. The presence of air pockets lowers its overall density compared to water. - Considering variations in pears:
While most pears have a density less than water, factors like ripeness, water content, or damage can affect buoyancy. Overripe or denser pears might sink.
Answer: No, a pear would not sink in water under normal conditions. It generally floats because its density is slightly less than water.
[Prompted 29 November 2024, OpenAI (2024), ChatGPT 4.0 response on topic]
Source: Artificial Intelligence Copyright © 2023 by The University of Queensland, https://uq.pressbooks.pub/digital-essentials-artificial-intelligence/chapter/5-how-to-prompt-an-ai-tool/ This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 License.