ChatGPT Prompt Engineering Principles: Chain of Thought Prompting

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's video we are gonna start our series that I have called the perfect prompt principles so basically this is just gonna be techniques you can learn to improve your prompt game how you can dissolve different problems using different techniques so today we are gonna start with a chain of Port principle uh so I'm gonna go through some examples we are going to use chat GPT in this case we're going to solve a couple of problems I'm just gonna go quickly through how I think about using these principles and how it can improve your output in an llm so you will see from these examples that we can really enhance our output just by using this we can even solve the problem that we couldn't solve before so I think we're just gonna get straight into it and look at the principle and this is how kind of I think about the Chain of Thought principle or the Chain of Thought prompting so this does not fit to every single problem you have but if we have a kind of problem that fits this style this uh Chain of Thought this is more economy like a step-by-step thinking I think you will identify these problems when you see them so then we have the option to kind of prompt this to split it into sub problems we just prompt it like to make a list of all the steps we have to solve before we can solve our main problem right and then we just do that we just prompt it to make a list of all these problems then we just start by solving problem one problem two and when we have sold all those intermediate steps then we can wrap it up by solving our main problem this might seem a bit weird but if you think about it this is how humans solve problems too we don't just look at the last sentences in a problem and just say ah it has to be that we have to go through each step and solve like in a chain right and you will see that clearly now when we move on to our example so for our first example we are actually gonna just stay on chat GPT 3.5 because I think you can even see it better here how this Chain of Thought works so maybe you have seen this problem on my channel before but let's have a look at it Michael is a 31 year old man from America he said that really famous Museum in France looking at its most famous painting however the artist who made this painting just makes Michael think of his favorite cartoon character from his childhood what was the country Ray of origin of the thing that this cartoon character usually hold in his hands so this is a kind of problem that we just can't go to at the last sentence here right and just say ah it has to be that because we have no way of knowing that because we have to solve this problem like step by step or in a Chain of Thought So this is a perfect demonstration like if we try to solve this with japjibouti now so I tried five times there and it wasn't even close to solving this so what we have to do is think a bit different and I'm going to show you the prompt I'm gonna use so we can actually have a chance of solving this so here you can see we have the same problem right but here I go without solving the problem just yet think through this carefully and list systematically and in detail all the problems in that riddle that needs to be solved before we can arrive at the correct answer okay so that's a good start right I think this kind of shows how we want to break this down into a list so you can clearly see here that chat chipity gives me this list here so we need to identify Michael's location what's what kind of museum is that we want to identify the most famous painting the artist of the painting we didn't want to determines Michael's favorite cartoon character identify the character and determine the country of the origin of the object so this is a perfect um yeah visualization of how you kind of can see that the list of all the steps we need to take before we can come to the final answer so then I just prompted okay good so problem one with the highest probability you can give so I try this variant where I always want to solve for the highest probability because if you're not 100 sure about something then humans also just default to thinking like it has to be that sometimes when you're not 100 sure you just want to give an answer that is highest probability so here you can see the highest probability is that it's Michael is visiting the Louvre museum in France so the probability answer for problem one is that Michael is at the louvere Museum in France okay good solve problem two that's going to be identifying the most famous painting so therefore the most famous painting in the riddle is Mona Lisa by Leonardo da Vinci perfect okay then we move on to problem three that was like identifying the artist who made that that should be pretty easy for a large language model right so that is going to be Leonardo da Vinci okay we can just move on to problem four determine Michael's favorite cartoon character and here you can see does not really know what to say here it doesn't have a clear answer because the problem is also based on information to be provided but then I tried to just go that's okay but provide the cartoon character with the highest probability again I specify on this because I just wanted to give it like the best guess or the best educated guess right and then it goes ahead and it's likely to be Teenage Mutant Ninja Turtles because one of them is all of them are renamed after Renaissance artist right so one of them is Leonardo so uh we're gonna guess that the reasonable probability that the cartoon character Michael thinkno is Leonardo from Teenage Mutant Ninja Turtles okay that's good because it can't really say it's 100 sure of this but sometimes you just gotta make an educated guess to get moving on right just you don't want to stop here if you're going to try to solve the problem so we're just going to continue to keep solving on problem five that's going to be identifying the cartoon characters object and Leonardo he holds a pair of katanas or is it one Katana at least it's her katana and that is correct okay so then I just go do you have all the info you need now to solve the problem yes I all have all the information I need okay go ahead list the problems and the final solution so here you can see we have like uh we have the location that's Laura loure we have the painting Mona Lisa the artist we have the cartoon character and the object is a katana and the final solution is the country origin of the object that the cartoon character Leonardo holds in his hand is Japan perfect that is correct so you can see it now we solve the problem by using Chain of Thought thinking a problem that Chachi PT if I gave it like 100 chances I don't think I could solve it if we just zero shot at this prompt by using China Pot we can just think through this like more step by step and they ended up with the final and correct answer I also wanted to do a problem over on Jeep D4 or I'm one of the Advanced Data analysis I just prefer this model over gpt4 that's just my personal preference but you can just use gpt42 because I wanted to see like if this kind of thinking is also applicable to gpd4 even though gpt4 are more more accurate on these kind of problems if I run the riddle from last problem I think I could solve it like in a zero shot but let's take a look at the zero shot here on the problem this is a just problem I created this morning so I am in my garage I pick up a small ball and I grab a small box that is missing the bottom I walk into my office and I put the small block ball into the small box then I take the small box with me to the postal office here I put the small box into a bigger box and I send it to my friend in New York then I ask where is the ball now and gpt4 or data Advanced Data analysis answers the ball is in the bigger box that you sent to your friend in New York and that is like as a human I think no that can't be because I put the ball in a box that is missing the bottom right so the ball can be in the Box so what I wanted to do is try to use this chain of top thinking principle here on this problem and see if we get something else so here you can see I kind of prompted it in a different way I kind of went with this without solving the problem just yet think through this carefully and list systematically and indeed that all the problems in the riddle that needs to be considered carefully before we can arrive the answer that has the highest probability of being correct here we get kind of like all the problems we need to think about the location of the ball the Box condition handling and movement Transit details ambiguities like the riddle doesn't specify if the balls stay in the Box in the small box when the small box was placed in the bigger box so we have some issues kind of we need to think about here the riddle doesn't mention the size of the ball relation to the small box there's no mention of the bigger box has in a bottom or if it's sealed correctly so we have intervening actions we have an end state was the books received was it open so it thinks to a lot of different things here so it's just I just found it interesting to just read all of this and just I don't think even I could think of all these sub problems or things that could happen to the to the ball or the box or the condition uh just by so I think it did a very good job in thinking about every single detail here there's no mention of the time it takes for the box to reach New York so yeah I thought it was pretty good and then I follow up with great now look at each step and give me an answer with the highest probability where the ball is and it starts off with thinking about the location of the ball the ball starts here you put the ball in a small box at this point the ball is inside a small box however given that the smallest missing bottom if the box is held upright the ball most likely would fall out so you can see it kind of thinks to every step here I just think that was nice Journey to the postal office the postal office 32 in New York and here it comes up like this highest probability conclusion so given the information provided the highest probability the ball fell out of the small box either in your office or on your way to the postal office due to the missing bottom yes so that is kind of what I wanted this language model to figure out uh that it that something must have gone wrong here so it didn't give a clear answer here it said either in your office or somewhere in between your office so I just said we need a final answer I wrote answers but I wasn't answer all right synthesizing the information and going with the highest probability the ball is most likely in your office yeah that is correct right if you go up again and look at the problem so in the garage I pick up the small ball and I grab it and I grab a small box that is missing the bottom I don't place the ball in the Box in the garage but when I come into the office I put the small ball into the small box and my thinking is that when I lift up the box then the ball stays in my office right and so yeah I think this is correct and I think he did a very good job by sorting out like every step of our problem here and without being 100 sure because you can't really 100 sure that the ball is in the uh what got lost in the Box in the office uh but I think he did a very good job and by using this Chain of Thought principle we kind of saw the difference between just doing this zero shot with no extra information or steps added uh then it said that the box was in new the ball was in New York but now it's most likely in our office what I think is correct so again I think this showed that thinking with this Chain of Thought principle that we can get better outputs from an llm so yeah that is basically what I wanted to show you today so this is gonna be a series coming up where I go to more of this prompt engineering principles that you can think about when you are using an llm to solve a problem and yeah I got some other good episodes coming up so just watch out for those uh I don't have a timeline for them yet but they gotta be drinking out in between so I'm gonna mark them like the perfect prompt principle so you can just look out for that anyway thank you for tuning in check out some of my other videos up here if you enjoy this and I'll see you again soon
Info
Channel: All About AI
Views: 17,161
Rating: undefined out of 5
Keywords: chatgpt, prompt engineering, gpt 4, chatgpt system prompt, chat gpt system role, chatgpt tutorial, gpt 4 system role, chatgpt prompt engineering, gpt 4 prompt engineering, prompt engineer, how to write better prompts, how to get better results chatgpt, how to get better outputs chatgpt, chatgpt explained, chain of thought prompting, chain of thoughts, prompt engineering principles
Id: Kar2qfLDQ2c
Channel Id: undefined
Length: 12min 56sec (776 seconds)
Published: Fri Sep 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.