Prompt Engineering Full Course
Key Takeaways
This video covers the basics of prompt engineering, including what it is, why it's important, and how to do it faster, as well as advanced strategies and techniques for getting the most out of language models.
Full Transcript
In this video, you'll learn everything you need to know about prompt engineering. I'll explain what it is, why it's important, how to do it faster, the top techniques and methods, and advanced strategies to get the most out of LLMs. With that said, let's dive in. So, what I've done for this video is I've created a markdown file that contains all of the examples and key talking points that I'll go over. Now, if you want this file for yourself for your reference, you can get it for free just by clicking the link in the description and subscribing to my newsletter. Anyways, let's start. And I want to just show you a quick example of a bad prompt versus a great prompt just to kind of set the tone and then we'll get into all of the other theory. And keep in mind all of the different topics in this video are available down below in the video player or the chapters in the comments in case you want to fast forward. Okay, so what is a bad prompt? Well, an example of that would be something like write something about our product. It's going to give you something like generic marketing fluff, wrong tone, wrong length, probably no CTA. The model is effectively going to guess what you want here. Whereas a better prompt would be something like this. You are a senior B2B copywriter. Write a two-s sentence LinkedIn ad for our project management SAS a sauna alternative. The audience is ops managers at midsize companies. The tone is confident but not salesy. And end with a clear CTA. Now, if you do this, you're hopefully going to get a result that's on brand, scoped, actionable, and easy to drop into an ad. The point of me showing you these examples is that when we're writing these prompts, we're using the same tool or the same LLM. So what's giving us the difference in result isn't the LLM. It's the way in which we instruct it. And most people, while this kind of seems obvious, are writing prompts closer to the bad prompt than they are to the good prompt. And just because a prompt is long, does not necessarily make it good, which I'm going to go over in this video. So this leads me to what is prompt engineering and why does it matter. Well, you should really think of prompt engineering just like programming in natural language. So rather than using Python or Java or JavaScript, you're just using, you know, text or your voice or whatever language it is that you speak in to try to get some kind of result, complete some action, get some text, whatever. Effectively, what you're doing is you're giving instructions in plain language instead of something like code. Now, it's important to note that the models that we give these instructions to, they don't have a built-in task list. So, you have to define the task, the role, the format, and the constraints within the prompt. And you have to be very specific with what it is that you actually want. And that's why the same model can seem brilliant or useless depending on the clarity, context, and the structure that you provided. Now, when most people prompt AI models, they're trying to get some kind of text in return. And while that's still a very valid use case of these models, it's important to note that we've now shifted kind of into an agent era where a lot of these models are capable of interacting with various tools, searching the web, and actually taking actions. They can change something in your asauna, right? They can write a Google doc. They can create a PowerPoint slide. And because of that, prompt engineering becomes even more powerful because we're no longer just directing the model to try to give us some kind of textual output. We're actually instructing it to take some kind of actions which can give us a real meaningful result. So just keep that in mind. While a lot of what I'm showing you here is going to be based on text, this also works for agents, right? Or more complex models that are capable of calling tools. And just to go through a quick example, you can see a vague prompt would be something like, "Help me with my essay." While a specific prompt is something like, "You are a tutor. Help me improve the thesis and first paragraph of this 500word history essay on the causes of World War I. Keep my voice, adjust the edits in line, etc." Okay. Now, in terms of why this is important, well, we're moving more and more towards an AI world. So, for people like developers, marketers, researchers, just anyone who's using AI, the better the result you can get from it, obviously, the better that is for everyone. and the faster you can get to the result if you have better prompts. So, the takeaway, right, better prompts is just better results for everyone. And this is overall a skill that you will learn over time. But by knowing some of the foundations that I'll teach in this video, it will just speed that up for you and allow you to think of these a little bit more intentionally while you're writing the prompts. Now, what you've probably gathered at this point is that the more details we include in the prompt, the better the result or action is that this model will take. Now, that's generally true. I mean, longer prompts are not always better, but most of the time they will give you a better result. However, that's only if you actually take the effort to write them. Most people are lazy. They type very slow and they don't want to spend 10, 20, 30 minutes, you know, typing a prompt just to have to maybe change it, iterate on it, whatever. So, what I'm going to suggest to you guys is going forward, rather than typing your prompts, just speak them. So use your voice, use natural language, and this will allow you to have prompts significantly faster where you can include all of the details without lazily having to type them in. Now, this applies on phone, it applies on computer. And the tool that I use to do this within any application, doesn't just have to be something like chat GPT here is called Whisper Flow. Now, I'm just going to quickly show you how it works. And if you want to try it for free, I have a link in the description. I would highly recommend it because it is currently the best dictation tool that works a lot better than anything built into your computer. So, for example, let me just do something. Hey, this is just a quick test where I want to dictate with Whisper Flow and see what kind of results I'm getting. Notice I'm talking um uh you know extremely extremely fast. I'm making a few repetitions, pauses, etc. And let's see the result that we get. Okay, so you can see that kind of little bubble popped up there. And pretty much instantly we get the result. And you'll see that if we go through the result here, it automatically does the punctuation, adds the capitalization, and corrects any of the ums, o's, or repetitions that I had. I believe I said extremely twice. It recognized that wasn't useful, and it just removed it. So, you get a much faster, better result. And you can also do something like this. I want to have three bullet points. Bullet point one is apples. Bullet point two is bananas. Bullet point three is pears. and you'll see that it will automatically format it for me like that. Okay, so when you're doing the prompts, the formatting is very important as well. And this tool will handle it for you compared to a built-in dictation. I do have a long-term partnership with them, full disclosure, but I was using them much before we did the partnership because the tool is very, very good. You can see here I've spoken 35,000 words. My WPM is 162, which is much faster than I would be able to type. It has a lot of other features like dictionaries, snippets. You can change the style based on the apps that you're working inside of, notes, all of this kind of stuff. And a bunch of settings where I was just hitting a keyboard shortcut on my computer and that allows me to actually trigger flow to start activating on my computer. So I use this in every kind of application. Sometimes I use it to write emails, sometimes I use it for prompting, right? Sometimes I use it in cursor to prompt a model or reference files. And I'll show you more of it in the video, but the point is speak your prompts. You're just going to have better prompts. And this tool also is available on phone. They actually recently released it on Android. So you can use it directly from the keyboard like on your iPhone or Android. So even if you're on mobile, you have no excuse not to give a detailed comprehensive prompt that actually includes the information that you want. So this now leads us to the next section which is how LLM think. Now an LLM is a large language model. And effectively what these are capable of doing is replying to text. Okay? So you give some text in, they give some text out. Now you can configure them in very fancy ways to call tools or call other LLMs or create something or take some action. But effectively at the very root of an LLM, it is a text prediction model. It's important to understand this because when you give a prompt to a model, you need to imagine that what it's attempting to do is predict the next text that you would expect to see in this sequence. So while you might see reasoning models, you think that you know the AI is thinking or developing something, really it's just been trained on a massive amount of data and given some prompt, it's able to predict with a relative degree of accuracy what it is it thinks you want in terms of the output. So the prediction is usually going to be in text or in tokens that they may call it, right? You give some tokens in, it spits some tokens out. That's effectively what an LLM is. We don't need to worry about the architecture or anything complicated there. Just remember you have some input, you get some output, and it's just predicting what it thinks that output is going to be. Now, with that in mind, an LLM by default, so something like GPT 5.2, right? It doesn't have any memory. Now, what would give it memory is the providers of these models injecting previous parts of your conversation into the prompt or into the model automatically. So what you need to understand is that a lot of times when you use you know LLMs right or use chat GPT or use cloud or use cursor behind the scenes the people who develop those tools or these interfaces to work with the LLMs they're injecting a lot of data into the prompt that you provide to give you a better response. So, while you may prompt and say, "Hey, you know, review my essay and tell me what's wrong, behind the scenes, the prompt is significantly larger than that where it includes a lot more details that the LLM is looking at. So, it's just important for you to understand that because by default, it doesn't have memory. It doesn't have like all of these fancy features that you see in like the chat GPT user interface. The reason why that exists is because OpenAI, who made Chad GPT, created this nice interface on top of the LLM, which is like the brain at the heart of all of this, that injects this other information into the prompt that then goes to the model that then gives you the response. So 99% of the time, your prompt is not the only thing the LLM is seeing. It's going to be seeing, you know, previous conversation history, maybe it has access to some tools, right? Whatever. There's all kinds of things that are usually being thrown in that you don't actually get to see and it's really important that you kind of internalize that and understand it and you don't think like GPT 5.2 or something has this memory and just knows everything about you. The only reason that it knows something is because it's just taking information that you've given to it previously and just injecting that into the prompt that it's using to give you the response. Now, that additional information that I just talked about is typically referred to as context. It's the other stuff that the LLM can see and look at that's not just the prompt that you gave it. So just understand that the context specificity and structure that you provide is what shapes what it's going to say next. And a lot of these tools just like you know cursor right the tool that I'm in right now. If I create an agent by default it's jamming a bunch of context into the prompt. And if I tag something like this markdown file, right, and I say, you know, hello world, the prompt is hello world plus all of this additional context. Now, with that in mind, let's quickly talk about steering versus commanding the model. So, the common mistake that most people make when prompting is they command the model to do something rather than steering it in the correct direction. Now, commanding the model is something like, summarize this, okay, do this, you know, write this down, take this thing, look at this thing, whatever, right? So if that's the case, the model chooses the length, the style, and the focus that it's going to take when it's summarizing the thing in this instance. Whereas steering the model, you give it more direction on exactly what you want. So you are an executive assistant. Summarize the meeting transcript in four bullet points. Focus on decisions and action items. No filler. Notice that we're not only telling it what to do, we're telling it what not to do. and we're giving it a much more clear objective where when it's trying to predict what we want next, it can give us a much more accurate, better result because of the detail we've included in the prompt. So, when you steer the model, you're typically indicating the length, the focus, and the format that you want. Whereas, when you're commanding the model, you're just telling it to do something and it's picking how it's going to do that, the result you're going to get, etc. So, I'm not going to focus on that too much more, but just understand commanding and steering. Now what I want to do is get into the core techniques of prompt engineering and really focus on a lot of examples. So one of the most basic and important techniques that you can employ is to be specific and to set the scene or specify the particular role that you want the model or agent to take. Now these are the four things that if you include will always give you a much better result than simply commanding the model to do something. If you include a role, an audience, a tone, and some kind of format or output, you're almost always going to get a significantly better reply. So, here it says, you know, reply to this customer complaint. Okay, fine. It can reply to it. But if you said something like this, you're giving it all of these details, the role, the audience, the tone, and the format. So, you're going to get a better response. So, what I want to do now is show you a few practical examples of this by actually writing or voicing the prompt here in chat GBT. So, let's just do a quick example of the bad prompt, right? reply to this customer complaint. And then I'm just going to paste in a random one that I generate here. And let's see the result that we get here from chat GBT. So you can see here it gave us something decent, but it just assumed it was an email. Even though, you know, we didn't specify we want it to be an email. It gave us something relatively long. It didn't say it was from the support team, whatever. So what I'm going to do now, let's just make a new chat. And let's now do a much more detailed prompt with the same customer complaint. So we can say, you are a customer support lead. Reply to this complaint from a paying user whose export failed twice. Acknowledge the frustration. Apologize briefly. Confirm we're investigating and offer a concrete next step. For example, we'll email within 24 hours. Keep it under 150 words. And sign off as the support team. Cool. So that is our prompt. Okay. Notice again that whisper here automatically formatted it for us. So another important part when you are writing the prompts is that if you structure it well, so you have like bullet points for example, different sections, you separate things out into clear sentences, it's going to be a lot easier for the model to understand what you want and predict the next text. For example, if we even just do a quick delimter like adding these three lines and saying, you know, here is the complaint and then putting a colon, it separates. So like this is the thing it should be listening to and then this is the additional context. And also notice that I created a new session here in chat GPT by making a new chat so that it's not automatically going to include the previous text that I had in the conversation in the prompt. So I'm just going to go ahead and hit enter here. But what I mean is that if I had just run this underneath the other example that I gave, you know, we can still get a decent result, but it's going to be a little bit confused or mixed up with the other conversation history because that's going to be included in the prompt as well because chat GPT will include that as context. So if we look here, you can see now we get something a little bit more concise. You know, it says best regards support team and it's followed generally what it is that we asked it to do. Now the next technique you can use is referred to as fewot prompting. Now effectively what this means is that you are going to give a few different examples of input and output pairs that you're looking for so that when you give the prompt the model can give you a better reply. So when you do this, the model can infer and figure out the pattern, which is very good at doing, and then replicate the pattern to give you the exact result that you're looking for. So this is especially helpful when you want something in a specific format, style, you have various edge cases, and you want to do something like a classification task using an LLM because LLMs are actually very good at classifying things. For example, like is this email positive or negative? Is it red or black, whatever, right? All of those things. but only if they know and have examples to be able to classify that. And in fact, when you talk about fine-tuning LLMs, what you're effectively doing is you're passing them a bunch of different examples of inputs and output pairs so they can infer that pattern on top of their base training to give you a more specific better result. So let's have a look at a few examples here. I'm not going to throw them on screen. Let's just go into chat GPT uh and we can do a few prompts and see the result that we get. So, let's do something like turn this user feedback into a short support ticket title. The feedback is the app crashed when I uploaded a PDF over 10 megabits on iPhone. Okay. And let's see what we get here. Perfect. Let's see what it gives us. Okay. So, you can see we didn't really get any clear formatting. In this case, it didn't actually give me one title. It gave me five because again, it's just guessing what to do. But let's change it and do something like this. Turn user feedback into a short ticket title. We want this to be under 60 characters. use the format area and then brief description. Okay. And then I'm just going to paste this. And then here I'm just going to say here are a few examples of the format that I'm looking for. Just give me back one line of text that starts with a title and then includes the uh area and then a brief description of the issue. Okay. And then we should just say something like this. And then I can even do not return anything other than the title. Okay. Cool. So let's now run this. And you can see that I gave a few examples. So let's actually separate the examples a little bit so it's it's a bit easier to see. And you can see that we have you know feedback login is broken with Google and Safari. The title is off. Okay. And then Google login fails on Safari. And then let's go here. Feedback is export to CSV only exports first 100 rows. The title export right CSV feedback. The app crashed when I upload a PDF over 10 megabytes on iPhone. This is actually the example that I'm going to pass paste to it in a second. Sorry. And I'm gonna say like this. This is the feedback to generate the title for. Cool. Okay. And then it should give us the title. And let's see if that works. Now, again, I'm being super specific, but I'm just trying to show you that if I give it a few examples, we hopefully will get a better response. And there you go. You can see it says upload and then iPhone app crashes on PDFs over 10 megabits. So, in this case, I was super verbose, but look at the difference. So, we went from this kind of crap here, right, from the LLM to this, which now I could directly plug into like some API or I could use in my app. And I know that the format I'm going to get from the model is going to be consistent. And then I could just do something else now because I'm in the same chain. So, let's go like feedback. I don't know here, let's go feedback. And let's change this to say something. I don't know what's a good example of feedback. The keyboard does not disappear when clicking outside of the frame on the login screen. Okay. And let's see if we give it if it gives us the title back now. And there you go. You can see it just gives us the title. And we can now keep doing this in this chain because it has the previous context on how it should behave. Now the next technique to go over is called chain of thought prompting. Now this is asking the model to reason step by step before it gives the final answer. Now this will reduce errors on logic, math, you know, the planning, whatever, and different comparisons. And a lot of models do this by default now, especially if you're using like a planning model or a reasoning model where their instructions internally, right? Again, like in the prompt that's being created for you in the back end is to actually do this. So the reasoning models like they're still using a core LLM, but they just have some fancy kind of tools and orchestration on top of them to make them do this. But if you're not using a fancy model like that, then you want to tell it to reason with chain of thought. So without it, you have something like, you know, store sells pens for $2 and notebooks for $5. Sarah buys three pens and two notebooks. She has a 10% off coupon story. How much does she pay? Now, if you don't tell it to reason, it's just going to look at this text and try to predict the result. Now, in a lot of cases, it will get this wrong, just like the famous example of asking an LLM to count, you know, how many TE's are in strawberry or something, and it just can't do it unless you change the prompt to tell it how to reason through it so that it actually thinks before it gives you the response. Okay, so I'm actually not going to show this in chat GPT because it is probably not going to work or prove the example where I think both prompts will give us a very similar result just because the default reasoning for like GPT models is already really good. But with some other models where they don't do the reasoning by default or if you're not using them in the interface like chat GPT and you're just using it in like an API or something then you definitely would want to include these kind of keywords, right? So just anyways keep that in mind for chain of thought. A lot of times now the models that are super modern and you know state-of-the-art will do this by default and actually autodetect what reasoning model they should use based on what you ask them. Uh but it is kind of worth knowing especially you know 6 months ago 12 months ago this was a lot more important than it probably is right now. So the next method that is super underrated is structured output. Now, this is asking the model to provide the output in some kind of format like JSON, tables, XML, markdown, whatever, and then giving an exact example of what you're looking for such that you're able to parse this and use it in some other format or in some other application. Now, in my case, you know, I do a lot of development work, right? And when I have the model generating something, maybe I want to read it into a database, maybe I want to display it on the front end of my website, whatever. In order to do that, I typically need it in some type of structure. So what I will do is something like what you see right here where I actually provide a JSON object schema. This is what it's referred to which is really just an example of what it should look like to the model so it knows how to give me the output. So obviously compared to the first example where we just said something like this. The main difference is that we're providing the structure and we're telling it that we want it to respond with just that. No other text and a particular shape. So we're kind of almost doing this multi-shot prompting, right? or few shop prompting but combining it with some kind of output as well. So anyways, let me go to chatbt and just show you a quick example. So what's something that we can do? So we can say maybe compare Trello, monday.com and clickup for a small team of 5 to 10 people. I want to understand the main features, the limitations and the pricing. And what I'd like you to do is output this with valid JSON only. Don't give me any other text and make sure that it's in this shape. Okay, so that is what we're going to do here. here. Just put that in with whisper. And then I'm just going to paste in the format. So we'll just put it like that. And we'll say example format like so. Okay. So let's run this now and let's see what we get. Okay. So just giving me the output right now, but you can see that it's following this format. It's in a valid JSON object. And now I would be able to load this into my code. I could store it in a database, right? I can return it from an API. Doesn't matter. but it is very useful and it's going to be a lot better than if it just gave me this random kind of markdowny text that chat GPT usually replies with. So, moving on, let's talk about constraints and negative instructions. So, sometimes the best prompts are not talking too much about what to do, but they're talking about what not to do. Now, the more constraints, which is saying, you know, do this, don't do this, be within this bounds, whatever, the better the result is you're going to get because you're steering the model more accurately. So some examples of constraints is for example the length. Now you could say summarize in exactly three bullet points. That's fine. That's a constraint. You also could say keep the reply under 300 words or under five bullet points. Right? You could have a tone like no slang or humor. Do not apologize. Right? Do not use bullet points. Use one short paragraph. Do not suggest paid tools. Do not include code. Describe the approach only. So when you do that, it actually ends up listening a lot better sometimes than telling it what you want. And this has been shown a lot, especially with a lot of the researchers working with these models. Oftent times, they're including a large list of things not to do because it just works extremely well for prompting. So you don't want to write something like write a short intro for our onboarding doc. Instead, you would say, write a short intro for onboarding doc. Start directly with what the user will do in this section. Do not start with welcome or generic greetings. And that in that case, you're going to get something that is straight to the point. So anyways, let's have a quick look at an example here. If we go inside of something like chat GPT again, let's make a new chat. So let's just do something like write a short out of office email reply from me tip. Okay, so this would be uh without any constraints and let's see the kind of response that we get. Okay, so chat GBD actually gave me something interesting here, but it's not really that useful for an out of office email because I need to know for example the dates, the time, all of that kind of stuff. So let's do something better where we say write a short out of office reply. Start with the exact dates I'm away and one sentence on who to contact for urgent issues. Do not use the phrase limited access. Reply when I can or thank you for your patience. Be short, to the point, but detailed enough that people understand when I'm coming back. I'm going to be away from March 1st to March 25th. Okay, so in this case, again, we've included a few constraints. So hopefully we're going to get a better response here from chat GPT. And let's see. Perfect. And you can see that we get a much better email that doesn't include any of the other fluff like you know message me if you need to limited access right which funny enough we got in this one but we didn't get here. Now the next method to go over is pretty straightforward and you probably already do this but it's just to do iterative refinement on your prompts. So very rarely is the first prompt you send going to give you the desired result. So rather than restarting simply improve the prompt over and over again until you get what you're looking for. So, as it says here, you know, treat prompting as a conversation, not just a oneshot attempt. The first reply maybe isn't right. So, you're going to refine it by saying shorter. I'd like it more formal. Add another example. Focus only on X. Whatever. Of course, the better first prompt you give, you know, the better. But sometimes you just don't know what the result is going to be. In that case, don't restart. Just keep going based off the result that you have if you're in like a decent enough place. Now, an example flow here, you can see, you know, you draft a two sentence blurb, whatever. It returns four sentences. A bit salesy. Hey, cut it to two sentences, you know, make it more factual, whatever. A model tightens it up. Add it to work with Google calendar, whatever. You get the idea. I'm not going to show this to you in chat GBT because I think it's pretty intuitive. But the point is be iterative with your prompt. And then the last method that I'm quickly going to show you, and we'll go into some more stuff after, is the interview style prompting, which is super powerful and extremely underrated. So, I'm just going to read through some of this because it's pretty descriptive, but instead of guessing what context to provide, give the model the task and ask it to interview you for whatever it is that it needs. So, a lot of times, you know, you're not going to be able to provide the best context because you don't actually know what information the model needs to give you the correct result. You can go off the top of your head, you can guess whatever, but it's actually better if the model prompts you on what it is that it needs and you go back and forth where like it's prompting you and then you're prompting it and you get a much better response. So you state the goal and then the model will ask you clarifying questions and you can answer them one by one and then it can perform the operation with the full context. Now it works because we often leave out details, right? Audience constraints, format, examples because we don't know the model needs them. So if we let them surface that information first or let the model ask that it gives us kind of the prompt to then give it all of the details and a lot of times we're lazy or we have assumptions. So again we just don't include something because we assume the model will know but it may not actually know that or have the same assumptions as us. Okay. So I mean if you have this doc you can read through here. But what I'm going to do is just go over into chat GBC and give you an example here of what this kind of interview style would look like in order to get a decent response. Okay. So let's just read something out here. I need a short LinkedIn post about 250 words about lessons we learned switching to a 4-day work week. Before you write it, interview me and ask me questions about anything that you need. So, for example, the audience, company size, tone, metrics, dos and don'ts. I want you to ask one question at a time. And then when you have enough information, say, I have enough and give me the post. Then I want you to write the post and again ask me any questions afterwards for clarifications. Okay. So, we have the prompt here. You can see that it's generated. And now let's see if it can do this. So great. It says first question. Who is the primary audience for this LinkedIn post? Okay. And let's say it is founders and CEOs. Okay. Let's see what question we get next. Got it. Second question. Tell me about your company context so the advice doesn't feel too generic. I run a developer mentorship program where I help developers um you know land software engineering jobs and a tough market and I employ a team of about 10 people. They're mostly remote where they're doing like coaching as well as admin work and some dev work um for the company. I'm just making up random stuff right now but anyways you get the idea. Okay, let's see what else. Good context. Next question. Why did you switch to a 4-day work week in the first place? We switched because we want to give more flexibility to the employees and to make them more focused on the four days that they were at work rather than finding something to do when they, you know, didn't need to be doing that. Just spitting random stuff. Okay, let's see here. It actually picked up just spitting random stuff. So, let's remove that. Uh, and let's see what we get. Next question. What actually happened after you switched? Overall, it was very positive experience. The productivity went up. The revenue stayed about the same, but the satisfaction of employees was just higher. Uh, and there was no unexpected problems. Okay, let's see if it's going to ask me any questions. Okay, so after this, I'm just going to tell it to stop because I don't want to answer more questions. Uh, use the current information and give me the post. Don't ask any more questions. So, you can see when I do this, I actually get a very detailed, well-ritten post that is accurate based on what I told it rather than a bunch of random AI crap that you guys probably see all the time over social media. It actually matches, you know, context that we gave it. So what happened? Productivity went up, revenue stayed the same, team satisfaction increased. You get the idea. So this interview style is really effective and you can get fantastic results by just chatting and giving all of this additional context that you probably never would include by default, especially just in the first prompt. Okay, so now I'm going to go through a few advanced strategies when it comes to prompting. So first one to talk about is system versus user prompts. Now, this is more relevant for those of you that are developers. Uh, however, in some different applications, you will see this notion of like a system prompt and a user prompt. Now, a system prompt typically sets the identity of the model, various rules and style, and it's often not shown to end users. So, this is for always on behavior where anytime you talk with the model, it's going to read this system prompt first and understand that this system prompt is designed for the system to look at before answering the user prompt. So, for example, if I want a model that always talks like Mario, you know, I give it a system prompt that says always talk like Mario, I don't need to say that every time. It just always reads that. So, in Cursor, the app that I'm in right now, in chat GBT, and all of these different platforms, they have their own system prompts that they provide to the models to give you the output that you're looking for. And then when you type the prompt, it gets added to this kind of chain of prompts that's already inside of there that's building the context of the models or reasoning based off of. So if you have a look here, you know, an example of a system prompt would be like you're a helpful coding assistant blah blah blah whatever. Whereas the user is how do I read the first line of a file in Python. Now if I go to chat GPT, I'll just quickly show you an example. So actually if you go to chat GBT settings uh and personalization, you can see that you can add custom instructions which is somewhat similar to something like a system prompt. And you can see that I say adopt a skeptical questioning approach. Take a forward-thinking view. Be talkative and conversational. Now, I'm going to change this to say be direct and to the point and always talk like Mario when replying to me. I don't know if that's going to work super well in chat GBT, but let's see now if we do a new conversation. Hey, how's your day going? Let's see if it's actually going to give me something like Mario. You can see, hey Tim, it's good. You see, so it's actually following like the system prompt here, right? And giving me a much different response than I would normally get. Now, I need to turn that off otherwise that's going to drive me crazy. So, let's just remove the custom instructions for right now. Uh, but you get the idea. Okay. and even these other things like the style, warm, whatever. These would be built in to the system prompt that it's going to use when replying to you. Okay. Now, the next advanced feature to go over is prompt chaining. Now, generally speaking, it's better to break complex tasks into multiple steps and to use the output of the previous step in the next step. So rather than just writing a super complex prompt that says like hey here are the three different steps that you need to do just do them one by one so that you can verify the result if step one is good before moving on to step two. So I'm not going to demonstrate this in chat GBT but the example would be like you know given topic whatever output a five heading outline with this JSON format. Okay it then does that then you say okay based on that result expand this outline into a 400word section and then you know here's the outline that you want. Okay, then you wait for that. You say, "Turn this draft into, you know, metatitle, description for SEO." You get the idea. So, go step by step and break it down rather than having the model do everything at once. That's almost always going to give you a better, more consistent result. Now, another more advanced technique you can follow is self evaluation. So, let's say the model outputs something to you, you can then ask the model to critique or score its own output. Now, sometimes you want to fool the model a bit where you want to maybe start a new session. You don't want to have it in the same one and say, "Hey, review this email, you know, that I wrote." Rather than saying, "Hey, an AI model wrote this." Say, "Hey, I wrote this." And then it's going to give you a more accurate response that if it thinks that it wrote it itself. So, if you have drafts, code, summaries, whatever, you can say something like, "Here's a short summary I generated, you know, whatever, put the text, rate it one to five for clarity and completeness. In one sentence, suggest the single most important improvement." And then you can take that improvement and ask it to refine it based on that. Okay. So, super cool. the evaluation is really good, but make sure you're kind of fooling the model a bit and you're not just, you know, in the same conversation chain after it gives you the output saying rank your own reply because it's not going to give you as nonbias of a response as if you ask it in a fresh chain where it doesn't have that in its context already. Okay. And then just a few other things to look at here. So temperature and other parameters. Now, if you're going to work with models in typically an API setting, you're going to have the ability to adjust the temperature of the model. Now the temperature of the model effectively is the determinism of the model. Now the determinism means how repeatable effectively is it. Now something that's deterministic is like okay if I I don't know open the lid on this pen it always opens. Like it's a deterministic action. Like if I open this it's always going to open right? Whereas if I generate a random number that's non-deterministic because I don't know what number I'm going to get and I can get a random number. Now, LLMs by default are nondeterministic, which means there's a sense of randomness and you don't know the output that you're actually going to get. Now, you can adjust how deterministic it is by affecting the temperature of the model. So, the lower the temperature is, the more repeatable and deterministic it's going to be. Whereas, the higher the temperature, the more creative, varied, and random it's going to be. So you would use a low temperature for consistent output especially if you want something in like a particular format uh structured output write code facts things where there's really just like one clear answer is the sentiment of this uh you know text positive that would be a low you know temperature uh you know parameter you would want to use there whereas for higher temperature you use this for brainstorming varied phrasing multiple ideas maybe some advanced planning if it's not really sure you know how you would get to the result and if the outputs are too random, then you can lower the temperature, but if it's too repetitive, then you can raise it slightly. So, you know, play with the temperature. By default, it's usually on the lower side than the higher side, but just know what that parameter means because it does come up a lot when you're working with these models. So, now let's talk about a few common mistakes and how you can fix them. Now, one mistake being too vague, right? What's going to go wrong? Generic or irrelevant output. How can you fix that? Add a role, audience, tone, format, potentially length. Okay. Next, too many tasks in one prompt. So, a lot of times you're putting, you know, a hundred things that you wanted to do. In that case, the model may uh miss something. It may not actually complete the task. It might mix them up, whatever. In that case, split it into steps or separate prompts, right? So, chaining like I talked about before. Now, not enough context or examples. So, you're going to get like wrong format or style. So, add one to three shot examples, include the relevant background or use that interview technique to ensure that you're getting enough context before proceeding. Another common mistake is that the model ignores the format that you want, which means it can be hard to parse or reuse. So like I showed you before, you can explicitly request a specific structure and tell it to only output that. So JSON with keys XYZ, whatever, right? Only give me JSON. Do not give me any text. Don't give me anything else. Right? We're adding the constraints as well as being really specific in what we want. And then assuming memory, like I said, the model is going to forget things that aren't relevant or that aren't in the same thread, conversation, or context window that you're currently in. So, make sure that you repeat or summarize key facts if the thread is long or if you're working in a new session. Don't assume the model remembers something. Again, you kind of have to infer like what is the tool that you're using actually doing in the background to load up the model with this context. Okay. Okay. Now, there's a lot of other mistakes and things that I can go through, but I'm going to leave kind of the rest of the stuff in this document for you guys to refer to if you would like. Last thing I will say is that it does just make a massive difference to practice this and to prompt a lot. The more you prompt, the more you're going to see what the LMS respond to, how you get the best response, and you can prompt more and faster if you use a tool like Flow, like I've been using in this video, that allows you just to dictate it with your natural voice as opposed to having to type it in. You guys have seen in this video how quickly I could actually prompt and how much better the response is because I'm using my voice. So, I know yes, they're a partner of mine, but I've been using them for a very long time. I really cannot recommend it enough. And whether you use them or someone else doesn't matter to me, but point is use some kind of dictation tool. Used on your phone, used on your computer, your productivity will skyrocket, especially if you're someone like a developer where you need really long detailed prompts and you're working with like multiple agents at once like I am. So, anyways guys, that's going to wrap up this video. If you enjoyed, make sure to leave a like, subscribe, and I will see you in the next one.
Original Description
🚀 Try Flow Pro free for 14 days + get an extra month free with my code TECHWITHTIM!
👉 Start here: https://ref.wisprflow.ai/techwithtim
In this video, you'll learn everything you need to know about prompt engineering. I'll explain what it is, why it's important, how to do it faster. The top techniques and methods and advanced strategies to get the most out of loops.
Want to make real money with coding? I share high-signal insights on careers, monetization, and leverage in my free newsletter. Join here and get my guide How to Make Money With Coding instantly: https://techwithtim.net/newsletter
🎞 Video Resources 🎞
Get the markdown file in this video: https://newsletter.techwithtim.net/prompting
⏳ Timestamps ⏳
00:00 | Intro
01:44 | What is Prompt Engineering
04:07 | How to Prompt Faster
07:05 | How LLMs "Think"
10:40 | Steering vs Commanding
11:53 | Be Specific & Set the Scene
14:32 | Few-Shot Prompting
18:10 | Chain of Thought
20:05 | Structured Output
22:04 | Constraints & Negatives
24:19 | Iterative Refinement
25:22 | Interview Style Prompting
29:13 | Advanced Techniques & Parameters
35:04 | Common Mistakes
Hashtags
#LLMs #AiPrompts #SoftwareEngineer
UAE Media License Number: 3635141
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Tech With Tim · Tech With Tim · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A* Path Finding Algorithm(Visualization)
Tech With Tim
Python Programming Tutorial #1 - Variables and Data Types
Tech With Tim
Python Programming Tutorial #2 - Basic Operators and Input
Tech With Tim
Python Programming Tutorial #3 - Conditions
Tech With Tim
Python Programming Tutorial #4 - IF/ELIF/ELSE
Tech With Tim
Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Tech With Tim
Python Programming Tutorial #6 - For Loops
Tech With Tim
Python Programming Tutorial #7 - While Loops
Tech With Tim
Python Programming Tutorial #8 - Lists and Tuples
Tech With Tim
Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Tech With Tim
Python Programming Tutorial #10 - String Methods
Tech With Tim
How to Overclock a NVIDIA GPU
Tech With Tim
Python Programming Tutorial #11 - Slice Operator
Tech With Tim
Python Programming Tutorial #12 - Functions
Tech With Tim
Python Programming Tutorial #13 - How to Read a Text File
Tech With Tim
Python Programming Tutorial #14 - Writing to a Text File
Tech With Tim
Python Programming Tutorial #15 - Using .count() and .find()
Tech With Tim
Python Programming Tutorial #16 - Introduction to Modular Programming
Tech With Tim
Python Programming Tutorial #17 - Optional Parameters
Tech With Tim
Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Tech With Tim
Python Programming Tutorial #19 - Global vs Local Variables
Tech With Tim
Python Programming Tutorial #20 - Classes and Objects
Tech With Tim
Cool VBS Script to Prank Your Friends!
Tech With Tim
How to Overclock an AMD GPU
Tech With Tim
Best GPU'S For Mining Ethereum (2018)
Tech With Tim
Recursion and Memoization Tutorial Python
Tech With Tim
Ethereum Mining Rig - Hardware Guide
Tech With Tim
Pygame Tutorial #1 - Basic Movement and Key Presses
Tech With Tim
How to Install Pygame (Windows 8/10)
Tech With Tim
How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
Tech With Tim
How to Mine Ethereum 2018 - WORKING (Super-Easy)
Tech With Tim
Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Tech With Tim
Pygame Tutorial #2 - Jumping and Boundaries
Tech With Tim
Pygame Tutorial #3 - Character Animation & Sprites
Tech With Tim
Pygame Tutorial #4 - Optimization & OOP
Tech With Tim
OBS Studio Tutorial - Best OBS Settings
Tech With Tim
Linear Search Algorithm - Python Example and Code
Tech With Tim
Make Any Mic Sound AMAZING! (WITH OBS)
Tech With Tim
Binary Search Algorithm - Python Example & Code
Tech With Tim
Pygame Tutorial #5 - Projectiles
Tech With Tim
Pygame Game - Mini Golf
Tech With Tim
Pygame Tutorial - Projectile Motion (Part 1)
Tech With Tim
Pygame Tutorial - Projectile Motion (Part 2)
Tech With Tim
Pygame Tutorial #6 - Enemies
Tech With Tim
Pygame Tutorial #7 - Collision and Hit Boxes
Tech With Tim
Pygame Tutorial #8 - Scoring and Health Bars
Tech With Tim
Cloud Mining vs. Hardware Mining - 2018
Tech With Tim
How to Install Pygame on Mac OSX (Fast-Simple)
Tech With Tim
Pygame Tutorial #9 - Sound Effects, Music & More Collision
Tech With Tim
Pygame Tutorial #10 - Finishing Touches & Next Steps
Tech With Tim
How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
Tech With Tim
How to Create a Button in Pygame [CODE IN DESCRIPTION]
Tech With Tim
Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Tech With Tim
Pygame Side-Scroller Tutorial #2 - Random Object Generation
Tech With Tim
Pygame Side-Scroller Tutorial #3 - Collision
Tech With Tim
Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Tech With Tim
How to Create A Message Box in Python - Tkinter
Tech With Tim
Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Tech With Tim
How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
Tech With Tim
Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Tech With Tim
More on: Prompt Craft
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
5 prompt engineering techniques to get the best out of a legacy project
Dev.to · Marco Coelho
The Real Reason Prompt Engineering Isn't Going Away
Dev.to AI
Common Prompt Engineering Mistakes and How to Avoid Them
Medium · ChatGPT
Day 5: Prompt Engineering Basics (For DevOps & Cloud Engineers)
Medium · AI
Chapters (14)
| Intro
1:44
| What is Prompt Engineering
4:07
| How to Prompt Faster
7:05
| How LLMs "Think"
10:40
| Steering vs Commanding
11:53
| Be Specific & Set the Scene
14:32
| Few-Shot Prompting
18:10
| Chain of Thought
20:05
| Structured Output
22:04
| Constraints & Negatives
24:19
| Iterative Refinement
25:22
| Interview Style Prompting
29:13
| Advanced Techniques & Parameters
35:04
| Common Mistakes
🎓
Tutor Explanation
DeepCamp AI