Best Practices in Prompt Engineering

Daniel Sontag
Connect the Bots
Published in
3 min readFeb 19, 2024

Prompt engineering is the craft of designing inputs that effectively communicate with AI models to produce desired outputs. This skill is essential for maximizing the potential of AI in various applications, from content creation to data analysis. Here are some best practices to follow, along with concrete examples to illustrate each.

1. Be Clear and Specific

Best Practice: Your prompts should be direct and unambiguous to avoid confusion and ensure the AI understands your request.

Example: If you need a summary of an article about climate change, instead of asking, „What’s this about?“ which is vague, ask, „Can you provide a 100-word summary focusing on the key points and implications of this climate change article?“

2. Provide Context

Best Practice: Giving the AI model context can greatly improve the relevance and accuracy of its responses.

Example: For a chatbot designed to assist with tech support, instead of saying, „It won’t turn on,“ provide context like, „My 2020 Dell Inspiron laptop won’t turn on even after I’ve checked the power cable and battery. What should I do next?“

3. Use Iterative Refinement

Best Practice: If the initial response from the AI isn’t satisfactory, refine your prompt by adding more details or clarifying your request.

Example: If your first prompt is „Write a poem about nature,“ and the result is too generic, you might follow up with, „Write a haiku about the tranquility of forests at dawn, focusing on the sounds and light.“

4. Leverage Keywords and Commands

Best Practice: Including specific keywords or commands that the AI model recognizes can steer the output more effectively.

Example: When using a language model for content creation, instead of saying, „I need content,“ specify the type and tone, such as, „Generate a 500-word blog post in an informative tone about indoor gardening tips for beginners.“

5. Adjust Complexity Based on the Audience

Best Practice: Tailor the complexity of your prompt and desired output to suit the intended audience’s expertise level.

Example: For a general audience, you might ask, „Explain how photosynthesis works in simple terms.“ For a more scientific audience, the prompt could be, „Detail the chemical processes involved in photosynthesis, including the light-dependent reactions and the Calvin cycle.“

6. Incorporate Examples

Best Practice: Including examples in your prompt can guide the AI towards the style or format you’re aiming for.

Example: If you’re looking for market analysis, you might say, „Provide a market analysis similar to the one in Forbes’ article on emerging technologies, focusing on key growth sectors and investment trends for 2023.“

7. Anticipate Misinterpretations

Best Practice: Consider how your prompt might be misinterpreted and clarify as needed to avoid undesired outputs.

Example: Instead of asking, „How do I start a fire?“ which could be dangerous or misinterpreted, specify the context, „What are safe and legal ways to start a fire for a camping trip, using minimal equipment?“

8. Test and Learn

Best Practice: Experiment with different prompts to understand how slight variations can affect the output, and learn from the results to improve future interactions.

Example: If you’re using an AI for recipe suggestions, try different prompts like, „Suggest a vegetarian dinner recipe under 30 minutes“ versus „What’s a quick and easy vegetarian recipe for dinner?“ to see which yields better results.

Conclusion

Effective prompt engineering involves a blend of clarity, specificity, context, and adaptability. By following these best practices and learning from examples, you can enhance your interactions with AI models, leading to more accurate, relevant, and creative outcomes. Whether you’re generating content, analyzing data, or seeking specific information, the way you communicate your needs to the AI can make all the difference.

– – –

sontag.me

--

--

Daniel Sontag
Connect the Bots

AI Manager / Trainer / Consultant for Digital Acceleration (DX) 🚀