How to create good prompts
Prompt engineering is designing and refining prompts to effectively guide generative AI models in producing desired outputs (in the same way, it is the core business of GAIA). With the advent of powerful language models like GPT-3 and its successors, crafting precise and effective prompts has become crucial, not to say it is now a new job role. Good prompts can significantly enhance the quality and relevance of AI-generated content, making them an essential tool for users across various domains.
Critical Concepts in Prompt Engineering
Understanding the Model's Capabilities
Model Scope: Knowing the AI model's strengths and limitations helps set realistic output expectations.
Training Data: Understanding the type of data the model was trained on can help frame prompts that align with the model’s expertise.
Clarity and Specificity
Clear Instructions: Providing clear and specific instructions in your prompts helps the model understand precisely what you want.
Contextual Information: Including relevant context can improve the model’s ability to generate accurate and appropriate responses.
Iterative Refinement
Trial and Error: Experimenting with different prompts and refining them based on the outputs can lead to more effective prompt designs.
Feedback Loops: Using feedback from the generated outputs to iteratively adjust and improve the prompts.
Steps to Create Good Prompts
Define the Objective
Purpose: Clearly define the purpose of the prompt. What do you want AI to generate or accomplish?
Outcome: Consider the desired result and how the generated content will be used.
Craft the Initial Prompt
Direct Requests: Start with a straightforward prompt clearly stating the task.
Example: "Write a short story about a courageous knight."
Detailed Descriptions: Provide detailed descriptions if the task is complex.
Example: "Write a short story about a courageous knight who saves a village from a dragon, focusing on the knight’s bravery and the villagers' gratitude."
Include Examples (Few-Shot Learning)
Provide Examples: Including examples in your prompt can help the model understand the desired format and style.
Example: "Write a short story about a courageous knight. For example, 'Once upon a time, a knight known for bravery lived in a distant kingdom. One day, a dragon threatened the village, and the knight...'"
Iterate and Refine
Evaluate Outputs: Analyze the generated outputs to see if they meet your expectations.
Adjust Prompts: Modify the prompt to correct issues or enhance the relevance and quality of the responses.
Example: If the initial output lacks detail, refine the prompt to ask for more specific elements: "Write a short story about a courageous knight who saves a village from a dragon. Include descriptions of the knight’s armour, the dragon’s appearance, and the villagers' celebration."
Use Constraints and Guidelines
Set Constraints: Providing constraints can help guide the model more precisely.
Example: "Write a short story about a courageous knight who saves a village from a dragon. The story should be 300 words long and include a dialogue between the knight and the village chief."
Guidelines: Offer guidelines to steer the style and tone of the output.
Example: "Write a short story about a courageous knight who saves a village from a dragon. Use a formal tone and include vivid descriptions."
Examples of Effective Prompts
Content Generation
Prompt: "Generate a blog post about the benefits of renewable energy, including three key advantages and real-world examples."
Expected Output: A well-structured blog post that outlines the benefits of renewable energy, supported by examples.
Customer Service
Prompt: "Create a response to a customer inquiry about delayed shipping, apologizing for the delay and providing an estimated delivery date."
Expected Output: A polite and professional response addressing the customer’s concern and offering a solution.
Coding Assistance
Prompt: "Write a Python function that takes a list of numbers and returns the list sorted in ascending order."
Expected Output: A correctly implemented Python function with appropriate comments and error handling.
Advanced Techniques in Prompt Engineering
Chaining Prompts
Sequential Prompts: Break down complex tasks into minor, manageable prompts.
Example: First prompt: "List the key features of renewable energy." Second prompt: "Expand on each feature listed in the previous response with detailed explanations."
Prompt Tuning
Customized Prompts: Fine-tune prompts based on specific requirements or user feedback.
Example: "Generate a product description for a new smartphone, highlighting its innovative features and sleek design."
Using Pre-trained Prompts
Templates: Utilize pre-trained prompt templates optimized for specific tasks.
Example: Using a template for writing formal letters or generating code snippets.
Effective, prompt engineering is essential for harnessing the full potential of generative AI models. By understanding the model’s capabilities, crafting clear and specific prompts, and iteratively refining them, users can significantly enhance the quality and relevance of AI-generated outputs. The following sub-chapter will explore example projects and code snippets, providing practical insights into implementing generative AI in various applications.
Something to consider is the necessity of testing, testing, and testing the model, the inputs, and the outputs. You can easily find dozens of recommendations and tricks for prompt creation online. Still, testing, learning, and implementing feedback will always be relevant to achieving better results.

