Hands-On AI 5 Transcript
Please be advised that this transcript is AI-generated and may not be word-for-word. Time codes refer to the approximate times in the ad-free version of the show.
Mikah Sargent [00:00:00]:
All right, I'd say it's about time we start leveling up your AI skills. Now, over the course of this show, you've learned that a chatbot or an AI system can answer the same question that you ask it in different ways. In fact, the, the exact same question can be answered in different ways. And I wanted to dig into why that's the case. And in doing so, It came time to realize that what we once expected of AI systems may not always be how they adapt over time. Because I asked ChatGPT the same thing 5 times. I chose ChatGPT because it's a popular chatbot used by many people. And well, we'll talk about what happened when I asked it the same question.
Mikah Sargent [00:00:57]:
We'll talk about why it happened the way that it did, and we'll talk about what people mean when they say prompt engineering. All of that and more coming up on Hands on AI.
TWiT.tv [00:01:11]:
Podcasts you love. From people you trust.
Mikah Sargent [00:01:16]:
This is TWiT. Welcome to Hands on AI. I'm Micah Sargent, and today we are looking at prompting and getting a better sort of understanding of how prompting works, what you can do to make adjustments, and why some people say prompt engineering is the way— is going the way of the dodo, and why I say, well, it still does matter just a little bit. So there's a lot here, and I think it's time to dig in. So let's take a look at the prompt. I tried to go with something that a lot of people would likely ask of their chatbot. The question was, write a short text to my friend Sam canceling our dinner plans tonight. And in setting this up with ChatGPT, I set it so that each of the runs got its own fresh chat.
Mikah Sargent [00:02:17]:
That meant that it was not having any previous context. It was one fresh chat starting over, a little bit like what we did whenever we were using Ollama and doing local LLMs. You clear it out, you start fresh. It was a temporary chat so that it didn't have access to any of my memory. And then new in ChatGPT is something called unpersonalized because ChatGPT gives you the ability to choose between having memory and connectors and all sorts of tools that are part of your prompt, or just for it to be a plain old chat, you talking to the system. So I set this up. So that each one had nothing about me. It means that it stays out of my history and it doesn't use any memories, no custom instructions.
Mikah Sargent [00:03:06]:
That way it's just working with the prompt on its own. Now with this, I set up GPT-6 as the model, which is part of ChatGPT or OpenAI's latest models, and I set the effort to high. So the reason I'm giving you all of this is because these are experiments and you need to know exactly how the experiment was set up so that you can understand how it came out. So every single run had GPT-6 at high, and in each one of them, the responses were relatively similar. It was 5 texts, and in each of the responses that I got back, every single one of them started with, Hey Sam. And then it apologized and then it canceled and then it asks Sam for understanding. So pretty similar when it comes to the texts, right? Very similar texts across all 5 runs. 3 of those runs in fact said a version of, I need to cancel dinner tonight.
Mikah Sargent [00:04:13]:
2 of them said, I won't be able to make dinner tonight. And There was an exact match between runs 4 and 5. They matched word for word. And this is, this is despite the fact that what we once were told, that a, an AI system, an AI bot, an AI, an LLM is non-deterministic, that it will give you different responses every time. Yes, it can give you different responses, but a lot of them are going to be incredibly similar, if not exactly the same. Those last 2 matching word for word. Now, runs 1 through 3, they did differ from each other in punctuation. They differed from each other in the apology, and they differed from each other with a smiley face emoji.
Mikah Sargent [00:05:06]:
None of them decided to give a reason or a new night that we could get together to have food. So I thought, if, if this is the outcome of prompting with the same prompt 5 times and getting slightly different variations, is there a way we can kind of have a control? Is there a way that we can ask a question that will give us the same result each time no matter what? So That was pretty simple. I just had to ask it a question that had one right answer. What's the capital of Australia? Answer in one word. That was the prompt. And each of those 5 fresh temporary chats, unpersonalized, all said Canberra all 5 times. And that is the consistent response in the test. So again, for you scientists out there, uh, there was a control used as part of this experiment.
Mikah Sargent [00:06:13]:
But let's talk about where the differences come from when it comes to prompting your AI, whatever AI you choose to use, because there are different things that can shape an answer. And that is why even in something that is relatively similar in its response, there were still differences. So we gotta take a look at what inputs and outputs actually make a change? What in the world can shape an answer? First, sampling. So a model like this, GPT-6, builds— we've talked about this in the past in our episode about large language models— a model builds text a token at a time. Remember, tokens are little groups. They're not exactly letters. They're little groupings, little chunks of characters. And One way that the model can choose the next token to drop is to sample from its possible choices.
Mikah Sargent [00:07:15]:
Remember, it's like rolling the weighted dice. And the, the other thing that's involved in this is temperature. I really encourage you to go back and check out the episode on large language models to learn more about these terms if you're unfamiliar with them. But temperature will change how strongly those odds will choose the sort of most popular answer for what comes next. So we look through that in episode 2, we change the temperature. Now, ChatGPT, of course, does not have the ability in its online site to change the temperature. So there's no temperature slider. It is doing its own thing in the background.
Mikah Sargent [00:07:57]:
And that means that we can't change it. So instead, It is affected by earlier words and then what comes after. Small splits. It's, it's almost like the, um, the many worlds theory or, or multi, multi-universe theory. The idea that every new decision branches off into different universe possibilities. The same thing kind of applies here. Every time the tokens go a different way, it's going to change what comes out next. So Earlier words as we see them are tokens broken up, and those will shape what happens afterward.
Mikah Sargent [00:08:39]:
Each new piece is picked based on what's already there. So once one response comes through and it says, I need to cancel, and another says, I won't be able to make, just that part, then what comes next is obviously going to have a different starting point. So when we had those runs earlier, And we got the responses that we got, think about how the first one through the third one go on to say, hope you understand, let's reschedule soon. And then 4 and 5 actually ask, can we reschedule for another day? And those end, hope you understand. So whatever came before, after that dice roll, is going to shape what comes after. And that's where those similarities can kind of come into play. But here's the thing, and it's one important part of what I wanted to touch on, because there was a time where you would hear that AI is, you know, it's, it's, um, you could never trust that it's going to give you the right answer. And remember that overall, I talk about how important it is to check the work that your AI system is doing, but That doesn't mean that over time things have gotten a little bit generic.
Mikah Sargent [00:10:05]:
Why? Why did I get almost the same text 5 times if it's supposed to be that AI never gives you the same answer twice? Well, there are studies on this. Yay, we love science. First and foremost, training is something that will take variety out of the equation to some extent. Studies have found that certain kinds of post-training— and remember, that's that extra training that helps a model act more like an assistant, because there's the pre-training that gives the, uh, LLM the ability to write tokens based on tokens that it sees. And response, but that post-training that comes in and says, yeah, I don't like that response that you gave. And then it adjusts those knobs we talked about. Some post-training can narrow the range of answers that it gives. And in fact, one study links that to a preference for familiar-sounding answers in training feedback, which makes sense if humans are looking for the familiar-sounding answers over other answers during the training.
Mikah Sargent [00:11:19]:
Then yeah, that is going to be why things start to sound more generic and more what a human would pick. Researchers actually have a name for this loss of variety. It's called mode collapse. So if you hear anyone talking about mode collapse, now you know what that means. It's sort of a loss of quote unquote creativity and variety, so to speak, in the AI model's response. So that could be part of the explanation here. That could be why we're seeing such similar responses and 2 of them actually being the exact same response. But the fact is, that's such a small amount of data.
Mikah Sargent [00:12:03]:
5 chats cannot tell us why ChatGPT repeated itself. So if that's Sort of what you're, what you're thinking about, understand that no, it doesn't give us the full picture. Now remember, at my original prompt, I kept it relatively vague. I said, write a short text to my friend Sam canceling our dinner plans tonight. So I left out the reason that I actually had. I left out a new night as an option for it to pitch. And in those 5 replies, we have to give ChatGPT credit because it did leave those out too. It didn't try to make one up and That's good.
Mikah Sargent [00:12:43]:
That's right. That's what post-training does. It doesn't know why. It doesn't know if there's another night that I have available in those unpersonalized chats. It could, if it's working as a full agent, use its tools to figure out other days and suggest them to me. But a chat that has no other tools and no awareness should respond with something that doesn't have that extra awareness attached. Otherwise, it's making things up. So for the version that I actually want and for the version that you probably want, those details matter.
Mikah Sargent [00:13:21]:
And so these are obviously very generic responses to my friend Sam, and therefore it's not a message that I would send because it's not very helpful to me or to Sam. And that is where more comes into play when it comes to how the answer is shaped. In a chatbot, the other things that can shape the answer are app settings and context. They are the additions on top of those weighted dice that we talked about. Your saved memories, perhaps the fact that the AI system knows that on Thursdays you have a game night that you do, that's going to make a difference in how the answer comes out. You could also say, maybe at some point you said, I never want to use AI systems to write messages to my friends. So if I ever ask you for that, make sure I don't go through with it and remind me. That may be something that I've done in the past.
Mikah Sargent [00:14:32]:
You sort of said, I want to handle that. So if I'm ever doing that, Check in with me. And that, of course, is going to affect it. Also, that's not all. Which model answers, how much thinking it does, that's the GPT-6 and the High in this case, can also change it as well. So that's why I tried to keep those things as standard as possible. But you may find that if you do this with medium effort or low effort or a different model or a completely different model from another company, that can make a difference as well. So if you are trying to prompt for something and an answer feels generic, then the best thing that you can do, and this is where you are expanding on your AI skills, is to give it something, give it the stuff that only you know.
Mikah Sargent [00:15:29]:
The stuff that it can't answer itself, the stuff that you are providing to make the answer more unique. In other words, what you need to do is fill in the blanks. By filling in the blanks, you are giving the AI system more to work with and give you, give it more variety that will allow for its token generation to branch off in different ways. So we're going to do the same setup. We're going to do it in 5 fresh chats. And well, I think we'll do it in, in 3 fresh chats just so that it's not as, um, as, uh, it doesn't take as long. And, uh, let's give it a reason. Okay? So we're gonna fill in the blanks of the things that I know.
Mikah Sargent [00:16:20]:
So wait, what's the reason that I can't, uh, hang out? Well, work. ran late. What is the sort of tone that I want to give the AI system for being able to respond? Let's say it's casual and it's warm, but I know my friend Sam is not big on emoji, and I also want to make sure that Sam knows that I'm taking things seriously, so we won't put emoji in. Also, what about a different day? Let's go with Thursday instead. In this case, I don't have a Thursday game night. And then, and this is big, The length, under 25 words. So look at how much we are limiting the system, but in doing so, also filling in the blanks to give it something that doesn't feel as generic. It's odd to think of it that way, but it opens up the possibilities for something that you're more likely to want to use.
Mikah Sargent [00:17:21]:
So in this case, we're going to go with, write a text to my friend Sam canceling our dinner tonight. Reason, work ran late. Tone, casual and warm, no emoji. Offer, Thursday instead. Keep it under 25 words. Okay? So let's take a look at how this turns out. All right. I'm here in my temporary chat.
Mikah Sargent [00:17:41]:
And again, I said we'll do about 3 of these and we will work with that. Now I've got temporary chat, I've got unpersonalized, and I'm going to go ahead. I've got hi, and let's make sure we're in GPT-6. Yes, we are. GPT-6 with thinking effort set to high. We'll hit return. Then we'll go to the next one. We'll hit return.
Mikah Sargent [00:18:03]:
Then we'll go to the next one and we'll hit return. And let's see what the responses end up being. First one, hey Sam, sorry, but work ran late and I can't make dinner tonight. Could we do Thursday instead? Would love to catch up. The next one, hey Sam, sorry, but work ran late and I can't make dinner tonight. Could we do Thursday instead? Hope that works. And then, hey Sam, work ran late, so I can't make dinner tonight. Sorry about that.
Mikah Sargent [00:18:26]:
Would Thursday work instead? Those are all rather different from the responses that we got before. No emoji. The reason is in there. We've got Thursday. Let's see, 25 words or less. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18. 18. Now remember, there is a reason that I decided to read those, and that's because without tools and code at its disposal, it may not be able to properly read how many words there are because it thinks in tokens.
Mikah Sargent [00:19:05]:
It doesn't think in words. So those are 3 different responses, and frankly, one of those might be an answer I would actually, or a text I would actually send to a friend. Now, This AI system, specifically ChatGPT, offers some other options to make changes to it. But I want to do something that I recommend to anyone who's using these systems, and that is doing more to personalize them to you and also doing what I like to call post-post-training. And honestly, there are probably some people who will cringe about that because you're not technically training the model. You are instead just providing more content text for the next tokens that will be output. But I like to call it post-post-training because you are giving the AI system some examples of how you want things to look. And this is where I see a lot of people miss the mark on getting what they want out of a system.
Mikah Sargent [00:20:07]:
They think of it more like this magic thing that will take what you ask and put something out. But if you don't ground it in some sort of reality of what you're asking for, it often misses the mark. So instead, I am going to give it some style options of how I text. Now, again, this example is not one that I would actually use, first and foremost, because look at how much more time it's taking to try to figure out what the text should be instead of just sending a text to your friend. But think of this as an example that you can build upon. Okay? So in this case, we have some examples to add. We have— I included the original prompt, but afterward I said 2 examples of how I usually text. And then I made these up.
Mikah Sargent [00:20:56]:
One says, running 10 late, comma, save me a seat, question mark. And the other one says, can't do trivia tonight, comma, sorry, next week for sure. So you'll notice that it doesn't use sort of full sentences, conventions that would be more, more natural in terms of communicating out loud, and instead uses a sort of shorthand text speak. So in these 3 chats that are also unpersonalized and temporary, we're going to prompt it with those examples and see what it comes up with. Now, keep in mind, this is even more Even just by having more text, it's more context than we've had before, more tokens for it to work with at the beginning, and more potential for different outcomes that we might have. So with all of that kicked out, and instead the same prompt, keep it under 25 words, no emoji, et cetera. And with these examples, here are the responses. Work ran late.
Mikah Sargent [00:22:00]:
Can't do dinner tonight. Sorry. Thursday instead. The next one, hey Sam, work ran late, so I can't do dinner tonight. Sorry. Thursday instead. And lastly, work ran late. Can't do dinner tonight.
Mikah Sargent [00:22:10]:
Sorry. Thursday instead. So check that out. The first one and the third one are, I believe, word for word identical. And part of that can be because work ran late ended up sticking in both of those responses, which of course then makes it more likely that can't do dinner tonight would be the next part of that, which then makes it more likely that what came after is going to be the next part of that versus the second one where the dice were rolled a little bit differently. And so the response started with, hey Sam, which can then shape what comes after. With that style in there, you get a little bit more of what you're wanting. But look, the goal here was not to have 5 different answers or 5 identical answers.
Mikah Sargent [00:23:08]:
The goal is to have an answer that you'd actually send. That is what people mean. That's all they mean when they're talking about prompt engineering. It sounds like some special, you know, um, I'm a prompt engineer. It's, it's just writing and refining the set of instructions that you have for the AI system to guide the system to the answer that you're after. So how did I prompt engineer here? Well, I did that by filling in the blanks like we talked about, and then showing the style that I wanted afterward. Those are the means of prompt engineering. And that gives the AI model less to have to guess about and more context of what you're actually after.
Mikah Sargent [00:24:01]:
It's the relevant details that make the difference. Now, you will hear, if you go out into the AI community, a lot of conversation around not overdoing it, not giving your AI system too much because you are limiting its ability to think creatively, so to speak. And I think that there's a balance to find. I have in recent days begun to make it— make my prompts less about how exactly I want the system to achieve what I'm after. While also getting more detailed about what it is in the end that I'm after. But when it comes to these kinds of, these, these special details, you don't want the system inventing them, and you probably don't want the system leaving them out. Both of those are going to result in answers that are not as helpful for you. The most important thing to take away though.
Mikah Sargent [00:25:06]:
With prompt engineering and hearing about how you are going to get the best responses is something pretty simple. Prompting, it's not magic. You don't need secret phrases these days. You don't have to say, you don't have to add a bunch of keywords at the end like we did in the early days. The habits, this is kind of the funny thing, but it makes sense when you think about how these models were created and how they were trained. The habits that work for the AI models are now pretty much the same ones that work when you ask a person for help, right? Think about it. Say what it's for. So a text to a friend, an email to your boss, a note for a kid's teacher.
Mikah Sargent [00:25:57]:
Give the details that only you know, those relevant details. That matter to the outcome. That could be the reason that you're trying to do this, the deadline that you have, who it's going to. Say the shape that you want without, without pushing too much on how it needs to achieve it. Tell it how long you want this, this message to be, or what tone you want this paragraph to have. to be, whether you want it as a list or you want it as a paragraph. And then there's one I stress more than any other. For goodness' sakes, give it an example.
Mikah Sargent [00:26:39]:
Show an example when the style matters, or when the, the, the, the layout matters, or the output matters, that it matches the current output. And then And after all of that, of course, check whether the result that you get fits. Because if the first answer that you get back misses, it's not game over. You can tell it what to change. In fact, OpenAI in its own guide on prompting has a name for this. It calls it iterative prompting. Refinement. So first, try something, look at what comes out of it, and then adjust it.
Mikah Sargent [00:27:28]:
Very easy. And it's not a matter of you doing something the wrong way, right? So a failed response after the first try is not a complete failure. You can tell it more about what you want. And bear in mind that even in those temporary chats that are unpersonalized, I'm using, you know, ChatGPT's language here because this is the model that we used, every new addition is more context for the AI system to use to better answer the question that you have or provide the result that you're after. It's super cool, the iterative refinement and how it, by the nature of the way that these systems work, it can build on itself. So let's bring this to a close. If an answer feels generic to you, Look for a detail to add or an example that you could include, and then see how that response changes and hopefully is improved. If you'd like some homework, how about you pick something that you ask a chatbot for a lot? Look at the answer that you're getting now, and then find that blank that it left empty or that it tried to guess at, which we hope it's not doing.
Mikah Sargent [00:28:50]:
Then fill in that blank and ask it again and see if you get a better result that you don't have to then take and edit and edit and edit and edit down. It might just surprise you what that iterative refinement can do for you. Hey, send your questions, your AI questions at least, to hands on ai@twit.tv and you just might hear your yours answered on the show. Hit subscribe or follow wherever you're watching or listening, or head to twit.tv/HOAI. And if you want it ad-free, well, that's Club Twit, twit.tv/ClubTwit. I'm Micah Sargent. Don't just wonder about AI, get your hands on it. I'll see you next time.