Before prompt engineering

  • have a first draft of your prompt
  • know the audience that you are tailoring your prompt to
  • have some benchmark to measure prompt improvements
  • have some example inputs and desired outputs to test your prompts with

Prompt engineering techniques

  1. Be specific and clear
  2. Use structured formats
  3. Leverage role-playing
  4. Implement few-shot learning
  5. Use constrained outputs
  6. Use chain-of-thought prompting
  7. Use thread-of-thought prompting
  8. Use least-to-most prompting
  9. Use meta-prompting

When should prompt engineering be used?

  • From the beginning. It’s never too early to think about how your prompt will affect the output.
  • When refining model outputs to meet your expectation.
  • When expanding features and need the model to adapt to new use cases.
  • When optimizing cost and performance. Prompt engineering can reduce token usage, lower latency, and improve performance.

Why prompt engineering is important

  • Get more accurate and relevant responses.
  • Get the response in a specific instructions, styles, or formats.
  • Reduce costs by decreasing the number of tokens used, lowering API costs.
  • Avoid inappropriate or biased outputs.
  • Get consistent and reliable responses across different interactions.
  • Improve user experience with more helpful and concise responses.

FAQ