Artificial intelligence at the University of Tartu

2.3. Constructing a Prompt

To understand how to use AI applications, one must first understand how prompts work and how to write them most effectively. Only then can you explore the best ways to use AI or how to find purposeful uses for it in your daily tasks.

Text-based AI models can be used for a variety of tasks. In each field, a style and best practices for using text-based AI are either already established or beginning to emerge. However, there are general recommendations for writing prompts that apply in almost all fields to ensure the AI gives the best possible result.

A prompt is the text that the user inputs into the text-based AI, based on which the AI predicts the most likely response.

The prompt must be clear, specific, as accurate as possible, and written in correct language.

A prompt is the text that the user enters into the text-based AI, based on which the AI predicts the most likely response. Currently, in 2024, text-based AI models are very advanced and can predict well what the most likely response will be to a prompt like “Give me ideas on how to write an essay on consumer behavior.” Since the responses to even simple prompts are often quite good, it is easy to become complacent and not optimize the prompt. However, there are many effective techniques for improving prompts, which will ensure even more accurate results.

The language and style of the prompt are as important as its technical aspects. Currently, all text-based AI models are built on large language models that “think” in English (though “thinking” is a general term used to describe how these models work, as they do not think in the human sense but simply calculate). Although language models understand many languages and can respond in various languages, the most accurate results are currently achieved when the prompt is written in English (you can always translate the English result into the desired language using the AI application).

In addition to language, the prompt must be clear, specific, as accurate as possible, and written in correct language. The smoother and more polite the style of the prompt, the more likely it is to receive a good response. Since the text-based AI predicts the most likely continuation based on the prompt entered, a well-written prompt generally results in a well-written response.

The components of a prompt are role, goal, context, target audience, format, style, length, and example.

A prompt consists of specific components, each of which enhances the accuracy of the result. Below are the most important components of a prompt.

Role, the persona the AI responds as. By assigning a specific role to the text-based AI model, it provides a more specific response, as it can take into account the assumptions of the writer when crafting the answer, such as:

  • Act as an expert in consumer behaviour;
  • A university lecturer teaching Estonian history and preparing final exam questions;
  • An executive assistant sending reminder emails to employees of the organization;
  • A high school biology teacher doing [what?].

Goal, for example:

  • Creating a multiple-choice test;
  • Improving teaching;
  • Preparing a syllabus;
  • Summarising material;
  • Writing a reminder email, etc.

Context for which the prompt is used. For example, are you creating a text or assignment for a university, company, small rural school, large government institution, etc.?

Target audience, for whom the text or task is created, such as:

  • Undergraduate students;
  • PhD candidates;
  • Lecturers;
  • 7th-grade students;
  • Parents of 7th-grade students;
  • Entrepreneurs;
  • Conference attendees;
  • Mathematicians;
  • Translators, etc.

Response format, for example:

  • List;
  • Related text excerpt;
  • News headline;
  • Table with the following columns, etc.

You can also specify the desired style, tone, etc., of the text, such as:

  • Simple but engaging style;
  • Academic language;
  • Entertainment journalism with intriguing vocabulary.

Specify how long the response should be, for example:

  • 10 words;
  • 3–4 sentences;
  • 2 paragraphs;
  • 6 questions with 1 correct answer and 4 incorrect answers, etc.

In addition to these prompt components, it is always useful to provide the AI with examples of the desired text. Examples can be added as files or web links. If files cannot be added, it is worth writing illustrative text excerpts directly in the prompt. There is no need to copy excessively long text examples into the prompt window, as all currently used text-based AI models have set length limits for the prompt. For example, Microsoft Copilot has a text limit of around 800 words, ChatGPT-3.5 has 3,000 words, GPT-4 has 6,000 words, Gemini has 6,000 words, and Claude has 6,750 words. These are approximate figures, and the actual limit depends on the length of the words.

Not all useful steps for crafting a prompt can or should be listed. Here, the personal touch and creativity of the individual come into play. For example, there are endless variations for specifying the role. Below are just a few of the most common formulations for defining a role:

  • Imagine you are …
  • Act as …
  • Pretend to be …
  • Respond like a …
  • Take on the role of …
  • Answer as if you were …
  • Speak from the perspective of …

Self-assessment

To view third-party content, please accept cookies.

Task: Optimising a prompt

Let us revisit the earlier example: “Give me ideas on how to write an essay about consumer behaviour.”

Using Copilot, ChatGPT, or another AI application, refine this prompt by incorporating the key components outlined above. Test 2–3 different versions and determine which produces the best response.

Accept Cookies