Prompt Engineering

Prompt Elements

  • Instruction: A specific task/instruction you want model to perform
  • Context: Additional information
  • Input Data: Input/Question we want response for
  • Output Indicator: the type or format of the output
    • Not required in instruction tuned models
  • Example
Classify the text into neutral, negative, or positive // Instruction
Text: I think the food was okay. // Input Data
Sentiment: // Output Indicator

Prompting Techniques

Zero Shot Prompting

  • It means that the prompt won’t contain examples or demonstrations
  • Instruction Tuning has improved zero shot prompting
  • When Zero Shot does not work, use Few Shot Prompting

Few Shot Prompting

  • It means that the prompt will contain some examples or demonstrations
  • 1-shot: 1 example
  • 2-shot: 2 examples
  • Limitation
    • Not good with complex reasoning tasks
A "whatpu" is a small, furry animal native to Tanzania. An example of a sentence that uses the word whatpu is:
We were traveling in Africa and we saw these very cute whatpus.
 
To do a "farduddle" means to jump up and down really fast. An example of a sentence that uses the word farduddle is:

Chain-Of-Thought Prompting

  • With Zero Shot
    • Just add Let's think step by step at the end of prompt
I went to the market and bought 10 apples. I gave 2 apples to the neighbor and 2 to the repairman. I then went and bought 5 more apples and ate 1. How many apples did I remain with?
Let's think step by step.
  • With Few Shot
    • Give reasoning steps in the examples
    • we can get better results on more complex tasks that require reasoning before responding
The odd numbers in this group add up to an even number: 4, 8, 9, 15, 12, 2, 1.
A: Adding all the odd numbers (9, 15, 1) gives 25. The answer is False.

The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. 
A:

ReAct

Thought 1: I need to search Apple Remote and find the program it was originally designed to interact with
Act 1: Search[Apple Remote] // Tool call
Observation 1: <>

Thought 2: <>
Act 2: Search[Front Row]
Observation 2: <>

Thought 3: <>
Act 3: Finish[Keyboard Function Keys] // Final answer