"ChatGPT in the industry" - Part 2
Prompt Engineering
The potential of ChatGPT is huge. But how are good requests to ChatGPT structured or technically formulated? How does the systematic formulation of effective prompts work? This part of the article series provides answers.
The first part of this article series looked at the evolution and enormous potential of Large Language Models (LLMs) such as ChatGPT. It outlined the potential impact on our industrial organizations and our working lives. This article focuses on one particular aspect: How are good ChatGPT queries constructed or technically formulated? How does the systematic formulation of effective prompts work? This skill, called prompt engineering, is at the heart of the efficient use of LLMs in enterprise applications and is an important key to unlocking the full potential of ChatGPT.
To introduce the topic of prompt engineering, this article focuses on direct interaction with an artificial intelligence such as ChatGPT via a web interface. Figuratively speaking, this user level corresponds to the tip of the iceberg when dealing with LLMs. In addition to the prompt explicitly formulated by the user, there are a number of other influencing variables that determine the quality of the result.
Figure 1: The schematic representation of the different levels from prompts for direct communication via a web interface (user level) to training your own models, which requires special tools and in-depth knowledge of machine learning.
© talsen teamFrom the different levels in Figure 1, it quickly becomes clear that the specific variants for prompts ultimately depend on the technical and data-related substructure of the model. At the user level described in this article, these influencing variables are predetermined by the provider and cannot be changed by us as users.
The remainder of this article describes the perspective for prompt positioning and formulation from the perspective of ChatGPT using the gpt-4 model from the provider OpenAI. This is currently the most powerful platform and is therefore very well suited for productive use in companies. However, it is to be expected that other companies such as Google or Facebook will also publish platforms with models that have comparable or possibly even better properties in the course of this year.
The basic rule for a good prompt, as formulated by the creators of ChatGPT (source: https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/1/introduction), can be summarized as follows: A good prompt is roughly equivalent to giving work instructions to a person who has the basic skills to solve the task, but has no specific information or context to do so. If a task is performed unsatisfactorily or incorrectly, this is often the result of a task that is too vague and lacks the necessary accompanying information for successful completion.
The "good" prompt
In contrast, a good prompt is therefore characterized by clear, specific instructions that are supported by separators, structured output formats and the respective verification of the necessary information and conditions for the successful completion of the task. An important principle here is that the model is given sufficient "time to think". This refers to the formulation of prompts in the sense of chains of thought or processing steps that the model must follow before a final answer is given. This way of making the thought processes visible not only leads to an easier evaluation of the result, but is also advantageous for the model to recognize the right connections and draw the right conclusions. Simple concrete examples of good prompts that follow these rules include a prompt for summarizing and sorting manually made meeting notes:
Prompt 1:
- Summarize the given meeting notes in one paragraph.
- Then write a bullet point list of the speakers and their most important contributions.
- Finally, list the next steps or recommendations for action suggested by the speakers, if any.
The following specific rules and principles were used for this prompt:
- Use separators: the prompt clearly separates the different subtasks (summary, list of speakers, next steps) through the bullet points.
- Ask for a structured output: A structured output in the form of a summary and a list is required.
- Explicitly state the steps required to complete the task. This corresponds to the rule "give the model time to think".
Another very common scenario is translations of texts into different languages. Here is a corresponding example prompt which, in addition to the pure translation, also includes a further structural requirement and a linguistic adaptation:
Prompt 2:
- Translate the given technical documentation from German to English. The structure and layout of the text should be retained. Try to make the text as clear and simple as possible without losing technical details or accuracy.
The aim is to make the text easier to understand for readers without specialized technical knowledge, while retaining the essential information and technical accuracy. Please also indicate if certain technical concepts cannot be simplified further without distorting their meaning:
``` ... Here is the text of the technical documentation ....```
| General structured prompt |
|---|
|
An example of a general structured prompt as a starting point for a complex prompt that includes additional context and multi-level processing:
|
A closer analysis of the prompt reveals the use of the following rules:
- Clear and specific instructions: the required translation task with its specific constraints is formulated precisely and concretely.
- Use separators: The prompt clearly separates the instruction from the text to be processed by the triple apostrophes (```... ```).
- Ask for a structured output: The expected structure of the translated text is defined by the structure of the source document.
- Give the model time to think: By requesting an additional explanation for critical formulations or oversimplifications, the model assumptions are made visible and can therefore be corrected more easily by hand if necessary.
These two examples and the respective analyses show what mechanisms can be hidden behind a simple formulation, which have a very strong influence on the quality of the results. Without claiming to be exhaustive, our practical experience allows us to distinguish and describe certain general prompt variants for different purposes:
- Simple prompt ("describe, create, sort, ..."): simple queries that are formulated contextually or are part of a larger query.
- Structured standard prompt ("Given: ..., Then: ..."): Systematic information input that contains the necessary details for good task processing as well as all necessary instructions and role definitions. This type of formulation allows good repeatability of the prompt and reduces unwanted external influences. It should form the majority of productive prompts used.
- Command prompt ("I command" ..., or alternatively: "it is very important for me"): Scientific publications suggest that so-called emotional triggers have an influence on the result quality of today's LLMs. The positive effect of these triggers can be particularly noticeable with complex requests.
- Collaboration prompt or SplitGPT ("You are two people ..."): By assigning different roles within a chat, different perspectives can be actively taken into account when working out the result. This corresponds to a special form of the principle of giving the model time to think by incorporating it into the query at the same time. This can significantly improve the quality of the results, particularly in the case of multi-level thinking tasks.
A concrete example of a prompt that requests elaboration from two different perspectives is as follows:
- The task is to <here is the specific task formulated>.
- You are now a duo of experts, consisting of <role X> and <role Y>. While one submits a proposal, the other analyzes and criticizes it or makes an improved counter-proposal. This dialog continues until the roles have been swapped at least a few times or until the experts reach an agreement.
- Finally, give me the joint, detailed result of the discussion <result name> of the task without abbreviations and without placeholders.
In this example, the content described in the angle brackets should be replaced by the actual task description, the roles to be named or the specific expected result.
A recommendation for action
Figure 2: General iterative work process derived from test-driven software development and adapted to the requirements of systematic prompt engineering.
© talsen teamDespite all the technical achievements, we are still at a very early stage in the development of LLMs. At the current state of the art, human interaction, or in other words the human-generated prompt, is the key to success. In the next technical development phase, the number of manual interactions required will be reduced and the degree of autonomy of the LLMs for finding solutions will be increased. In order to keep pace here, it is important not to use ChatGPT only in the sense of one-off requests. It is important to recognize the successful patterns behind your own prompts and to work with prompt templates in a targeted manner. In current application practice, the distinction between the different prompt variants mentioned above has proven to be very useful. An iterative approach, based on the test-driven software development process, has proved very successful for the further step-by-step development and refinement of prompts. The prompts are handled like the source code of software, which significantly reduces the problem of change management and traceability.
Reminder: The prompt examples refer to the use of ChatGPT with the GPT-4 model. When working with different models in everyday life, it is worth looking at prompts and code in order to keep an eye on optimal formulations for these model variants as well.

















