How to Write a Prompt

Discover essential tips for effective prompt engineering to enhance AI responses and ensure clear, context-rich communication.

December 19, 2024
A bird's eye view of someone's hands typing on a laptop.

With more and more organisations focused on successfully implementing AI in their day-to-day processes, writing effective prompts for AI models has become a crucial skill. Here, we'll discuss the best prompt engineering tips and techniques that will help you craft clear, concise, and context-rich prompts, ensuring you get the most out of your AI tools.

What is prompt engineering?

Prompt engineering is the art of crafting effective instructions for AI systems to get the best possible results. By carefully wording prompts, you can steer the AI towards more accurate, relevant, or creative responses.

Elements of a good prompt

1. Set the context

Helping the AI understand the background of your query is a sure way to get more relevant answers.

2. Give clear instructions

It's important to be specific about what you want the AI to do in order to reduce the chance of misunderstandings.

3. Specify the output format

Whether you want a bulleted list, a table, or an essay, be sure to state your preferred format.

4. Define tone and length

Indicate the tone and depth of response you're after to ensure that the output isn’t too brief, too long-winded, or too off-brand to be useful. 

Prompt engineering techniques and examples

1. Zero-shot

This is when you ask a straightforward question without providing examples. It’s a simple approach and can save time on general knowledge queries where less context is needed, but it depends heavily on the AI's training data and may be less precise than other methods.

Example:
"What are the main ingredients in a traditional English breakfast?"

2. One-shot 

This is the method of providing the AI with a single example or context to help it understand the desired output, before asking it to complete a similar task. Almost as if you were giving it a template to follow.

Example:
“Here's an example of our product description format: 'Moonstone Ring: Ethically sourced moonstone (8mm) set in recycled sterling silver. Perfect for the eco-conscious dreamer.’ Now, create a similar description for our 'Bamboo Necklace' made with sustainable bamboo beads and a recycled gold pendant.”

3. Chain-of-thought 

This involves breaking down complex questions into smaller, related parts. By doing this, you reduce the chances of the AI becoming lost in the syntax, and instead guide it towards giving you a more accurate answer.

Example:

"Let's solve this maths problem step by step:

What's 15% of £80?

If that amount is a tip, what was the original bill?

If four people split the bill equally, how much did each person pay?"

4. Iterative 

Iterative prompting is a technique where you progressively refine and expand your query by building upon previous AI responses, asking increasingly specific or nuanced follow-up questions to gain deeper insights.

Example:

"What are the benefits of regular exercise?"

(After receiving an answer)

"Can you elaborate on how exercise improves mental health?"

5. Personas

Creating a persona (a fictional character or role generated to guide an AI model's responses) and informing the AI of it before stating your request allows the AI to consider elements of its response, such as tone of voice and the type of information it will focus its output on.

Example: 

“You’re a primary school teacher with a particular interest in science. You never patronise the children, but you use words you know they’ll understand. Explain how rainbows form in about 50 words.” 

Refining your prompts

1. Analyse AI responses

Take the time to look closely at how the AI model responds to different prompts. Understanding these responses will help you refine your prompts for better outputs.

2. Give user feedback

Providing feedback for the AI on how well it answers your prompts is an effective way to help improve the language model, making it better at meeting your needs.

3. Try different approaches

Experimenting with various prompting techniques can give you a better sense of what works best in each situation.

Bonus tips for effective prompting

  • Be specific and avoid vague language.
  • Use descriptive words to add detail to your request.
  • Break down complex tasks into smaller, manageable parts.
  • Experiment with different phrasings to see what works best.
  • Remember that AI models have limitations, so be patient and realistic in your expectations.

Challenges and considerations

When crafting prompts, it’s crucial to consider risks, such as:

  • Data privacy: Avoid including any sensitive information in your prompts, as this data may be retained by the AI system and potentially accessed by unauthorised parties.
  • Bias: Even subtle word choices in prompts can influence the AI's output, potentially leading to unfair or discriminatory results. Use neutral language that doesn't favour any particular group, and consider diverse perspectives when framing questions or scenarios.
  • Compliance: Check your company’s AI policies and ensure that your prompts align with your organisation's guidelines and values, as well as other relevant regulations, such as the General Data Protection Regulation (GDPR)

By following these guidelines and practising regularly, you'll become adept at crafting prompts that yield helpful and accurate responses from AI tools.

Discover how Narus customers can optimise, safeguard, and share useful prompts with their team.

Narus logo