What is Prompt Engineering and how it works

What is prompt engineering?

  • how you construct your prompts
  • It is a process of instructing an AI to do a task
  • get an AI to perform a task based on a set of instructions you give 
  • garbage in, garbage out

What is OpenAI Playground?

  • OpenAI Playground is an online platform that has different machine learning model
  • what you make there can be scaled and productized and be sold 

Is OpenAI Playground free?

  • Not really
  • 1 token = 4 characters
  • When you create an account on OpenAI Playground (free) or sign in to OpenAI Playground, $18 is credited to your account. Every response that you generate on OpenAI Playground costs some amount that will be deducted from $18. The amount deducted from your account is based on the number of Tokens used to generate the response.
  • These $18 are valid for up to three months from the date they are credited to your account. All your free credits will expire after three months. 
  • Choose the models that work for you, but not necessarily the best ones, because the best ones could charge more tokens, e.g. instead of DaVinci 3, use Curie or Ada (4:30)

What is the relation between OpenAI Playground and ChatGPT? (2:35)

    • OpenAI significantly changed GPT3 to make ChatGPT

How to make money using OpenA1 Playground? (2:50)

    • you need to learn how to engineer the base models in their natural state 
    • the natural states are the only things that we get access to through the APIs to build our businesses on top of

How to create prompts that yield optimal results on any task?

  • how you construct your prompts
  • It is a process of instructing an AI to do a task
  • get an AI to perform a task based on a set of instructions you give 
  • garbage in, garbage out

Example: email prompt (3:10)

  • how much data you can pack in your prompt and response (cannot go over 4,000 tokens)

Steps

  1. models (4:10)
  2. temperature (4:50) – determines the randomness of your output
  3. max length setting (5:12)

What is Temperature? (4:50)

  • It determines the randomness of your output
  • creative writing or ideation: increase randomness  
  • rigid and deterministic output / getting the same results for the same inputs: zero

What is Max Length Setting (5:12)

  • It determines the randomness of your output
  • you can set it on the right sidebar and see how many characters right below the text box

Different methods of prompting

  1. role prompting (6:00)
  2. shot prompting (7:30)
    • determine the tone, length, and structure of the response generated
  3. chain of thought prompting (11:05)
  4. zero shot chain of thought prompting (12:10)

1. Role prompting (6:00)

  • the fundamental tool
  • give more context
  • better understanding = better answers
  • set your AI into a certain role, e.g. doctor, mathematician 
  • use adjectives, e.g. the smartest, a friendly, etc 

2. Shot prompting (7:30)

Zero shot prompting (7:45)

  • no expected structure on how we want the answers to be given 
  • e.g. the example in the above screenshot

One shot prompting (8:35)

  • give one example (of the answer) for the AI to follow the tone, length and tone

Few shot prompting (9:15)

  • give more than one example on how you want the AI to respond
  • crucial: adding more examples gives you more precisely defined outputs!

4. Chain of thought prompting (11:05)

  • use the phrase “let’s think step by step”
  • used for complex tasks when giving just a few examples won’t work

Example of something you can sell: Ed Sheeran song generator (14:50)

  1. write a topic of the song
  2. put in lyrics of a Ed Sheeran’s song
  3. repeat to give more examples so the AI can learn the style to generate a new song