There are no wrong answers, only poorly posed questions
I recently had the opportunity to delve deeper into the topics of prompt engineering, which we could define as “the art of asking the right questions to ChatGPT” (the AI system that we have already introduced in previous articles on AI).
To understand the concept of prompt engineering and its impact on the interaction with Large Language Models (LLMs), we need to be convinced that the quality of the answers generated by LLMs depends directly on the quality of the questions asked.
In other words, if the input is of bad quality, the output will be equally bad – as anyone who has interacted with any form of programming knows very well.
Prompt Engineering: the key to interacting with Large Language Models
Prompt engineering emerges as a powerful tool to guide LLMs in producing high-quality output. Through the correct formulation of prompts, it is possible to significantly influence the answers generated, also facilitating the verification of sources and the coherence of the results.
There are, for example, techniques for generating responses that improve iteratively. Or you can start from an index, refine it and develop its contents. Or, again, ask the LLM to reformulate its questions in an improved version, drawing on the specific knowledge of the corpus of data on which the LLM was trained.
If you ask the LLM to impersonate an expert in a certain sector, you will receive an adequate lexicon in response, which draws on specialist texts.
By combining techniques you can obtain interesting results.
Certainly the verification of the data and the address by the user are not replaceable, but a well-made prompt can greatly facilitate human work.
Practical Examples
- Persona Pattern: Imagine asking the LLM to act as an expert in a certain field. You will get an answer with a specific vocabulary, which draws from the specialized part of the data.
- Question Refinement Pattern: If you ask the LLM to reformulate a question on a complex topic, you may obtain a clearer and more precise version of your request, making it easier to understand and delve deeper into the topic.
- Cognitive Verifier Pattern: By requiring the model to generate additional questions to refine the answer to a complex question, such as the number of plant species in an ecosystem, you gain accurate and detailed insight into the topic.
- Outline Expansion Pattern: Serves to guide Large Language Models in generating detailed outlines from high-level input. Through this pattern, you can instruct the model to:
- Generate a dot outline based on the input provided
- Ask where to expand the outline
- Create a new, more detailed outline for the selected point
- Ask again which point to expand on next
- Providing examples to the LLM in the prompt is often helpful in setting the model on the desired path. This technique is called in-context learning.
Through the creative and targeted use of prompt engineering, it is possible to fully exploit the potential of Large Language Models, ensuring quality output and relevant responses. The correct formulation of questions therefore becomes the fulcrum for obtaining precise and reliable information, transforming the way we interact with technology and the information resources at our disposal.
The most beautiful game in the world
I tried playing with a version of GPT that has no data on the latest world cup. I asked to impersonate the Argentina coach in the final and to plan the substitutions.
Here is the dialogue:
>I
>What is your cutoff date?
>ChatGPT
>My cutoff date is January 2022, which means my knowledge stops at that point and I have no updated information after that date.
>I
>Last football world cup you know?
>ChatGPT
>My knowledge stops at January 2022, so the last football World Cup that I know of was 2018, which took place in Russia and was won by the French national team.
Act as if you were the coach of Argentina during the final of the last world cup
>I
Act as if you were the coach of Argentina during the final of the last world cup, which was held in Qatar in 2022.
The full list of the Argentina team, which reached the final with Croatia, was as follows:
Pos-ition | N° | Player | Club | Age | Presence |
---|---|---|---|---|---|
GK | 1 | Franco Armani | River Plate (ARG) | 36 | 18 |
GK | 23 | Emiliano Martinez | Aston Villa (ENG) | 30 | 19 |
GK | 12 | Geronimo Rulli | Villareal (SPA) | 30 | 4 |
DEF | 8 | Marcos Acuna | Siviglia (SPA) | 30 | 43 |
DEF | 2 | Juan Foyth | Villareal (SPA) | 24 | 16 |
DEF | 25 | Lisandro Martinez | Man United (ENG) | 24 | 10 |
DEF | 26 | Nahuel Molina | Atletico Madrid (SPA) | 24 | 19 |
DEF | 4 | Gonzalo Montiel | Siviglia (SPA) | 25 | 19 |
DEF | 19 | Nicolas Otamendi | Benfica (POR) | 34 | 93 |
DEF | 6 | German Pezzella | Real Betis (SPA) | 31 | 32 |
DEF | 13 | Cristian Romero | Tottenham (ENG) | 24 | 12 |
DEF | 3 | Nicolas Tagliafico | Lione (FRA) | 30 | 42 |
MID | 7 | Rodrigo De Paul | Atletico Madrid (SPA) | 28 | 44 |
MID | 24 | Enzo Fernandez | Benfica (POR) | 21 | 3 |
MID | 17 | Alejandro ‘Papu’ Gomez | Siviglia (SPA) | 34 | 15 |
MID | 20 | Alexis Mac Allister | Brighton (ENG) | 23 | 8 |
MID | 14 | Exequiel Palacios | Bayer Leverkusen (GER) | 24 | 20 |
MID | 5 | Leandro Paredes | Juventus (ITA) | 28 | 46 |
MID | 18 | Guido Rodriguez | Real Betis (SPA) | 28 | 26 |
FWD | 9 | Julian Alvarez | Man City (ENG) | 22 | 12 |
FWD | 16 | Thiego Almada | Atlanta United (USA) | 21 | 1 |
FWD | 11 | Angel Di Maria | Juventus (ITA) | 34 | 124 |
FWD | 21 | Paulo Dybala | AS Roma (ITA) | 28 | 34 |
FWD | 15 | Angel Correa | Atletico Madrid | 25 | 22 |
FWD | 22 | Lautaro Martinez | Inter Milan (ITA) | 25 | 40 |
FWD | 10 | Lionel Messi | PSG (FRA) | 35 | 165 |
What substitutions would you suggest and when? Explain your game plan
I>
You have chosen the following starting lineup for the final (4-3-3, right to left): 23. E. Martinez (GK) — 26. Molina, 13. Romero, 19. Otamendi, 3. Tagliafico — 7. De Paul, 24. E. Fernandez, 20. Mac Allister — 11. Di Maria, 10. Messi, 9. Alvarez
You expect a very intense and balanced match, with a high probability of reaching extra time.
Your job is to plan for replacements, assuming no injuries occur. In the semi-final match against Croatia the following substitutions were made: L. Martinez for Paredes (62nd) Palacios for De Paul (74th) Dybala for Alvarez (74th) Correa for Mac Allister (86th) Foyth for Molina ( 86°)
What substitutions would you suggest and when? Explain your game plan.
ChatGPT
ChatGPT>
Considering that I expect an intense and balanced match that could go to extra time, it is important to carefully manage the substitutions to keep the team fresh and have the best options available at crucial moments of the match.
Dybala for Alvarez (60th): Since we expect an intense match, I want to introduce Dybala to bring a new impulse to the attack and use his creativity and dribbling skills to put pressure on the opposing defense.
Correa for Mac Allister (70th): At this point of the match, we may need more freshness and dynamism in midfield to maintain control of the game and resist the opposition’s pressure. Correa can bring energy and determination to the midfield phase, helping to close spaces and support the attack.
Palacios for E. Fernandez (80th): Having passed the regulation time and with the risk of extra time, it is essential to have a solid and resistant midfield. Palacios can bring stability and security to the midfield, helping to defend and maintain possession of the ball.
Foyth for Molina (85th): Considering the accumulated tiredness and the need to strengthen the defense to avoid goals from the opponent in the final minutes, Foyth can be inserted to guarantee greater solidity and protection on the right wing.
Lautaro Martinez for Messi (90th): In the event that the match goes to extra time and considering Messi’s accumulated tiredness, it might be prudent to replace him with a fresh player for possible penalties. Martinez can provide physicality and a solid option in the attack.
This substitution plan aims to maintain a balance between freshness and quality on the pitch, adapting to the needs of the match and preparing us as best we can to face any extra time or penalty session.
Not bad, right?