In artificial intelligence and generative AI, mastering the art of prompts has become essential to unlock the full potential of these powerful technologies. Prompts serve as the guiding force that directs AI models to generate specific types of content or responses.
OpenAI models generate responses to natural language queries using prompts. The quality of the responses depends on how well the prompt is written. The performance of the OpenAI models can be optimized by using different techniques in the prompts to get more accurate and relevant responses.
Provide Clear Instructions
Be as descriptive as possible to get desired results which will help the model to generate responses that clearly align with your requirement.
The below prompt without clear instructions gives a very generic product description for a new water bottle.
Prompt: Write a product description for a new water bottle Response: "Presenting the newest addition to our lineup - the innovative and eco-friendly water bottle. Crafted from high-quality, BPA-free materials, this bottle is designed to keep your beverages at the perfect temperature for hours. Its sleek and stylish design makes it the perfect accessory for any outdoor activity or workout session. With its convenient carrying handle and spill-proof lid, you can take it with you wherever you go, without worrying about spills or leaks. Moreover, its simple design ensures that you can use it repeatedly, making it the perfect choice for anyone looking for a reliable and sustainable water bottle."
But the prompt here with clear instructions generates a precise response based on the instructions.
Prompt: "Write a product description for a new water bottle that is 100% recycled. Be sure to include write a product description for a new water bottle that is 100% recycled. Be sure to include comes in natural colors with no dyes, and each purchase removes 10 pounds of plastic from our oceans" Generative AI: "Presenting our newest water bottle, the ideal choice for the environment-conscious consumer. Crafted purely from 100% recycled materials and available in natural colors without artificial dyes, this bottle is not only stylish but also sustainable. Each purchase of this bottle eliminates 10 pounds of plastic from our oceans, making it a responsible choice for those who care about the environment. Its durable and spill-proof design makes it perfect for outdoor activities, while its easy-to-carry handle makes it convenient to take on the go. Join us in our mission to eliminate plastic waste and adapt to this eco-friendly water bottle for your daily hydration needs."
Format of Instructions
Giving precise instructions while constructing a prompt is crucial because instructions can impact how the model interprets the prompt. Recency bias can affect models, where information located toward the end of the prompt can have more influence on the output than information at the beginning. Repeating your instructions at the end of the prompt may improve the model responses.
Use Section Markers
A specific technique for formatting instructions is to split the instructions at the beginning or end of the prompt and have the user content contained within — or ### blocks. These tags allow the model to differentiate between instructions and content more clearly.
Prompt: Translate the text into French --- What is your name? ---
Primary, Supporting, and Grounding Content
It includes content in the prompt that can provide greater accuracy. This content can be thought of in two ways: primary and supporting content.
Primary Content: Content subject to the query, such as translating the text or summarizing the article. It is usually added at the start or end of the prompt with clear instructions.
In the below example, content within “—“ is the primary content with the instructions at the end of the prompt.
Prompt: --- <insert full article here, as primary content> --- Create summary for this article and identify three takeaways in a bulleted list
Supporting Content: Content that may alter the response but isn’t the focus or subject of the prompt. This allows the model to respond more completely and accurately by including the desired information in the response.
In the below example, email is the primary content, and extracting the key points from the email is the supporting content.
Prompt: --- <insert full email here, as primary content> --- <the next line is the supporting content> Topics I'm very interested in: AI, itinerary, activities Share the key points from the above email, and put them in a list:
Grounding Content: Helps the model to provide reliable answers by providing content to draw answers from. It could be an essay, article, company FAQ document, or any information on which the model was trained.
For example, the model can respond with the information given “unpublished paper on the history of AI”.
Prompt: --- <insert an article on the AI here, as grounding content> --- What year did the field of AI start?
Cues
Cues are leading words for the model to help shape the response in the right direction. Often, they are used with instructions but not always.
To generate the SQL query, add a beginning of the query (SELECT) along with the instructions.
Prompt: Write a query to list all customer names who live in New York City SELECT
The model response will pick up where the prompt was left off, continuing in SQL even when no clear instruction was given for a specific language.
Conclusion
Using prompts effectively can guide the responses of generative AI models, allowing us to control the tone, style, and context of the text generated. By formulating clear and specific prompts, we can leverage the model’s capabilities to produce text that closely mimics human-like responses tailored to particular requirements. Nevertheless, it is crucial to acknowledge the limitations of the model and approach its output with caution when interpreting the results.