How to Write a Good AI Prompt?

Unleash AI's full potential with an effective formulation of your question. Whether you're experienced or a beginner, this article will help you turn vague ideas into precise, executable input questions for AI (prompts). Ready to elevate your AI interactions to the next level? Discover how AI can really shine.

how to write a good ai prompt

2 July 2024 11-minute read

What is an AI Prompt?

An AI prompt is an input, query, or command given to an artificial intelligence (AI) model to generate a specific response or output. This input can take various forms, such as questions, commands, text snippets, or code examples. An AI prompt provides the model, particularly a large language model, with sufficient context and information to generate an appropriate and coherent answer based on what it has learnt from the patterns in its training data.

Common types of AI prompts include:

  • Text-based prompts: For generating written content.
  • Image-based prompts: For creating images or describing visual elements.
  • Code-based prompts: For programming assistance and code generation.

Why Good Prompt Design Matter

Good AI input is crucial for several reasons:

  • Precision and relevance: Good prompts ensure the AI generates responses that are accurate and pertinent to the user's needs. Specific prompts lead to more focused and useful responses from the AI model.
  • Efficiency: Well-crafted prompts save time and resources by minimising the need for back-and-forth interactions. Clear input helps the AI understand the user's intent quickly.
  • Creativity and exploration: In creative fields, prompts encourage experimentation and exploration, providing structure that can spark new ideas.
  • Learning and skill development: In educational contexts, prompts help students focus on specific tasks and practice retrieval, enhancing learning.
  • Customisation and personalisation: Tailored prompts cater to individual preferences and goals, enhancing user satisfaction.
  • Safety and security: Clear and positive instructions mitigate the risk of AI generating harmful or undesirable content.
“The AI's output is only as good as your prompt.”

Elements of a Good Prompt

When crafting an effective AI prompt, these best practices come into play:

  • Clarity and specificity: Be clear and specific about what you want the AI to do. Vague prompts lead to vague responses. Provide details and context to get precise outputs.
  • Role or persona: Ask the AI to assume a specific role or persona (e.g., act as an expert in computer science). This helps generate more accurate and relevant responses.
  • Task definition: Clearly outline the task or objective you want the AI to accomplish. Be explicit about what you want the output to be.
  • Context and background: Provide relevant context or background information to help the AI understand the full scope of your request. This includes specifying the audience, setting, or any constraints.
  • Output format: Specify the desired format for the response (e.g., bullet points, paragraphs, table). This helps the AI generate content that meets your structural needs.
  • Tone and audience: Indicate the appropriate tone and target audience for the response to ensure the AI's output matches your expectations.
  • Length or scope: Specify the desired length or scope of the response (e.g., in 2-3 paragraphs or list 5 key points).
  • Examples: Provide examples of the type of response you're looking for. This can guide the AI to produce outputs that align with your expectations.
  • Constraints or requirements: Mention any specific constraints, requirements, or parameters the AI should follow to ensure the output meets your needs.
  • Follow-up instructions: Include instructions for refining or iterating on the initial output if needed. This helps in fine-tuning the results to better suit your requirements.
Table 1. Comparison of good and bad user interaction with AI
Element Good Example Prompt Bad Example Prompt
Clarity and specificity Explain the impact of AI on healthcare in the last five years. Tell me about AI.
Role or persona Act as an expert in computer science and explain quantum computing. Explain quantum computing.
Task definition Write a summary of recent AI advancements. Talk about AI.
Context and background For a healthcare blog, discuss AI advancements. Discuss AI advancements.
Output format Provide the response in bullet points. Write about it.
Tone and audience Write in a formal tone for a professional audience. Explain it.
Length or scope List 5 key points. Tell me more.
Examples Here is an example of a good response... Give an example.
Constraints or requirements Avoid using technical jargon. Write it.
Follow-up instructions Revise the summary to include recent data. Fix it.

8 Steps for Effective AI Communication

  1. Be specific and clear: Provide detailed instructions about what you want the AI to do. Avoid vague or ambiguous language.
  2. Provide context: Give relevant background information or examples to help the AI understand the full scope of your request.
  3. Specify the audience and tone: Indicate who the content is for and what tone or style you want (e.g., professional, casual, or technical).
  4. Define the desired output format: Specify the structure, style, or format you want for the response (e.g., bullet points, paragraphs, word count).
  5. Break down complex tasks: For intricate requests, divide them into smaller, more manageable sub-tasks.
  6. Leverage examples: Provide sample responses or demonstrate the type of output you're looking for.
  7. Experiment and iterate: Refine your prompts based on the initial outputs you receive. Don't be afraid to try different approaches.
  8. Have the model evaluate your prompt: If your prompt isn't generating the expected responses, ask the model for improvement advice. Utilise the model's expertise to refine your AI-input.

Example: AI Prompt Optimisation

Poor prompt: Tell me about AI.

Improved Prompt Step-by-Step

  1. Be specific and clear: Explain the impact of AI on healthcare.
  2. Provide context: Explain the impact of AI on healthcare over the past five years.
  3. Specify the audience and tone: Explain the impact of AI on healthcare over the past five years in a formal tone suitable for a professional audience.
  4. Define the desired output format: Explain the impact of AI on healthcare over the past five years in a formal tone suitable for a professional audience. Provide the response in bullet points.
  5. Break down complex tasks: Explain the impact of AI on healthcare over the past five years in a formal tone suitable for a professional audience. Break down the response into sections: diagnostic tools, patient care, and administrative efficiency. Provide each section in bullet points.
  6. Leverage examples: Explain the impact of AI on healthcare over the past five years in a formal tone suitable for a professional audience. Break down the response into sections: diagnostic tools, patient care, and administrative efficiency. Provide each section in bullet points. For example, discuss how AI has improved diagnostic accuracy with specific technologies like machine learning algorithms in radiology.
  7. Experiment and iterate:
    1. First iteration: Explain the impact of AI on healthcare over the past five years in a formal tone suitable for a professional audience. Break down the response into sections: diagnostic tools, patient care, and administrative efficiency. Provide each section in bullet points. For example, discuss how AI has improved diagnostic accuracy with specific technologies like machine learning algorithms in radiology.
    2. Feedback: The response is informative but too brief. More examples and details would improve the depth of the answer.
    3. Improved prompt: Explain the impact of AI on healthcare over the past five years in a formal tone suitable for a professional audience. Break down the response into sections: diagnostic tools, patient care, and administrative efficiency. Provide each section in bullet points and include at least two specific examples for each section. For instance, discuss how AI has improved diagnostic accuracy with machine learning algorithms in radiology and pathology, and how AI chatbots have enhanced patient care by providing 24/7 support.
  8. Have the model evaluate your prompt: The prompt is generally good and clear, but minor adjustments can help make the instructions even clearer and more formal.

Final prompt: Explain the impact of artificial intelligence (AI) on healthcare over the past five years, Use a formal tone suitable for a professional audience. Break down the response into the following sections:
- Diagnostic tools: Provide at least two specific examples of how AI has enhanced the accuracy of diagnostic tools, such as machine learning algorithms in radiology and pathology.
- Patient care: Describe at least two ways in which AI has improved patient care, for instance through AI chatbots offering 24/7 support.
- Administrative efficiency: Outline at least two methods by which AI has streamlined administrative processes in healthcare.

By following these steps, you can transform a vague prompt into a detailed, context-rich request that yields high-quality, relevant responses from the AI.

Common Mistakes

  • Overloading with unnecessary details: While context is important, including too many irrelevant details can overwhelm the AI and dilute the quality of the response. Focus on providing essential information.
  • Using one-line prompts: Simple, short, one-line commands often don't provide enough guidance. Use more structured prompts with clear sections for context, instructions, and the desired output format.
  • Ignoring the AI's limitations: Be aware of what the AI can and cannot do. Setting unrealistic expectations can lead to frustration and poor results.
  • Neglecting to fact-check or edit AI-generated content: Don't treat AI output as a finished product. Always review, fact-check, and refine the generated content.
  • Using AI without a clear strategy or guidelines: Establish clear protocols for when and how to use AI in your workflow to ensure consistent and appropriate usage.
  • Overlooking ethical considerations: Be mindful of privacy, sensitivity, and potential biases when crafting prompts and using AI-generated content.
Table 2. AI prompts guidelines
Topic Do's Don'ts
Clarity and specificity Be specific and clear Use vague or ambiguous language
Context Provide relevant context Overload with unnecessary details
Output format Specify desired output format Ignore the AI's limitations
Examples Provide examples or demonstrations Fail to provide examples
Task definition Define tasks and objectives Leave tasks or objectives undefined
Iteration Experiment and iterate Neglect to fact-check AI-generated content
Language Use clear and concise language Rely on one-line prompts without structure
Tone and audience Indicate the tone and audience Be unclear about the target audience
Complexity management Break down complex tasks Present tasks as a single request
Follow-up instructions Include follow-up instructions Skip follow-up or refinement steps

Summary

Writing effective AI prompts is a crucial skill in today's AI-driven world. Clarity, specificity, and context are paramount when crafting AI commands. This process is iterative, requiring practice and experimentation to achieve optimal results.

Consider our customised in-company prompt engineering training, to take your interaction with AI to the next level and unlock the full potential of AI for your organisation. Don't let competitors outpace you in AI utilisation; invest in your team's prompt engineering skills today. Contact us to schedule your customised crash course and start maximising the value of AI in your operations.

« More prompt techniques On-the-Job AI Coaching »