Prompt Engineering Guide

A concise guide to prompt engineering strategies for better AI results, including clear instructions, task breakdowns, and few-shot learning.

Six Strategies for Getting Better Results

OpenAI recommends six strategies for getting better results:

  1. Write Clear Instructions: Specific instructions reduce errors. If you need brief replies or expert-level answers, mention it. For better formatting, demonstrate your preferred structure.
  2. Provide Reference Text: Language models may generate fake answers, so giving relevant reference material can increase accuracy and reduce errors.
  3. Split Complex Tasks: Breaking down tasks into simpler subtasks improves accuracy. For dialogue or summarization tasks, tackle each part sequentially.
  4. Give Models Time to Think: Asking models to explain their reasoning process improves accuracy for complex queries. Prompt them to analyze or summarize before providing a final answer.
  5. Use External Tools: Models can utilize tools for tasks beyond their native abilities, like retrieving documents or performing calculations, for more accurate and reliable outputs.
  6. Test Changes Systematically: Regularly evaluate prompt changes with representative test cases to ensure consistent performance improvements.

Few-shot Learning

Few-shot learning is a prompt engineering technique used to guide AI models in understanding specific tasks by providing a few examples of input-output pairs. By showing the model a handful of samples that demonstrate the desired format, tone, or structure, few-shot examples help the model infer the patterns it needs to follow, even when specific instructions are minimal or implicit. This approach leverages “in-context learning,” where the AI model generalizes from examples within the prompt without requiring fine-tuning.

Take a look at this instructional example utilizing few-shot learning:

Example 1:
Input: "The smartphone industry is rapidly evolving with new features like foldable screens."
Category: Technology

Example 2:
Input: "The new novel explores themes of family, love, and resilience in the face of adversity."
Category: Literature

Example 3:
Input: "Governments worldwide are addressing climate change through policy reforms."
Category: Environment

Now classify the category of this input:
Input: "Scientists are making breakthroughs in cancer research with promising new treatments."

Other References

AI Assistants Use Cases

Explore AI use cases in Sales, Productivity, and Support to streamline tasks, boost engagement, and enhance customer satisfaction.

Your first teammate is 10 minutes away.

Add Runbear to Slack, hire an agent in chat, and watch it work. Free to start, no credit card.

Want a walkthrough first? Book 20 minutes with our CEO