Table of Contents
In my first blog post of this three-part series about mastering prompt engineering, I spoke about its fundamentals. As I have shared earlier, Prompt Engineering is the process of designing and refining prompts, allowing us to effectively communicate with AI tools using their chat interfaces.
Let’s continue to build upon prompting fundamentals and learn more tips and tricks to master prompt engineering. It is essential to understand these tips and tricks; that’s why I have provided ample examples with every tip and trick to help you understand its usage. Let’s continue learning.
5. Utilize Relevant Keywords to Guide the AI
Think of keywords as signposts for the AI that helps create relevant results. Using specific and relevant terms helps the model understand the core topic and generate more focused responses.
- Instead of: “Tell me about animals in the jungle.”
- Try: “List five endangered primate species found in the Amazon rainforest, including their conservation status according to the IUCN.”
- Instead of: “Explain how to cook pasta.”
- Try: “Provide a detailed recipe for making classic Italian spaghetti carbonara, including specific cooking times and ingredient measurements.”
- Instead of: “What are the effects of climate change?”
- Try: “Describe the three most significant long-term effects of anthropogenic climate change on global sea levels and coastal ecosystems.”
6. Experiment with Phrases and Prompt Structures
Don’t settle for the first prompt that comes to mind. Try rephrasing your requests in different ways. Sometimes, a subtle change in wording can lead to significantly better results.
- Initial Prompt: “Write an advertisement for a new brand of coffee.”
- Alternative Prompt 1: “Create a compelling marketing copy for a new artisanal coffee brand, highlighting its unique flavor profile and ethical sourcing practices.”
- Alternative Prompt 2: “Develop a short, attention-grabbing advertisement for a new coffee brand aimed at young professionals who value sustainability.”
7. Iterately Refine Your Prompts Based on the Output
Prompt engineering is rarely a one-shot process. Analyze the AI’s response and identify areas where it falls short of your expectations. Then, adjust your prompt with more specific instructions.
- Initial Prompt: “Write a poem about nature.”
- AI Response: A generic poem about trees and flowers.
- Refined Prompt: “Write a sonnet about the feeling of walking through a misty forest at dawn, focusing on sensory details like the smell of damp earth and the sound of dripping leaves.”
8. Define the Specific Role or Persona for the AI
Instructing the AI to adopt a specific role can dramatically influence the style, tone, and perspective of the generated text. This is particularly useful for creative tasks or when you need the AI to emulate a certain type of expert. For example, you may ask the same question (say, “what is the most important factor for success?”) to people in different industries and they will give distinct answers.
- Instead of: “Explain the concept of quantum entanglement.”
- Try: “Explain the concept of quantum entanglement as if you were a friendly and approachable science communicator explaining it to a curious high school student.”
- Instead of: “Write a customer service response.”
- Try: “Act as a customer service representative for an online electronics store and respond to the following customer inquiry about a delayed order in a polite and helpful manner.”
9. Provide Examples of the Desired Output
Showing the AI examples of the type of response you are looking for can provide a clear blueprint for the model to follow. This is especially helpful when you have a specific style or format in mind.
- Instead of: “Write a product description for a new noise-canceling headphone.”
- Try: “Write a product description for a new noise-canceling headphone, following this example: `[Example Product Description highlighting comfort, battery life, and sound quality]`.”
- Instead of: “Write a short story in the style of Ernest Hemingway.”
- Try: “Write a short story about a fisherman’s solitary morning at sea along in his boat, in the concise and understated style of Ernest Hemingway.”
10. Separate Instructions and Content using Delimiters
When your prompt includes multiple instructions or incorporates external content like articles or code snippets, use delimiters to clearly separate these elements. This helps the AI understand the structure of your input. Common delimiters include triple backticks (```), quotation marks, or specific symbols. For example, in the below prompt, I am using triple backticks to pass my content to the AI.
Summarize the following article:
```
[Insert the Article Text Here]
```
Focus on the key arguments and the author's main conclusion.
With these additional tips and tricks in your toolkit, I am confident you are on track to becoming a proficient prompt engineer. In the third and final part of this series, I will delve into more advanced prompting techniques that help unlock even greater potential from AI models. Stay tuned!
References
- ChatGPT Prompt Engineering for Developers (from OpenAI) [ DeepLearning.AI (original) (archived) ]