What is prompt engineering?
Generative AI creates new content based on an input prompt. A prompt is a question or command written in natural language in an AI tool, with the intention of generating specific output. You can create prompts to generate text, images, or code.
An advantage of GenAI is that you do not need any programming skills to generate output. In addition, you can prompt in different languages.
Prompt engineering is the skill of creating high-quality prompts so that you get your desired result from the tool. With high-quality prompts you can also increase the reproducibility of your output. By prompting as efficiently as possible, you also limit the impact that the use of GenAI has on the environment.
In general:
Specific:
This list is based on the BRAVE(R) framework (Fox, et al, 2024). If you use this framework to prompt, you get the following template:
Set your goal (Expectation). Write like Role for a specific Audience. Also take Boundaries into account and not yet mentioned Variables.
Once you have a result, you can give the tool feedback to further refine the output (Refine).
Example:
Could you help me create an outline of the key concepts covered in my molecular biology course?(Expectation). For this task, take on the role of my tutor (Role). The suggestions should be suitable for a student preparing for a master's level exam (Audience). Focus on the most crucial points that are likely to be tested and present the information as bullet points (Boundaries). Highlight the main topics and their significance (Variables).
There are several frameworks for effective prompting, for example the PREPARE framework (Prompt, Role, Explicit, Parameters, Ask, Rate, Emotions). You can think of these frameworks as a kind of checklist that a prompt must comply with. If you want to go into more depth, read the article by Bsharat et al, (2024) about the 26 guiding principles for a perfect prompt.
There are also special prompt libraries, for example Maastricht University has a prompt library with various templates for writing prompts. In such a library you can look for prompts that have already proven themselves.
There is also a collection of prompt libraries available.
Prompt techniques
You do not need a complete framework for each task to be able to write a prompt. Depending on the output you wish for, you could adjust your prompt. You could give the tool a lot or little context, or use it as a source for inspiration. Each goal requires another extent of precision and completeness of the prompt. There are several ways to prompt:
Shot prompting is a technique you can use if you find that your prompt can be interpreted in multiple ways. Or if you are looking for a very specific layout, structure, style or language. You then add one or more examples to your prompt to give the GenAI tool more context and thus make it live up to your expectations. One example may be enough, but more complex tasks often require multiple examples to recognize a pattern.
Reverse prompting can be a useful means if you are not quite sure what the prompt should consist of to lead to the result you wish for. With this technique you ask the tool to make a prompt for you. You could use (a few parts) of the principles of prompt engineering to formulate the question.
Prompt chaining of prompt string with factored cognition. When you have complex prompts that consist of many tokens, it could happen that the GenAI tool cannot process the prompt. Such prompt must be entered in smaller portions. This is called factored cognition. By giving detailed, step-by-step instructions, you are in control of the process and you make sure that the output of the tool meets your expectations and the specific requirements of the task. It is important that you understand the topic well enough to divide it into the right parts and to effectively evaluate the output. If you can't evaluate the output, it may indicate that you need to gain a deeper understanding of the project before using GenAI tools. On this Tokenizer (OpenAI) you can check the number of tokens in your prompt.
Would you like to know more about prompting techniques? Check this prompt engineering guide.
GenAI tools are continuously under development. This means that the ' rules' for prompt engineering change as well. That is why you should always reflect on your use of the tools, the process you go through during the use of the tools and the output you get. Think carefully about the structure of your prompt. You can do this by taking into account the prompting techniques of your choice. Please keep in mind that the output also depends on the bias in the prompt itself. Check some examples to see how bias in the prompt may influence the outcome. Analyse the output in combination with the used prompt, for example based on the RACCCA framework and adjust your prompt if necessary.
Experiment with different prompt frameworks and techniques to see which one best suits which goal. Evaluate the output by:
Many generative AI tools offer the option of using a modified version of the LLMs to perform a specific task in the form of apps. Within the generative tool ChatGPT, these versions are called GPTs and are quite easy to make yourself without having to program.
For example, if you often have to perform the same task, such as grammatically checking your text, it may be beneficial to use a custom GPT instead of entering a new prompt each time. But a GPT is also useful if the LLM needs additional information on which it needs to be trained, for example if you want it to generate answers based on a certain information source such as a book.
There are already many ready-made GPTs that you can use, for example in the field of academic skills, coding or data analysis. However, if you want to tailor a model completely to your tasks or your training data, you can also create a GPT yourself. You usually need a paid account for this.
Key points to consider when creating your own custom GPT
Just like with prompting, when creating your own GPT it is important to use clear language when describing:
Are you curious about how you can get started yourself? Then watch this video for a step-by-step explanation.