Understand AI models and prompt engineering

Understand AI models and prompt engineering

OpenAI's GPT-3.5 and GPT-4 models are prompted. In the case of a prompt-based model, the user interacts with the model by enteringa prompt text, to which the model responds with a semi-automatic input. This semi-automatic input is a continuation of the input text by the model.

Although these models are extremely powerful, their behaviour is also very sensitive to the prompt.The construction of the prompt is at an important competence to develop.

In practice, the prompt works to configure model weights to complete the desired task. However, it is more an art than a science, which often requires experience and intuition to create a Russian invite. This article is intended to help you familiarize yourself with this training process. It attempts to present general concepts and models that apply to all TPM models. However, it is important to understand that each model behaves in its own way, so that the training may not be applied in the same way to all models.


Good practices

  • Be specific. Leave as little room as possible for interpretation. Limit operational space.
  • description. Use analogies.
  • Repeat. Sometimes you may have to fall for the model. Provide instructions before and after your main content, use an instruction and signal, etc.
  • Order is important. The order in which you present the information in the model can have an impact on the output. Where you place the instructions, i.e. before your content ('Summit the following elements... Â") or after ('Summit the above elements... Â"), may vary the output. Even the order of examples in a few moves can be important. This is called "recovery bias".
  • Give the model a "exit door". It may sometimes be useful to provide the model with another path if it fails to perform the assigned task. For example, when you ask a question about text, you can include an element such as "respond with "not found" if the answer is not present". This can help the model avoid generating false responses.


Basic concepts

This section describes the basic concepts and elements of GPT prompts.

Text prompts are how users interact with GPT models. Like all general language models, GPT models try to produce the series of words that are most likely to follow the previous text. It is as if we say "What is the first thing that comes to mind when I say<prompt>?Â". The examples below illustrate this behaviour. When it encounters the first words of famous content, the model is able to continue the text accurately.


Invite components

LIf you are using the Completion API when there is no difference between different parts of the prompt, it may always be useful, for learning and discussion purposes, to identify the underlying prompt components.

  1. Instructions

Instructions are probably the most commonly used prompt component. They simply tell the model what to do. This concept is simple, but in practice the instructions can be complex. The table below illustrates this principle by showing simple and more complex instructions in two different forms.

Type of instructionPromptCompletion
Simple instructionsRequest an introduction for a weekly newsletter.Welcome to our weekly newsletter. This week, we will focus on productivity. We will share tips and tricks to improve your productivity in every area of your life. We hope they will be helpful. Don't hesitate to share them with your friends!
Complex instructionsRequest an introduction for a weekly newsletter to my company called Spark. She must mention the great meeting we had last week and thank the team for their hard work in recent months.Welcome to Spark's weekly newsletter! Last week, we had a great meeting and I would like to take this opportunity to thank the team for its hard work in recent months. Our future is bright and I am confident that we will achieve great things through the dedication and commitment of our team. Thank you for being part of our team and I look forward to working with you in the weeks and months to come. Bestly, [Your name].
Complex instructionsRequest an introduction for a weekly newsletter, which contains the following:
- My company is called Spark
- grandiose greetings
- Thanks to the team for their hard work in recent difficult months
- Positive outlook for the coming quarter
- Signature of management
Hello to all members of the Spark team! I would like to thank you for all the work you have done in recent months. This period was difficult, but you all did an incredible job. I am very proud of each of you. As the next quarter approaches, I am filled with confidence. I sincerely believe that we are going to do great things. Thank you again, the management.

  1. Main content

The main content refers to the text processed or transformed by the model. It is generally used with instructions. Translation into another language is a simple example. In the example below, the English text is considered the main content, while "Translate to French:" is an instruction.
PromptCompletion
Can you please tell me how to get to the museum?
Translate into French:
Can you please tell me how to go to the museum?
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by [...]
Summarize the previous text in a few sentences:
Time complexity is a measure of how long an algorithm takes to run. It is typically expressed as a function of the size of the input. The most common measure is worst-case time complexity, which is the maximum amount of time required for inputs of a given size.


  1. Examples

Successful prompts often rely on learning practice "in one shot" or "in a few moves". This principle refers to the inclusion of one or more examples of the desired behaviour of the model, generally including entry and exit pairs. This is not learning in the sense that the model is permanently modified. Instead, the examples condition the model to be answered as desired only for the current occurrence. The use of prompts without examples is sometimes referred to as "Zero coup" learning. With the Chat Completion API, learning examples in a few moves are generally added to the message table as examples of user/wizard interactions after the initial system message.


Type of learningPromptCompletion
Zero blowTitle: The coach confident that the injury will not disrupt the Warriors
Heading:
The coach is confident that the injury will not disrupt the Warriors season. The team remains focused on its goals and will continue to work hard to achieve them.
A few shotsTitle: Correa des Twins will appeal to a free agent
Section: Baseball
Title: World Cup deposit areas in Qatar
Heading: Football
Title: Yates: Fantasy Football News - Week 6
Heading: American Football
Title: The coach confident that the injury will not disrupt the Warriors
Heading:
Basketball


  1. Signal

Signals serve as a "kick" for the model output, which helps direct the model to the desired output. This is often a prefix that serves as the basis for the model. In the example below, we show the signal that leads the story to include key elements. Signals are often, but not always, used with instructions. In the examples below, the model is used to summarize a long ad mail. One indicator is used in one case to help you target model output and suggest a specific output format (chips) in the other.

In the context of the Chat Completion API, instructions take the form of the system message, and examples in a few moves are provided by providing a series of examples of user/wizard interactions to help start the model.

Number of indicatorsPromptCompletion
0 0 0Performance evaluation is an essential component of Spark's Performance and Development approach. […]
Summarize the above letter:
The purpose of this mail is to inform employees of recent changes to the Performance Assessment, which is part of Spark's Performance and Development approach. Changes include improved structure, user experience in the upgraded tool, and targeted prompts. In addition, there is now an optional conversation trigger section that allows employees to report topics they wish to discuss with their managers.
1Performance evaluation is an essential component of Spark's Performance and Development approach. […]
Summarize the above letter:
The main information of the message is
Spark improve performance evaluation experience by making it more focused on priorities, expectations and impact. In addition, the user experience in the tool is upgraded with tips, resources and instructions. Finally, the message contains instructions on enabling fundamental priorities across the enterprise.
2Performance evaluation is an essential component of Spark's Performance and Development approach. […]
Summarize the above letter:
Key points:
•
Spark introduces changes to the performance evaluation experience following employee feedback.
• The amendments include a new perspective on priorities, expectations and impact, upgraded user experience, and new instructions on fundamental priorities across the enterprise.
• Performance assessment is the time to refuel past performance and learning, as well as to plan future growth priorities and opportunities.
• Employees must reiterate their comments prior to the performance evaluation meeting.
• There should be at least two performance evaluations per year.
• The time spent on each evaluation must remain the same.
    • Related Articles

    • Presentation of the menu TONI, the AI of Jarvis

      Presentation of the TONI menu (IA Jarvis AI) The TONI module (the Jarvis AI) is a paid additional module. To subscribe to this module, please contact ourcommercial service. On the left of the screen, a "My prompt" insert lists the prompts (i.e. ...
    • Confidentiality and security of data with YOUR

      TONI: guarantees of confidentiality and security of data The TONI module (the Jarvis AI) is a paid additional module. To subscribe to this module, please contact ourcommercial service. Jarvis designs its products around a central commitment: ...
    • TONI, an unprecedented innovation in LegalTech

      TONI: you will no longer be able to do without it The TONI module (the Jarvis AI) is a paid additional module. To subscribe to this module, please contact ourcommercial service. Based on OpenAI's professional APIs, Jarvis has developed"TONI" a super ...