ChatGPT Prompt Engineering for Developers

https://learn.deeplearning.ai/chatgpt-prompt-eng/

Introduction

  • Two types of LLMs
    • Base LLM - predicts next word, does not “understand” questions
    • Instruction Tuned LLM
      • Fine-tuned on instructions
      • RLHF = Reinforcement Learning with Human Feedback
      • Helpful, Honest, Harmless

Guidelines

  • Write clear and specific instructions

    • Use delimiters to clearly indicate distinct parts of the input. This helps with avoiding prompt injection.
    • Ask for a structured output: JSON, HTML, etc.
    • Ask the model to check whether conditions are satisfied
    • “Few-shot” prompting: Give successful examples.
  • Give the model time to think

    • Specify the steps required to complete a task
    • Instruct the model to work out its own solution before rushing to a conclusion
  • Avoid hallucinations

    • First find relevant information
    • Then answer the question based on the relevant info