10 tips to improve your AI prompts

Updated on June 20, 2024

10 tips to improve your AI prompts

The following guide presents 10 essential prompting techniques for working with GPT models. These techniques are suitable for both beginners and experienced users, and can help you get the most out of your interactions with AI language models. By applying these techniques, you'll be able to craft more effective prompts, guide the AI towards desired outputs, and achieve better results overall. Let's dive in and explore these key prompting strategies.

1. Format and Structure Your Input

When working with GPT models, it's important to format and structure your input effectively. For simple prompts, you can use delimiters like --- or *** to clearly separate different parts of your input. However, for larger and more complex prompts, consider using tags such as <title>...</title> or <description>...</description>. These tags are easily nested and help the AI understand the meaning and hierarchy of your input.

 

Example:

<prompt>
    <title>
        Blog Post: The Benefits of Meditation
    </title>
    <description>
        Write a 500-word blog post discussing the physical and mental 
        health benefits of regular meditation practice.
    </description>
    <keywords>
        meditation, mindfulness, stress reduction, mental clarity
    </keywords>
</prompt>

2. Provide Examples of Desired Output

When you have an existing sample of a similar response that you like, such as a blog post with a structure, tone, and language that you prefer, include it in your input. This helps the AI understand the style and format you're looking for. Additionally, you can ask the AI to format the response to your desired format, such as HTML, markdown, JSON, or a table.

 

If you don't have a specific example, make sure to describe the desired response in detail. Simply asking the AI to "write a description of XYZ" may not be enough, as the output could range from a few sentences to a full page of text. Be specific about the length, style, and content you expect.

3. Add Constraints

Guide the AI in the direction you want by adding constraints to your prompt. You can provide examples of wrong responses to help the AI understand what to avoid. Set limits, such as specifying a minimum or maximum word count for a blog post. Be precise in your language, as terms like "short" or "long" can be ambiguous and may lead to different interpretations between you and the AI.

 

Example:

Write a product description for a new smartphone. The description should be between 150 and 200 words, and should not mention any specific brand names or competitors.

4. Be Strict

Don't hesitate to give the AI clear commands using phrases like "you MUST" or "you CAN'T". Explicitly state what the AI should not do and what to avoid. This helps ensure that the AI follows your guidelines and generates output that aligns with your expectations.

 

Example:

When writing the article, you MUST include at least three scientific studies to support your claims. You CAN'T use any anecdotal evidence or personal opinions.

5. Set the Tone

The appropriate tone for a response depends on your specific use case, so it's crucial to communicate this to the AI model. Whether you need a formal, informative, persuasive, or friendly tone, make sure to include this information in your prompt.

 

Example:

Write a social media post announcing our new product launch. The tone should be exciting, engaging, and encourage readers to learn more about the product.

6. Avoiding Bias

AI models can sometimes exhibit biases based on their training data. To mitigate this, include a statement in your prompt reminding the AI to provide an impartial response that is not based on stereotypes.

 

Example:

Analyze the given scenario and provide a recommendation. Make sure that the answer provided is impartial and not based on stereotypes or biases.

7. Offer a Reward

Research has shown that "tipping" the AI model can lead to improvements in the generated response. Post by Vooogel compared the effects of offering $20, $200, or no tip on the quality of the AI's output. The study found that providing a tip, especially a larger one, can incentivize the AI to generate better responses.

 

Offering a reward to AI

8. Chain-of-Thought Prompting

Chain-of-thought prompting is a technique that encourages LLMs to output a sequence of intermediate steps leading to the desired answer. By breaking down the problem-solving process into smaller steps, the model can focus on solving one step at a time, often resulting in more accurate and coherent responses.

 

To achieve this, you can either provide an example of a step-by-step answer in your prompt or explicitly ask for a "step-by-step solution". This technique is particularly useful for complex problems or tasks that require multiple stages of reasoning.

 

Example of Chain-of-Thought prompting source

9. Zero-Shot and Few-Shot Prompts

Zero-shot prompting involves using the model as-is, relying solely on the knowledge acquired during training. This approach is suitable for general tasks that don't require specific examples or guidance. On the other hand, few-shot prompting involves providing examples of your desired output in the initial prompt. This technique is particularly effective for classification tasks, where you can demonstrate how you want the model to classify the input values.

 

Example of few-shot prompting:

Classify the following customer reviews as positive, negative, or neutral:

Review 1: "I absolutely loved this product! It exceeded my expectations in every way." - Positive
Review 2: "The product was okay, but not worth the price. I probably wouldn't buy it again." - Neutral

Review 3: "I was disappointed with my purchase. The quality was poor, and it broke after just a few uses."

10. Let the Model Ask You Questions

Allow the model to determine when it has sufficient information to provide a satisfactory response. In some cases, the model may need additional context or clarification to generate the best possible output. By enabling the model to ask follow-up questions, you can ensure that it has a clear understanding of your requirements before proceeding.

 

Example:

User: "Recommend me a destination for vacation."
AI: "To better assist you, I have a few questions:
1. Are you traveling by yourself or with someone?
2. What time of year are you planning to travel?
3. Do you prefer a beach, city, or nature-oriented vacation?"

 

By answering these questions, you provide the AI with the necessary context to make a more personalized and relevant recommendation.

Conclusion

Mastering these 10 prompting techniques can significantly enhance your interactions with GPT models and help you achieve better results. By formatting your input effectively, providing examples, setting constraints, and guiding the AI with clear instructions, you'll be able to generate high-quality outputs that meet your specific needs. Remember to experiment with different techniques and adapt them to your unique use cases. With practice and persistence, you'll become a proficient prompt engineer, capable of unlocking the full potential of AI language models.