The ULTIMATE Beginner's Guide to Prompt Engineering with GPT-4 | AI Core Skills

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
prompt engineering is by far one of the highest leverage skills that you can learn in 2023 those equipped with it are capable of creating millions of dollars worth of value in just a few carefully crafted sentences and that's no exaggeration if you give me just 15 minutes of your time I will not only unpack this highly lucrative skill and take you step by step through learning it but also share with you exactly how myself and others have been using the skill to make money and build businesses and no you don't need any coding experience this guide is intended for anyone looking to add this foundational skill of prompt engineering to their toolkit so they can access more opportunities with an AI so what is prompt Engineering in plain English prompting is the process of instructing an AI to do a task we tell the AI for example gpt3 a set of instructions and it performs a task based on those instructions prompts can vary in complexity from a phrase to a question to multiple paragraphs worth of text I'm sure you've all played around with chat GPT the text that you provide in that dialog box is your prompt however most of the value created through prompting is not done with chat gbt more on this later the reason prompt engineering or more simply put how you construct your prompts is so important and so valuable is because of a concept called garbage and garbage out essentially the quality of your input determines the quality of your output when you have large language models like gpt3 that are massive and are just a soup of data your ability to write great prompts directly determines your ability to extract value from them the importance of prompt engineering can be Illustrated with a simple example here in open AIS playground here on screen we have a basic Mouse equation and if I submit that you'll see that it actually comes back with an incorrect answer this simple error can easily be fixed with a little bit of prompt engineering here I've added make sure to put the right amount of zeros even if there are many and just like that we have the correct answer of 9 billion as you can see changing your prompting just a little bit can have drastic effects on having a correct or incorrect answer while extremely obvious on simple math tasks like this these slight prompt differences can have an enormous effect on more complex tasks all this begs the question how can we make prompts that yield optimal results on any task this question is the core focus of prompt engineering within this video we will be using the open AI playground for our prompting it is crucial to understand that the playground is not the same as chat GPT if you're unfamiliar with the playground it provides us with a flexible platform that we can interact with all of the open AI Suite of products in their natural state and by natural state I mean the form that we get access to them through the open AI apis this is important to understand because anything that you can achieve within the playground can then be scaled and then productized and sold more on that later if you didn't know chat TPT is actually an application that openai has built on top of the gpt3 model that we're going to be accessing through the playground the difference is that openai significantly changed gpt3 in order to make chat GPT the reinforcement learning and fine-tuning and a bunch of other fun stuff long story short chat GPT may be fun and valuable in its own right but if you're looking to create value and build scalable business on top of these models you need to be learning how to engineer the base models in their natural state this is because these base level models are the only things that we can get access to through the apis currently and therefore the only new things that we can build businesses on top of therefore learning how to engineer prompts for the base models through the playground is going to be the focus of this video enough talking let's jump into the playground and start prompting here we have on screen a very simple prompt that uses the power of large language models like gpt3 and its understanding of language to convert a mixed bag of first and last names and then order them in last first order here you can see I've given John Doe Liam otley Peterson Mike and then it's going to Output this in last first formatting next up we have a carefully crafted prompt that allows us to remove personal information from our email The Prompt says read the following sales email Remove any personally identifiable information and replace it with the appropriate placeholder for example replace the name John Doe with name and then we have pasted in a sales email example if we submit this the response we get back is the same email with all of the personal information removed it says hi name so it's removed the name and it's also known to remove the phone number and email address as well being able to achieve this result within the playground means that we can then take this exact same prompt and apply it to a larger scale and run it through your agency or something get these exact same results done on mass while we're here I'll give you a rundown of the important settings that you can play around with in the sidebar first and probably most importantly you can change the model that you're using to interact with openai has a ton of different models for different purposes for example we have code related models here which are more capable of understanding code we have some of my fine tunes from my personal account and then we have different versions of DaVinci Ada all these different ones that basically serve different functions and if you look here it would tell you a little bit of a blurb about what each of these things do and what it's good at you may be thinking why would I not just use the best one which is DaVinci 3 at the current time this is because the pricing for each of these models is actually different if you want to use these models for a very basic pattern recognition task you shouldn't be paying more and using the top model DaVinci 3 you could be using Curie or adder or something much lower that does what you need and nothing you don't the next and second most important thing you can play around with is the temperature the temperature setting is crucial because it determines the randomness of your output some tasks like creative writing or ideation would perform better if you increase the randomness but in many cases having the temperature at basically zero is going to be better if you want those rigid deterministic outputs setting the temperature at zero can often be a very good way to ensure that you get the same results from essentially the same input next is the max length setting which is an extremely important part of your prompt rating these models have a strict limit on how much data that you can pack into both the prompt and the response you get back from the model this means that both the prompt that you write and the expected response cannot go over 4 000 tokens one token is equal to roughly four characters in normal English text the max length setting determines the length of the response that it will give back to you so it's important to do a little bit of quick math and see at the bottom of the screen here how many tokens you've taken up with your prompt and then essentially Max your maximum length for the response to be not over 4 000 tokens in total and then here we have a few minor settings you can play around with such as the frequent penalty and the presence penalties in some cases these are very useful because you might notice that it's repeating the same thing over and over and you don't want that or you want it to talk about new topics more often which will help you with the present penalty now that's out of the way we can teach you your first method of prompting which is role prompting in role prompting if you couldn't figure it out from the name you are going to use prompt in order to set the AI into a certain role for example in your prompt you could include you are a doctor or you are a lawyer and then start asking it legal or medical questions here on screen we have another maths problem to illustrate this role prompting now if I submit this I get 280 as my result back which is incorrect now if I go a few lines above it and I add in this little role prompting section suddenly the answer changes we get the answer of 1400 which is actually the correct answer what we've done here is told it that it is a brilliant mathematician who can solve any problem in the world so this is setting it into a role of being a mathematician or we can do what apps like chat GPT have done and set the model into a personal assistant friendly helpful bot mode here's an example of a prompt that turns the model into a helpful AIS system on-screen is an example of a basic prompt that turns the model into a friendly AI assistant using adjectives like helpful creative clever and very friendly to to Really set that mode as a helpful friendly clever assistant and we also have a few examples here as well now that it's been set into this mode I'm able to ask it a question should I shop online for my groceries or go to the supermarket let's see what it gives us and just like that we've got a chat gpt-like response which is a friendly helpful response to our question setting modes like we've just done is one of the fundamental tools within your prompt engineering toolkit when assigning a role to an AI we're helping it by giving it more context with this context the AI is able to better understand the question and not surprisingly with better understanding of the question and the AI will give better answers you may have noticed in that last prompt we've actually shown it an example of one interaction between the human and the bot this brings us to our next method of shot prompting shot prompting can be broken down into three categories zero shot one shot and few shot prompting using these shot prompting methods are the easiest way I've found to build businesses with AI right now more on that later in the video Zero shot prompting is essentially using the AI as an autocomplete engine You're simply giving it a question or a phrase and giving it free reign to reply to that without any expected structure zero shot prompting is what we've been doing to most of the video already so simple stuff like what is the capital of France Paris any kind of question Humpty Dump D here you can see I've put the Humpty Dumpty nursery rhyme but just a few words of it and it's completed it for me using xero shot prompting is essentially using these large language models as a massive autocomplete engine and again going back to our previous example of the mathematician role prompting this is also zero shot we haven't provided any structure or expectations on how to answer it the AI is just going to look at this and say this is how I'm going to reply it's no expected structure this time it's gone forward the answer is 1400 it could have just gone 1400 or it could have said the answer to this question is 1400 so we haven't provided it with any structure on how we want this answer to be given back which brings us on to one shot prompting here's an example of one shot prompt being mixed with a bit of role prompting as well so up top we have a little bit of information to set it in a highly intelligent question answering bot roll and below it we have a One-Shot example of an interaction between the user and the AI now when I enter my question within this now when I ask it a question it's not only going to take into account the role prompt above but also look at the structure and how it interacted in the one shot prompt above and here we have the answer which is Michael Phelps won a total of 28 meters including 23 Gold these two pairs of answers and responses are very similar it's looked at the pattern and looked at the structure of the one above and it's answered it in the same way matching the tone and length of it and finally we have few shot prompting few shot prompting is done by giving more than one example of how you want the AI to respond on screen I have a little prompt made up of a YouTube video idea generator what I've done is set up a question and answering pair so this is the question YouTube video ideas for selling products on tiktok and then I've given it 10 examples that I just took from chat GPT and put in there this data here is really important and if you're you're trying to use few shot to get a particular result the things you're putting in as examples mattered a lot now if I add in the rest of the prompt I have this next part which is the second shot of the few shot prompt the YouTube video ideas for why you should try digital Banks and I've given another five examples here so all I need to do now is to paste in another question YouTube video ideas for how to make money with chat GPT and the AI is going to look at my previous shot prompt and then give me a answer based on the structure and content of those previous prompts and just like that we've taken gpt3 and turned it into a YouTube video idea generator which is based on the kind of styles that I like in titles which are provided here using the few shot method by adding in more and more examples you're able to more precisely Define the kind of output that you want crucial aspects of your response like the tone length and structure can all be determined by the examples that you provide a simple example would be a q a bot like we have on screen here when prompted with a question at the end here the AI is going to take a look at the role prompt at the top get set into the roll and then look through all of these examples provided and go okay these are the kinds of responses that I'm expected to give these are how long they are this is the tone of voice this is the structure so this is how you teach it to give you the kind of results that you want if for example you were to take these answers and expand on them and make them a whole paragraph and did that for each and every question then when you ask it a question it's going to give you back a full paragraph as well it's important to understand why shop prompting works so well and this is because large language models are essentially just pattern recognition and generation machines another handy tool to have in your prompt engineering toolkit in order to extract the most value value out of these models it's called Chain of Thought prompting Chain of Thought prompting encourages the large language model to explain its reasoning as it goes through the steps which typically results in better and more accurate results the increase in accuracy is particularly noted in arithmetic common sense and symbolic reasoning tasks on screen we have a word equation that's asking what is the faster way to get to work now if I submit this the answer I get back is that option 1 is the faster way to work but we find out when we change the prompt is that that was actually the incorrect answer as you can see on screen if we change the prompt around and make it explain the thinking it actually comes up with a different answer which is option two let's take a look at this a little bit more closely to understand why it works what we have here is a One-Shot prompt where it's providing us with one example of how we want things done which is a faster way home option one so this is the question which is the same as the question that we had just slightly different and what we've done is written out how we want it to respond so it's going to look at the structure and go okay that's how they want me to do it and then so when we ask this question it's going to do the exact same process of thinking things about step by step and then we get the correct answer which is option two now Chain of Thought prompting like this is really handy for these specific kinds of tasks it's a great thing to have in your toolkit as a prompt engineer another method of doing Chain of Thought prompting is actually called zero shot Chain of Thought prompting now if we add this magic little phrase let's think step by step to our zero shot prompt we get a bit of a different answer to what we got before and just like that we've gotten the correct answer which is option two by asking it to think step by step for us now you may be thinking what's the difference between a a single shot and a zero shot Chain of Thought answer like this while it's very easy in this situation to create a single shot or few shot prompt by thinking up a few examples and tweaking this question around a bit when the task is far more complex sometimes getting multiple examples or even just a single example to use in a shot prompt is not possible therefore this little magic phrase of let's think step by step can be the difference between extracting correct and incorrect answers with your prompts so now that you understand the basics we can get into what you're really here for which is what are the biggest opportunities for prompt engineers in 2023 and Beyond experts like Dr Alan d Thompson have said that we have one to two years where prompt engineering will be extremely valuable but soon will be replaced by artificial intelligences who can write their own prompts So within this two-year period how can we get the most out of this highly lucrative skill first and most obvious is to sell your services as a prompt engineer demand for this skill is exploding right now give yourself a month or two to learn it and become an expert and then start going out and trying to find your own gigs companies around the world are hiring for this right now so all you need to do is learn the skill and get out there and start knocking on doors the second opportunity that I see is to create a teaching business out of prompt engineering we're going to see companies all across the world have to Pivot towards understanding and using these models one of the easiest ways for these companies to tap into this AI Revolution that's happening and start to use these tools to increase the productivity of their business and employees is to teach them how to use these tools if you can go into these companies and teach them skills like prompt engineering and give them a suite of tools that they can use to improve their productivity then you're going to have some seriously good opportunities to start making money by selling to these big companies and finally my favorite way of making money with prompt engineering is by building businesses around a one well-written prompt we are seeing extreme amounts of value being unlocked with just one well-written prompt an awesome example of this is Lita AI by Dr Alan d Thompson if you haven't looked into them already I suggest you check them out I'll leave a link in the description to his channel but what he's done is basically taken a gpt3 model written up a very very specific prompt and with that prompt he's basically created this AI assistant called Leader by writing such a quality prompt he's able to create a AI that has exactly the right character that he wants and what he's done is set up a webcam and he's been interacting face to face talking to this AI and sharing it with the world while I don't think he's monetized it yet and it's more of a research project it is insane seeing what just a few sentences of well-written text can do to transform these language models which are so powerful into these entirely new and uh powerful things in their own right but a much more direct way of making money right now is looking at how you can write a prompt to create a tool that you can sell one example of a little gimmicky tool that you could make is uh Ed Sheeran song generator that I've been playing around with in a wrote a prompt for that you guys can see on screen here now what I've done here is taken the lyrics to supermarket flowers which is the output that I want and I'll put the topic as buying Supermarket flowers for my grandmother as she is ill and then I've pasted in some example lyrics from Ed Sheeran which is actually the shape of you verse and chorus and then I've done it again and I've put in falling in love with a girl from Galway then I've given it the same example to learn his style from which is the shape of you chorus and verse and then I've put in the output which is lyrics directly from Galway Girl and here we have my topic loving a girl who lives far away missing her more every day and if I hit enter on that then it's going to give us out a entire song in the style of Ed Sheeran based on the topic that I'm I've given now while very gimmicky of course this is an example of how you can use prompts and pulling in different bits of data and pulling in user input in order to create a little tool if you took this and put it on a website and did a little bit of marketing and I'm sure you'd be able to get some money coming in off the back of one of these very basic tools if you're not subscribed already then make sure you do because my next video I'm going to be doing something just like this taking it to Market and seeing how much money I can make so I'm going to be giving you the behind the scenes of that in my next video on my channel I've talked about fine tuning before but I seriously think doing prompt engineering like this to alter these models is an even lower barrier to entry for people looking to build businesses with AI all it takes is one carefully written prompt and maybe a little bit of user input matched together and you can create a valuable business in like half an hour so now you know the basics of prompt engineering you can go out there and start practicing it more start selling your services start teaching people or start building businesses based off writing prompts if you've got anything out of this please hit down below and leave me a like subscribe to the channel if you're looking for more AI entrepreneurship content like this I post three times a week or more and if you have any questions please hit down below in the comments myself or someone else in the community will answer question as soon as possible that's all for today thank you so much for watching and I'll see you in the next one [Music]
Info
Channel: Liam Ottley
Views: 198,373
Rating: undefined out of 5
Keywords: prompt engineering, midjourney prompt tips, prompt engineering guide, what is prompt engineering, chatgpt, chat gpt, chatgpt examples, chatgpt explained, generative ai, openai, chatbot tutorial, prompt crafting, Midjourney, Dall-E, artificial intelligence, AI, prompt engineer, how to write pro, chatgpt prompt, prompt engineering gpt 3, prompt engineering course, prompt engineering 101, prompt engineering tutorial, Beginner's Guide to Prompt Engineering, chat gpt prompts
Id: ydjRYmM19DY
Channel Id: undefined
Length: 16min 41sec (1001 seconds)
Published: Mon Feb 06 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.