Prompt Engineering Course Part 2 - Few-Shot Explained

WaldoGPT · Beginner ·✍️ Prompt Engineering ·1y ago

About this lesson

Few-shot/one-shot prompting techniques explained as simple and quickly as possible. ⏰Timestamps⏰ 0:00 What is Few-Shot Prompting 0:27 Example Few-Shot 1:36 What is One-shot Prompting 2:00 Example One-Shot 3:19 When to AVOID 5:42 When it SHINES 6:36 Essay Grader 📄 About: In this video, I’m breaking down Few-Shot Prompting, a powerful AI prompting technique that improves ChatGPT’s accuracy by using examples to guide responses. You’ll learn how it works, when to use it, when to avoid it, and how it compares to One-Shot Prompting. I’ll also show real-world examples so you can apply it effectively. If you want better, more structured AI responses, this is a must-watch! 🛠️ AI Tools used in this video ChatGPT #promptengineeringcourse #prompting #promptengineering

Full Transcript

OT prompting is when you provide examples or shots to the AI in order to guide its response to your questions or commands think of it as simply teaching the AI with examples of your own it may take a bit more typing but can really double or even triple the effectiveness of your prompt this technique is particularly useful for tasks that require a specific format or style in the response for example let's say you are launching your online store's newest t-shirt product and you want chpt to write the product description for you but this can give you a long-winded product description instead use a few shot technique to get a response that follows the same style or the same structure of previous product descriptions which we will use as examples here we can see how Chach PT match the two sentence structure from the provided examples as well as an emotional tone but keep in mind it's not always this simple and this easy if you're not careful with the kind of examples you provide you may be guiding the AI in the wrong direction giving you terrible responses and ultimately failing at your task by the end of this video you not only know how to use fot prompting correctly and it's Clos a related brother one shot prompting but you will also know what kind of situations F shot does well and what kind of situations it does poly if you're interested in a more beginner SL foundational technique I strongly recommend you watching my video on zero shot prompting here before watching the rest of this video Let's Start by understanding few shots little brother one shot one shot prompting is a subset of few shot prompting where instead of having multiple shots or examples one shot prompting has exactly one example and you may be thinking is there really a difference here for me one shot prompting is best for more straightforward task where a single example can easily capture the essence of what I'm after think about this pretend your company needs to hire a new role and you've been tasked in writing the job description for it now I don't know about you but I really hate writing these and I rather have Chach PT give it a go very simply I tell Chach PT that I am attaching an example of an existing job description for a payroll specialist and now I wanted to rewrite it for a data analyst role looking only at the format of the response and ignoring its content we can see how the response follows the same format as the example we provided in the prompt in there you'll see the job title an introduction job responsibilities and minimum requirements there is also an additional sentence CH PT added but I'm okay with that so what can we conclude from this little exercise well in this instance providing one good example was enough for ChaCha PT to mimic its structure to get us a brand new job description for a completely different role providing a second example in a prompt making a f shot prompt would have done very little to improve the response at least based on our general objectives up until now we've covered prompts with many examples one example but what about no examples the thing is not all prompts need or should have examples to get great results depending on your end goal you should consider excluding examples within your prompt let's take a look at some situations where you should avoid few shot or one shot by far the number one reason when you should avoid using fuch shop prompting is when creativity and exploration are critical you want Chach PT to help you brainstorm ideas for a birthday or holiday gift you provide context to Chach PT about who you're gifting to and also include examples of what they like in the past however here lies the double-edged sword the problem with this prompt is that the three examples in it are all very similar essentially drawing related type of gifts so Chacha PT will pick up that pattern and also respond mostly with drawing related gifts this is a classic example of overfitting now we can fix the prompt earlier by providing a wider range of past gifts but probably a better idea is a more open-ended yet contextually relevant prompt a zero shot prompt like this one keeps the same relevant context of the gift recipient but does not really limit the gift ideas to any category looking at these results I really like a few of these quite a lot I think I'll go with the plate kitchen set by the way if you if you're interested in leveraging chat PT to give you amazing gift ideas watch my video on it here on the opposite end when creativity is not so important and specificity is highly critical such as in legal documents or coding scripts providing examples in your prompt May generally give the AI some of the guidance into what the response should look like but it may not catch all of the nuances required for a successful output take Ben as an example Ben just started a coffee shop and is right his HR procedures for his employees Ben already has a document on how to request time off and wants to use this as a basis for chat gbt to write a document on how to request a schedule change in this example these two procedures are very similar but there's obviously no way CH PT can pick up all the nuances of these steps without specific guidance for example requesting time off might involve submitting dates in advance and waiting for manager approval while requesting a schedule change could include additional steps like finding a coworker to cover shifts for these type of tasks a different prompting technique that includes detailed instructions might work better than examples alone now that you know when to avoid futar prompting what about when you should absolutely use futar prompting there are two main reasons as I see it number one consistency when you need consistency in the response or in other words when you need to match the format or style of something already existing earlier in the video we saw how providing examples of unique product description still yielded a very good response from Chacha BT when asking to describe a new graphic T it replicated the same length and tone from the example and remember this also works for long text too such as when we created a new job description based on an existing one number two structured reasoning fop prompting does not only have the ability to mimic format or style as I showed you earlier it can also mimic how you think through Decisions by analyzing the patterns and how those decisions are made have you ever heard the expression monkey see monkey do let's say I'm a fourth grade science teacher grading short answer questions about the water cycle here I provided chat PT a simple rubric on how I score student responses out of 10 points there are five points for completeness for correctly explaining each process three points for clarity based on The Logical flow of that explanation and two points for grammar I've also provided here examples of student responses I have personally graded this is what makes it few shot now I can ask jgpt to grade new responses based on the rubric and the examples I provided Let's test this out with my very own written responses for explaining the water cycle don't laugh if I don't get a perfect score all right five points for completeness three points for clarity and two points for grammar that's great look at that a perfect score how about about it by now you should know that fuse shot prompting is a powerful technique when you need the AI to understand specific formats Styles tones and even reasoning but what happens if the task at hand is too complex and examples just won't cut it what if there are multiple steps or the response requires multiple inputs in the next video we'll explore prompt chaining a game changer technique that lets you guide the AI through a series of steps to get exactly what you need

Original Description

Few-shot/one-shot prompting techniques explained as simple and quickly as possible. ⏰Timestamps⏰ 0:00 What is Few-Shot Prompting 0:27 Example Few-Shot 1:36 What is One-shot Prompting 2:00 Example One-Shot 3:19 When to AVOID 5:42 When it SHINES 6:36 Essay Grader 📄 About: In this video, I’m breaking down Few-Shot Prompting, a powerful AI prompting technique that improves ChatGPT’s accuracy by using examples to guide responses. You’ll learn how it works, when to use it, when to avoid it, and how it compares to One-Shot Prompting. I’ll also show real-world examples so you can apply it effectively. If you want better, more structured AI responses, this is a must-watch! 🛠️ AI Tools used in this video ChatGPT #promptengineeringcourse #prompting #promptengineering
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

Chapters (7)

What is Few-Shot Prompting
0:27 Example Few-Shot
1:36 What is One-shot Prompting
2:00 Example One-Shot
3:19 When to AVOID
5:42 When it SHINES
6:36 Essay Grader
Up next
7 Best ChatGPT Prompts to Power Up Your Marketing Strategy
LoverFighterWriter
Watch →