Skip to Main Content
Universiteitsbibliotheek – LibGuides

Artificial Intelligence (AI): Prompting

Prompting

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.

What to think about when writing a prompt

In general:

  • Always use clear language and give clear instructions
    • be brief and to the point
    • avoid negations
    • be specific
    • use descriptive adjectives, such as specific, detailed
  • Avoid bias in your prompt

Specific:

  • Determine your goal (expectation)
    Clearly indicate what you expect the AI tool to do and how you want the task to be carried out. For text generation start with indications such as 'Generate an introduction...'. For image generation you could start with words as 'sign' or 'make an image of...'.You can use modelling, so telling the tool at which step to begin and which next steps must be taken. Define a clear ultimate goal.
  • Define the role of the AI tool
    Define the role, or the perspective you want the AI tool to have. For text generation you could think of the 'voice' of the text, for instance journalist, expert or blogger. For image generation think of an artist or visual expert.
  • Determine your audience
    Specify your audience to determine the correct tone and style. For both image and text generation, keep professionals, researchers or the larger audience in mind.
  • Determine your boundaries
    Determine the limits of the format, the length or define other limitations. Think for instance of the number of words, the structure and bullet points in the case of text generation. In the case of image generation you could think of image types, frames and colours.
  • Determine your variables
    Put emphasis on important variables, details or other points that must be included in the output. For text generation it could be about the complexity or tone of voice. For image generation about lighting, style and colours.
  • Improve your prompt (refine)
    Give feedback on the output to improve it and to adjust further interaction with the tool.

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.

Prompt libraries

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?

Would you like to know more about prompting techniques? Check this prompt engineering guide.

Prompt evaluating

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.

  • Relevance: the extent to which the answer directly responds to the question.
  • Accuracy: the extent to which the answer gives correct, reliable information that is based on facts.
  • Completeness: the extent to which the answer deals with all essential aspects of the subject or the question.
  • Clarity : how easily the answer is understood by the intended audience.
  • Coherence: the extent to which the answer has a logical structure and is well-organised and flows easily from one point to the other.
  • Appropriateness : how well the answer fits the intended audience and the context and how appropriate and respectful it is as to tone of voice and content.

Experiment with different prompt frameworks and techniques to see which one best suits which goal. Evaluate the output by:

  • evaluating the sources that the GenAI tool has used for the output
  • checking on several forms of bias
  • keeping an eye on the updates of the tool you chose.

What is a GPT and what can you do with it?

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.

Existing GPTs or making one yourself

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:

  • the purpose of your GPT
  • which key tasks the GPT must perform and in what order
  • how the interaction proceeds (interaction style, step-by-step plan)
  • the desired tone, layout and (communication) style of the output
  • how the data is processed and what security or privacy aspects are involved
  • which capabilities of the generative AI tool you want to use (e.g. web search, DALL·E)
  • on which documentation or informationthe model should be trained (e.g. a specific book)
  • how to ensure that the GPT only provides relevant and correct answers

Get started with a GPT yourself

Are you curious about how you can get started yourself? Then watch this video for a step-by-step explanation.