Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.26 KB

prompt-engineering.md

File metadata and controls

38 lines (31 loc) · 1.26 KB

Prompt Engineering Principles

Tactic: Write clear and specific instructions

  • Use delimiters to clearly indicate distinct parts of the input/output
  • Ask for structured output like JSON or HTML
  • Ask the model to check whether conditions are satisfied
  • "Few-shot Prompting": Giving the model example of successful attempts
  • "Chain-of-Thought Prompting: with demonstrations, not just examples of answers

Tactic: Give the model time to "think"

  • Specify the steps required to complete a task
  • Ask for output in a specified format
  • Instruct the model to work out its own solution before rushing to a conclusion

Other tactics

  • Limit the number of words/sentences/characters
  • Ask the model to focus on the aspects that are relevant to the intended audience
  • Ask it to extract info and organize it in a structured format

Tactics for summarization

  • Summarize with a word/sentence/character limit
  • Summarize with a focus on a specific aspect
  • Summarize multiple entries

Tactics for inferring

  • Infer sentiment (positive/negative)
  • Identify types of emotions (e.g. satisfaction or anger)
  • Do multiple tasks at once
  • Infer topics

Tactics for transforming

  • Translation
  • Tone transformation
  • Format conversion
  • Spellcheck
  • Grammar check
  • Expand on text