|
Getting your Trinity Audio player ready...
|
Editor's preliminary remark
Dear readers,
If you have been following our 16-part series on artificial intelligence, you will have learned, among other things, how to improve your prompts (requests) in order to receive more accurate responses that meet your needs.
We have received numerous positive responses from our readers. Some readers would like to receive further advice on how to optimise their queries even more. We are happy to oblige and are publishing this article, which is aimed at readers who already have some experience with prompting.
Here is the link to the beginner's post again:
Artificial Intelligence 5 – Optimised prompts for optimal responses
How did this follow-up article about prompting come about?
We work exclusively with ChatGPT-4o, the paid version, to generate texts. Anyone interested in „advanced prompts“ will probably do the same. Google's Gemini is not yet competitive, even though Google is currently running massive television adverts for it.
So how can you further improve your prompts? No one knows this better than someone who has to deal with the prompts of millions of users every day. We asked ChatGPT directly what recommendations the system itself gives. The following comprehensive explanation, which introduces you to the finer points of working with artificial intelligence, comes from ChatGPT itself. Since the chatbot can be used worldwide, it generally uses the informal form of address. We have left it that way because it is authentic and because the informal form of address is common on the internet anyway.
How to get the most out of your prompts:
Tips and techniques for ChatGPT users
If you want to maximise the quality of ChatGPT's responses, there are various techniques you can incorporate into your prompts. Here are some proven methods for exploiting ChatGPT's full potential. These techniques allow you to control the balance between creativity and precision even more precisely than the default settings allow:
1. The basic structure of a good prompt
A good prompt should be clear, concise, and rich in context. These elements can improve your inputs:
- specificityThe more specific your prompt, the more accurate the response.
- Example: „List five scientifically proven benefits of meditation for mental health.“
- contextProvide the necessary context so that ChatGPT can respond to relevant information.
- Example: „Given the current economic situation and global conflicts around the world, how might inflation affect the consumption habits of people in Germany over the next five years?“
- Desired style or format: Specify the style or format in which you would like to receive the answer.
- Example: „Explain the theory of relativity to me as if I were five years old.“
- confinementDetermine which information should be emphasised or excluded.
- Example: „Please explain the advantages of e-mobility without going into environmental aspects.“
2. Advanced prompt techniques
- Content control: Instruct ChatGPT to cover specific topics or points.
- Example: „Explain the history of the French Revolution, particularly the role of women's movements and the impact on society at that time.“
- Step-by-step instructions: Request detailed explanations in steps.
- Example: „Explain to me in five steps how climate change affects sea levels.“
- feedback loopCheck the answers and ask for clarification.
- Example: „That was helpful. But could you please explain it in more detail?“
3. Fine tuning and adjustment screws
You've probably experienced someone wanting to say something but pausing mid-sentence because they're searching for the right words or need to organise their thoughts. You already know what they want to say. You might even try to help by finishing the sentence you think they want to say. You guess the words before they are spoken. Artificial intelligence works in a similar way with ChatGPT.
When creating texts with ChatGPT, the system decides word by word what comes next. There are many possibilities for what the next word could be. Top-k and Top-p sampling are two techniques that determine how „creative“ or „predictable“ the response will be. Here, k stands for the number and p for probability. These techniques are suitable for advanced users who want specific control over the way ChatGPT responds. The top-k and top-p values are specified in the prompt if you want to deviate from the default settings.
In everyday use and in most normal interactions, these values are often unnecessary, as the default settings already offer a good balance. They are more like tools for special requirements.
3.1. Top-k sampling
-
- Definition: Top-k sampling means that the system only considers the k most probable next words. The smaller the number k, the fewer words are selected, and the response becomes more „predictable.“ The larger the number k, the more possibilities are included, and the response can become more creative, but also more unpredictable.
Reasonable values for top-k:
-
- Low values (1-10): Greater consistency and predictability.
- Average values (10-50): Good balance between creativity and coherence.
- High values (50-100+): Maximum creativity, but potentially less focus and cohesion. Values above 100 often lead to answers that are difficult to keep coherent.
3.2. Top-p sampling
-
- Definition: Top-p sampling, also known as „nucleus sampling“, considers words until a certain probability threshold is reached. This means that the system looks at which words are most probable and adds words until a specified probability is reached.
Value range: For Top-p, the value ranges between 0 and 1.0. A value of 0.8 means that the model considers words up to a total probability of 80%. At 1.0, all possible words are included, allowing for the greatest variety.
Let us consider the effects of different k and p values using the following query:
„Describe a fantasy city in the future..“
Here are seven different answers based on different attitudes:
1. Response without restrictions by the user (default values):
„The city of the future is a green metropolis, criss-crossed by gleaming skyscrapers made of glass and metal that tower into the sky. Everywhere there are vertical gardens, hovering vehicles and advanced technologies that make life easier for residents. The streets are bustling with robots and humans living together in harmony. Solar panels and wind turbines provide clean energy, while intelligent systems control traffic and monitor air quality.“
2. Top-k = 5:
„The city of the future is a huge, glittering metropolis with tall buildings and floating cars. The streets are clean, and technology is everywhere to help people. Robots take care of many tasks, and there are lots of parks and green spaces.“
3. Top-k = 20:
„In the city of the future, large, luminous glass towers rise up, surrounded by floating roads and bridges. There are many colourful lights, flying cars and even small robots that pick up rubbish. There are also parks with strange plants that glow in the dark, and displays everywhere to help people find their way.“
4. Top-k = 50:
„The fantasy city of the future stretches across vast plains, where skyscrapers with unusual shapes, such as twisted spirals and floating spheres, can be found. There are flying gardens where trees grow in the air and streets that look like shimmering rivers. The buildings change colour depending on the time of day, and drones deliver food and parcels to people everywhere. There are also small animals scurrying brightly through the streets and music that seems to come from the walls.“
5. Top-p = 0.6:
„The city of the future is a futuristic metropolis with clean, tall buildings and lots of robots that help people. The streets are quiet, there is lots of greenery and the air is clear.“
6. Top-p = 0.8:
„In the fantasy city of the future, there are tall towers that sparkle like crystals and cars that glide silently through the air. Everywhere there are green oases rising up in the middle of the city and huge screens that give people all the information they need. There are even robots that create art and streets that glow in different colours at night.“
7. Top-p = 0.95:
„Imagine a city where buildings are shaped like large, shiny shells and entwined around huge, colourful waterfalls that flow through the centre of the city. Everywhere there are floating gardens with exotic plants that glow in all the colours of the rainbow, and floating platforms that take people from place to place. The air smells of fresh flowers, and soft music floats above the streets, played by invisible speakers. In the distance, you can see gigantic works of art that are constantly changing and playing with the sun.“
Analysis of the differences:
-
-
- Without restrictions: A general, balanced response that offers creativity and consistency.
- Top-k = 5: A very focused answer with the most probable and typical elements.
- Top-k = 20: More diversity, but still within a relatively familiar framework.
- Top-k = 50: Greater creativity and unexpected details that stimulate the imagination more strongly.
- Top-p = 0.6: A very coherent and less creative answer that sticks closely to the most probable terms.
- Top-p = 0.8: Balanced creativity that remains consistent but offers scope for interesting details.
- Top-p = 0.95: Maximum creativity, resulting in highly imaginative and colourful descriptions, some of which are also unpredictable.
-
Summary:
Top-k and Top-p sampling help to control whether a response should be more „to the point“ or more creative. Smaller values lead to more confident, direct responses, while larger values bring more creativity and surprise to the responses.
3.3. „Temperature“
Why is temperature important?
Temperature directly influences the control of diversity and creativity in the responses. While Top-k and Top-p specifically control which words are considered, temperature influences how open the model is to less probable but more embellished options. Just like with Top-k and Top-p, different preferences regarding temperature are specified directly in the prompt.
Differences in temperature:
-
- Low temperature:
- Result: Responses are structured, logical and less playful. Ideal for formal, technical or clearly defined enquiries.
- High temperature:
- Result: Responses can be more creative, playful, and sometimes less predictable. Ideal for artistic or creative tasks.
- Low temperature:
An example to illustrate this:
Request: „Describe an unusual sunset.“
-
- Temperature 0.2:
- „The sunset was beautiful, with red and orange colours filling the sky.“
- Assessment: Very conservative, describes typical, common characteristics of a sunset.
- Temperature 0.8:
- „The sunset painted the sky in a spectacular dance of purple, emerald and gold, while the clouds looked like giant, glowing dragons winding their way across the horizon.“
- Assessment: More creative, with vivid descriptions and unpredictable images.
- Temperature 0.2:
When should you adjust the temperature?
-
- Default value (0.7): Often a good balance between precision and creativity.
- Special requirements: Adjustments are useful if you have specific expectations regarding tone and style. A lower temperature for clear instructions or technical descriptions; a higher temperature for creative writing or unconventional ideas.
3.4. Maximum response length
Set the desired length of the response.
-
- Example: „Summarise the content of the book ‚The Little Prince‘ in a maximum of 200 words.“
3.5. Form
Determine the format of the answer, e.g. as a list, essay or poem.
-
- Example: „Explain the basics of quantum physics to me in poetic form.“
4. Combinations and advanced approaches
- Multi-step promptsUse a sequence of steps for complex topics.
- Example: „First explain what blockchain is, then show how it is used in the field of cryptocurrencies.“
- alternative scenariosConsider different perspectives or scenarios.
- Example: „Explain what the world might look like if the internet had never been invented.“
5. Avoiding misunderstandings
- Negative specificationsDetermine what should be avoided in the response.
- Example: „Please explain the advantages of solar energy, but do not mention the associated costs.“
6. In summary
The quality and accuracy of the responses can depend greatly on how well the prompt is formulated and which techniques are used. By applying these methods, you can control the responses even more precisely and adapt them to your specific needs. For example, you can use the techniques explained here if the standard prompt did not produce the desired result. With Top-k, Top-p or Temperature, you can rework and experiment until the result meets your expectations.
You can find links to the 16 articles in our series on artificial intelligence so far at End of this article.