chevron_left Back to all videos

The Generative AI Video-Series

How to master Prompt Engineering?

In this video, Omar, the senior AI trainer from the Applied AI Institute for Europe, reveals the basics of prompt engineering. The video is part of the generative AI Video-Series 'How to Master AI tools at Work' and provides valuable insights into different techniques to get accurate and efficient results from LLMs. Omar provides a practical cheat sheet with seven essential techniques. Among other things, the RTF framework is explained and methods such as context provision, prompt chaining and chain-of-thought prompting are presented. The video ends with a reminder of the importance of human supervision despite well-structured prompts and an invitation to learn more about AI.

If you want to know how to make the best prompts, stay with us in this video. Hello, my name is Omar and I'm the senior AI trainer here at Applied AI Institute for Europe. And welcome to our generative AI video series, How to master AI tools at Work. In this video series, we're going to go over the general principles of prompt engineering. And we're going to also provide you with a cheat sheet that's going to help you apply and use those principles in your day to day work. First, let's start with a couple of definitions. The prompt you might probably already know is just the message you send to LLMs. It's really just like a natural text that you send with a description of the task that you would like the AI to solve. Prompt engineering is then the process of how you structure this prompt in order to get the best result possible. So before we start, this is the cheat sheet with the techniques and recommendations that we are going to review today. Feel free to take a screenshot and save it for when you need to write a prompt. Now let's go to the first one. So getting into our techniques, first technique we have is called the RTF framework, which stands for role, task and format. And the goal of this framework is to really give you a fixed format and how to provide the context information to your tool that the tool needs to execute. Precisely execute the task at hand. So the role that can be project manager, a software engineer, and this is really the role that this AI is supposed to emulate. It's the persona that the AI takes for this particular task. 

The task is the problem that the AI is supposed to solve, or the email it has to write. And then finally, the format is how you would like to have the output look like, and in which way do you like it formatted. So, that could be an email, this could be writing a poem, but it also can be like, I would like to have a table with those headings. And those columns with, for example, a rating system. Let's look at some before and after using the RTF framework. Let's say you are a project manager and you need to prioritize some features for a new software application. Without RTF, we'd ask the AI how to prioritize the features for a new software application. And, as you can see, the answer answers how to prioritize the features for a new software application. But does not do the prioritization that we were expecting or that we needed. 

On the other hand, if you use the RTF framework, you can get closer to the answer you were looking for. Here we see that we gave our role to the AI and the specific task, which is provide a structured analysis of the features. Since we asked for the format and table form and rating system, We received the information we were looking for. Now, let's move on to the second technique, which is providing context and be as clear as possible. It's a very high level technique, it's not as concrete as using the RTF framework, but it definitely applies to whatever prompt or whatever task you're trying to achieve with the Generative AI tool. Let's say that you are a high school teacher working on your next class about the chaos theory. Without context, we build an unspecific prompt, such as explain the chaos theory, and you will receive an output similar to the Wikipedia in a really long answer. On the other hand, if we give context to the prompt, for example, By adding clear instructions, such as writing just 200 words, illustrating the chaos theory for a high school student, using only aspects from daily life, that you will obtain an answer crafted to your specific needs. Now, we go to the third prompt, which is prompt chaining versus megaprompt. 

Let's say you work in human resources, and you want to know how to do a proper employee development plan. A megaprompt would include all of your questions in one go. Like explaining how to identify tasks, measure goals, track the progress of the employees, and give feedback. However, the answer does not really provide how to do it. With prompt chaining, on the other hand, we ask the AI to solve task by task. And after we prompt our AI, it gives us a detailed and organized answer, that is already giving subtasks to each such as the ones that you see here. 

These subtests are more actionable steps that will allow you to create a proper employee development plan. Then we get to zero shot, one shot, and few shot learning. So zero shot is just giving the task to the AI tool without giving it an example to how the answer could look like. One shot, you give it one example, and then few shot, you give it more examples. And then the goal is to give Um, the AI tool, a bit of knowledge about how an answer could look like. For example, let's say you work in marketing, and a restaurant wants to analyze the sentiment of the reviews from many sites. You could just send all of the reviews to your AI and ask for a sentiment analysis, right? This would be called zero shot, as we are giving no examples to the AI. However, you might not get the result you want. Now, let's say we give the AI one example of how it should tag the reviews, such as linking the phrase the staff was not friendly at all and the food took too long with the tag of negative review, or maybe ever better using few shot, which is giving a few examples to the AI, such as a review example to tag as positive or mixed. Now, number five, we have prompt structuring. Prompt structuring is very simply just structure your prompt, and this would help you reduce the misunderstandings that can happen through the AI. Let's say you are a designer giving a monthly project update status for a website redesign. Now, as you have given this presentation before, you and here is where it gets structured, including the details between the double quotation marks. Structuring means to make use of paragraphs, punctuation, or tags to separate your prompt. In this way, you reduce the AI possibilities of misunderstanding the task. This is you telling the AI, look at the text between the quotation marks. This is how I would like to have the project status update look like, and so I give it the project name.

And now we come to chain of thought prompting. Now, what chain of thought helps you do is, is that by providing your reasoning within the prompt, how you would have a human reason about that problem, it would then be able to use that reasoning to solve other problems as well. Now this can apply to mathematics. This can apply to politics. Um, and it's just about you providing the AI with the way it should reason and go about a certain textual problem. To give an easy example, let's say we ask our AI for a mathematical question. After a first easy question, it would give a correct answer. However, if this question is more complex and need a specific step reasoning, it will probably give you an incorrect answer. In order to fix this, we would give our AI our reasoning as a chain of thought. For example, including to our math problem the answer, Sarah has 8 candies, 4 packs of 5 candies, each is 20, therefore 8 plus 20 equals 28. By adding this reasoning, the AI will apply this reasoning for your next problem and will be closer to a correct answer, or answer that you want. Then you have, finally, consistent qualifiers and setting the voice tone. Now, as we said, providing precise prompts would always help with how the AI can understand how you would set the tone. And so here's a list of qualifiers or voice tones that you can use. And this helps you as a prompt engineer know how you can add those adjectives or verbs to your prompts so that it becomes a bit more accurate. An example of using qualifiers would be using the word summarize, or brainstorm, or describe. And maybe a bit more of concrete or stuff. 

And then we're setting the voice tone, whether you want an informal or formal, academic, a bit humorous or friendly. And all of this also goes to image generation. So just like you have those things for text, you also have some things for the image generation. You have different styles that you can use, cubism, 3d. An abstract and then also how you would describe the image from which angle it's used, which color it would have. And these are all things that you can use within your prompt, which immensely improve the quality of the output. For example, let's say you are an industrial designer and you would like some ideas for a minimalist chair concept. We could ask the AI for something as specific as an industrial concept sketch of a minimalist chair with clean lines and ergonomic features. If you just entered, I would like to see a chair, then it would maybe. Showing you an office chair, which is definitely not a minimalist chair. And this is all things that you can use to improve and control the quality of your output. So now we've gone over all of those techniques that can help you structure your prompt more efficiently and effectively. And with that, you're always able to get a better output from the tool. 

What this doesn't mean, however, that is that you should blindly rely on the tool. The end of the day, generative AI tools are still prone to hallucinations. They can still output incorrect information, like for example saying that Mexico City is not the capital of Mexico. Therefore, you should always stay in the loop. So, in a nutshell, generative AI tools are extremely powerful. Just remember in the back of your mind, these AI tools are here to aid us and not to substitute us. If you've enjoyed watching this video, make sure to leave us a like, leave us a comment below with the techniques that you've tried and how they've worked or not. If you think there's a topic that you would like us to cover, please let us also know in the comments. And then finally, if you really enjoyed this video, make sure to hit the subscribe button and see you in the next one.

Share on: