Writing Good Prompts for ChatGPT
In this video, Rada Mihalcea, Professor of Computer Science and Engineering at the University of Michigan, discusses how to create prompts that will help you unlock ChatGPT's full potential and get the most out of this generative AI tool.
Excerpt From
Transcript
So interactions with these systems are primarily through prompting, some people would also refer to it as prompt engineering. And if we were to use a machine to write some prompts, ideally, you would write a number of them, you would also paraphrase them. And then send them all to something like GPT, and then see which one gives you the best response. So a lot of the work that is done in prompt engineering, mostly from a technical perspective would use that kind of strategy. Now, for people we cannot really write 100 prompts and see what comes best in response to those prompts. But we can still leverage that kind of idea and write prompts and then adjust them based on what we we get back. In terms of general guidelines, you would want to have a prompt that indicates what you want back, right? So maybe you will want a paragraph about, say climate change, right? So you want to indicate that. You will also want to indicate what kind of style you want given that these systems can in fact produce different styles. So you may want something formal, or you want something persuasive, or you want something and say third person singular. And then you can also provide an indication of context, for instance, this is for a larger article on climate change and you need this one particular paragraph that talks about maybe heat waves. And with that, then you can adjust, you see what comes back. GPT has in the interaction, it will have a way to regenerate the text, so if you don't like it, it will produce another one. Usually they are very similar to each other, so you really don't get that much variation just by regenerating. And instead you can try to put another prompt, maybe try to change the style, or maybe try to change the request. Or maybe even provided, for instance, there are multiple pieces of information that you already have available, maybe from things that were produced, you can ask it to summarize that. And so see how in which ways you could get a condensed information from the sources that you already have. So at this point, it's a lot of trial and error. Also because these models are very large, so not even the people who build them could exactly predict what will produce. So it's prompt engineering that you try and see what comes back. And also because the systems will change periodically, so for instance, the interactions will have with our GPT now might be different from what we had a month ago and from what we will have a month from now. And so that's why thinking of how to interact, it's useful over thinking might not be that useful because even if you get the best strategy now might not necessarily be applicable tomorrow. Good versus bad prompts, we'll go back to this idea of trial and error, which we do well also when we search online. So we have something in mind that we want to find and we'll put it in a Google search, or Bing search, or any other search engine and see what comes back. And then based on what comes back, we may adjust our query and try again. And so if it's an input that is too vague, then what you get back will be similarly vague. If it's too specific, you might not get back what you would expect. Now, it's something like GPT, it's similar to some extent, so if it's too broad, it will produce something very broad. If it's too specific, in my take a path that is not related to really what you wanted. I believe from my experience so far is that it always tries to produce something. So even if you go very specific, like maybe you give names and you give very clear specification as to what you want, it will try to produce something, but it might be completely different than what you had in mind. So there is that adjustment to find the sweet spot. And also the language should be relatively generic, because that seems that would work best. In technical terms, would be, and that's what is done when you try to find the ideal prompt automatically, you'll want those that would have the lowest perplexity with respect to the model, meaning that they are the easiest understood by the model. And so that's also the distinction between good and bad. You'll want the kind of language that would be most closely aligned to the language, the language model.