What is ChatGPT?
Chat GPT (Chat Generative Pre-trained Transformer) is a language model developed by OpenAI based on the GPT (Generative Pre-trained Transformer) architecture. It is a natural language processing (NLP) system that uses machine learning techniques to generate coherent and contextually relevant responses in a conversation.
The GPT Chat model has been trained with large amounts of text from various sources, allowing it to effectively understand and generate human language. It can answer questions, maintain dialogues and interact with users in a human-like manner.
The goal of Chat GPT and other similar models is to improve the ability of machines to understand and generate human language in a more natural and coherent way.
These models are used in a variety of applications, such as virtual assistants, automated customer service response systems and chatbots, among others.
What is a prompt?
The word "prompt" comes from the Latin "promptus," meaning "quick, ready, willing." It was first used in English in the 14th century and referred to someone who was quick to act or respond. In the 15th century, the word began to be used to refer to a suggestion or instruction given to someone to help them do something.
In the 20th century, the word "prompt" came into use in computing to refer to a message given to a user to prompt him or her to enter information. Prompts are often used in command line interfaces and graphical user interfaces.
In the context of artificial intelligence, the word "prompt" is used to refer to an input given to a language model to generate text. For example, a prompt might be "Write a story about a dog going to the park." The language model will use the prompt to generate text that is relevant to the prompt.
Prompts are used in a variety of applications, including natural language processing, machine translation and creative text generation. They are a powerful tool that can help language models learn and improve their performance.
The prompt can be as simple as a direct question or an incomplete sentence that the model completes. For example:
If you want to get information about the weather, you can provide a prompt such as:
User: "What is the current weather in New York?".
From that prompt, the model will generate a relevant response, such as:
ChatGPT: "Currently, in New York, the weather is sunny with a temperature of 25 degrees Celsius."
What is prompt engineering?
Prompt engineering is an approach used to improve the quality of the responses generated by artificial intelligence (AI)-based language models, such as GPT-4 or BardThe company's customers are able to optimize and adjust the prompts that are presented to them.
Language models tend to be most effective when they are asked clear and specific questions.
This may involve adjusting wording, providing additional context, or breaking a complex question into several simpler questions.
"Prompt engineering is not just about designing and developing prompts. It encompasses a wide range of skills and techniques that are useful for interacting with LLMs (Large Language Models)."
Text to image
Text-to-image is a task in the field of artificial intelligence (AI) that focuses on generating realistic or stylized images from text descriptions. In other words, it is the process of converting a text input into a corresponding visual representation using AI algorithms, such as neural networks.
Text to Video
Text-to-video (text-to-video) is a task in the field of artificial intelligence (AI) that focuses on generating videos from text descriptions. The goal is to create realistic or stylized video sequences based on descriptions provided in the form of text, using AI algorithms and deep learning techniques.
Text to text
Text-to-text is a task in the field of artificial intelligence (AI), specifically natural language processing (NLP) and deep learning, that focuses on converting or transforming an input text into an output text, preserving or modifying meaning and structure as needed.
Uses of ChatGPT
Currently, text-to-text has different uses
- Summary of information
- Text writing
- Virtual personal assistance
- Write programming code
- Decision making
- Customer service chatbot
- Text generation to complete sentences or paragraphs
- Answer questions based on information provided
- Automatic translation from one language to another
- Sentiment analysis in text
- Classification of text into specific categories
- Speech synthesis and speech recognition
- Grammar and spelling correction
- Generation of ideas for writing or generating content
- Anything that requires text or language understanding can be optimized with the various Natural Language Processing models.
*Never put sensitive or confidential information on ChatGPT.
Use in different industry sectors
- Marketing
- Business
- Software
- Health
- Education
- And more
How to improve your conversations with ChatGPT?
Get better answers from ChatGPT
Be specific and clear in your input
The more specific and clear your input is, the more accurate the ChatGPT response will be. Avoid long and complex sentences that may confuse the model and do not provide the necessary information to generate a proper response.
2. Use correct grammar
ChatGPT is trained on correct grammar and well-formed sentence structures, so using correct grammar and spelling in your input will help the model understand your message more easily and therefore provide a more accurate response.
3. Provides context
Provide as much context as possible in your input. For example, if you are looking for a specific response, provide some additional details that may help ChatGPT understand your request and provide a more accurate response.
4. Be kind and respectful
Although ChatGPT is emotionless, being polite and respectful in your interactions can help generate more useful responses. In addition, the information you provide can be used to improve the quality of the model in the future.
5. Verify the answer
Before relying on the answer provided by ChatGPT, make sure it is accurate and relevant to your question or need. If necessary, rephrase your question or request more information to get a more accurate answer.
6. Be aware of the limitations
Although ChatGPT is an advanced language model, it still has some limitations. For example, it can be misled or misinterpret information, and its response can be affected by data bias in its training.
7. Be specific in your feedback
If ChatGPT's response is not accurate or relevant to your question, please provide specific and clear feedback. This will help improve the quality of the model in the future and ensure that the answers are more useful to all users.
8. Use different approaches
In some cases, it may be helpful to use different approaches to get the answer you need. For example, you can rephrase your question or provide additional information to help ChatGPT understand your request.
9. Expresses gratitude
As with any human interaction, expressing your gratitude and appreciation for ChatGPT's response can help keep the conversation friendly and respectful. It can also encourage the model to continue to provide helpful and accurate responses.
10. Practice moderation
While useful for quick and accurate answers, it should not replace proper research or consultation with experts in a given field.
Use ChatGPT as a complementary tool and do not depend exclusively on it to make important decisions or to obtain critical information.
OpenAI provides information about what ChatGPT is, examples of how to use it, limitations and development information on their blog.
"GPT-4 is 82% less likely to respond to requests for disallowed content and 40 % more likely to produce factual responses than GPT-3.5 in our internal evaluations." OpenAI.ㅤ
Structure of a prompt
Source: https://www.promptingguide.ai/introduction/elements
- Instruction: a specific task or instruction that you want the model to perform
- Context: may involve additional external information or context that can steer the model toward better answers.
- Input data: is the entry or question for which we are interested in finding an answer.
- Output indicator: indicates the type or format of the output. Not all components are required for a notification and the format depends on the task in question.
Examples of ChatGPT prompt structure:
Prompt: Briefly describe the plot of the movie "The Godfather" (1972).
- Instruction: Briefly describe the plot.
- Context: -
- Input data: film "The Godfather" (1972).
- Output data: -
Prompt: Write a thank you message to your co-workers for their help on a recent project, using a formal style.
- Instruction: Write a thank you message.
- Context: Formal style.
- Input data: Co-workers, assistance provided, recent project.
- Output data: -
Prompt: Calculate the time it will take to travel 150 km at an average speed of 60 km/h. Express the answer in hours and minutes.
- Instruction: Calculate the time it will take to travel.
- Context: -
- Input data: 150 km, average speed of 60 km/h.
- Output data: response in hours and minutes.
Prompt: Design a logo for a technology company called "Innovatech" that reflects innovation and modernity. Describe the colors and shapes used.
- Instruction: Design a logo.
- Context: Reflecting innovation and modernity.
- Input data: Technology company, "Innovatech", innovation, modernity.
- Output data: Description of colors and shapes.
Prompt: You are a nutrition expert. List five protein-rich foods that are suitable for a vegetarian diet.
- Instruction: List five protein-rich foods.
- Context: You are an expert in nutrition.
- Input data: Vegetarian diet.
- Output data: -
Limitations and ethical use of ChatGPT
It is important to be aware of its limitations and ethical considerations before using it extensively.
Bias
These biases can be introduced by the way training data are collected and used.
This can lead to ChatGPT showing biases in its understanding and in the answers it provides. Such as racial, economic or ethnic biases due to being trained on internet data.
Compression limitations
Their ability to understand context and information may be limited in some cases. This may lead to inaccurate or irrelevant responses.
Lack of deep understanding: It can generate plausible but incorrect answers due to a lack of deep understanding of the subject. For example, in the nutritionist's instruction he does not understand neither physical nor mental problems, he only satisfies the text structure you give.
Plausible but incorrect answers: There are hallucinations as there is always some degree of uncertainty. If you have no knowledge or criteria for a certain topic, it is not advisable to use the chat response for relevant purposes.
Limitations in decision making
ChatGPT can provide useful information, but should not be used as the sole source for making important decisions. Important decision making should be supported by additional information and expertise.
Sensitivity to manipulation: is trained not to support actions related to evil, but there are techniques to bypass these filters.
Limit of tokens: there is a word limit when receiving and generating responses.
Long and repetitive answers: can generate long and repetitive responses due to overtraining.
Responsibility
It is important to note who is responsible for the responses generated by ChatGPT. It may be necessary to clarify who is responsible in situations where the information provided by ChatGPT has a significant impact.
Real time update: databases may be outdated, which may affect the quality of the responses generated.
Privacy and security
Information provided to ChatGPT must be treated confidentially and protected from possible security breaches.
Overfitting
A term used in machine learning that refers to a model that fits the training data too well and therefore cannot generalize well to new data. In other words, the model has fit the training data too well and has learned noise or irrelevant features that are not useful for predicting new data.
To avoid overfittingIn addition, it is important to use techniques such as cross-validation and regularization.
- Cross validation is a technique used to evaluate the performance of a model on unseen data.
- Regularization is a technique used to penalize models that have too many parameters.
To improve the context
In my experience of use, there is something that I have tried and it has worked for me, here I share it with you.
1. Prompts Multiples: This is basically giving you partial information in three to four prompts of the activities you want to perform. This implies a broader context of the information if you want it to be very specific in the information you want it to give you back.
2. Sub-Prompt Generation and Technique: This consists of the language model generating for itself a reusable prompt with the information that you have placed or that you have given as input. We will see later why it is important to generate it.
Maximum optimum: With the text responses generated there comes a point where you have identified that the model no longer responds in the same way or that it has lost some context. I call this the Optimal Maximum, which is where the model loses context. It is there where we use the prompt generated previously (step 2) to remind the model the specific activity to perform without the need to deliver all the information from scratch, for that the model is able to generate a specific text that serves as a reminder to itself.
4. Reuse of the Model: As you know, on the left side of the browser when you use chatGPT you will see the chat history you have had. You can reuse this by telling the model by saying the following to resume the conversation (or usage) without problems and loss of context:
Step 1. "I want you to tell me precisely what you remember about the instructions I have previously given you and the task or function I assigned you".
Once she answers she will tell them what she remembers or does not remember about the instructions you gave her.
Step 2. "Since you remember the information, I want you to keep the context given and answer me the following: (enter what you want to ask)".
"At the end of your prompt add: Respond with a 'yes or no' if the information was clear for your task."
This will help them, when they use it or give it multiple prompts in a row, not to generate long text before it is necessary.
Protection of confidential data when using ChatGPT
Caution is essential when sharing sensitive information with ChatGPT.
Although it is useful and secure in most interactions, it is not foolproof and there is a risk of data exposure. Avoid disclosing personally identifiable information, respect confidentiality agreements, be careful with medical details, do not share passwords or financial data, and use secure connections.
Review the terms and conditions of use, and consider OpenAI's vision for security in AI systems.
Basic tips to improve a prompt
- https://www.promptingguide.ai/introduction/tips
- https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api
- It starts simple: It is advisable to start with simple indications to validate that the model is able to generate what I need, and little by little add elements and context to obtain an increasingly accurate result. This is useful when you have a large task that can be divided into simpler subtasks.
- Specify: Be very specific in the instruction being asked of the model: The more detail you provide, the better results you will generate. The details should be relevant and contribute to the task at hand, always keeping in mind the limitation of the amount of input text.
- Avoid inaccuracies: It is important not to be ambiguous when writing prompts. There are elements that can be subjective between what I think they mean and what the model may think they mean (e.g., using "brief/extensive", "little/many"). It is best to specify as much as possible (e.g. with numerical values) what we mean by these elements.
- Reaffirms: It is useful, at the end of the prompts, to ask the model if he/she understood what to do to force him/her to start his/her answer with the textual confirmation of what to do. This way we make sure that he is doing what we ask him to do and we will be able to detect if we need to add more precision.
- Target audience: Where possible, we can indicate a target audience to ensure greater precision in the way the output should be generated (e.g., to explain to a child, a university student, a subject matter expert).
- Provide examples: Providing examples in the prompt of what we want the result to look like is very effective in getting very tight responses to specific formats.
Example of a bad prompt:
- Write a letter about a student named John Smith to help him get into a graduate program in computer science.
- Explain the prompt engineering concept. Keep the explanation brief, just a few sentences, and don't be too descriptive.
Example of a good prompt:
- Write a letter of recommendation from a student named Juan Perez for his application to the master's program in Computer Science. Mention his programming ability, ability to work in a team, and communication skills. The letter should include an introduction, body, and conclusion and should contain no more than three paragraphs.
- Use 2 to 3 sentences to explain the concept of prompt engineering to a high school student.
Reaffirms
- Act like an art history expert. Compare and contrast the paintings "The Last Supper" by Leonardo da Vinci and "Guernica" by Pablo Picasso and give me comparisons in numerals. Did you understand your purpose?
Target audience
- Act as a physics expert and explain the concept of Einstein's theory of relativity to a 12-year-old child. Describe in a simple way and with everyday analogies the different concepts surrounding this theory.
Common errors when writing a prompt
- Too long or too complicated: We must avoid extending unnecessarily, changing the meaning of the request and falling into redundancies that do not contribute to the specificity of the prompt and make it difficult to identify the specific instruction we are giving.
- Jargon or ambiguity: If it is not strictly necessary, do not use words or expressions that are only used in a country, region or by a very specific niche of the population. The more natural the input language is, the better the result will be.
- Limitations of the model: Failure to take into account the limitations of the models can lead to errors, either in the content of the response or problems such as biases or outdated information.
- Assumptions: It is related to specificity. The prompt must contain all the necessary information that prevents the model from having to assume input data that we are not giving it.
Zero-shot and One-shot Prompting
Zero-shot, One-shot and Few-shot techniques are used in all AI models: they are not limited to text generation models.
- Zero-shot: Refers to the ability of a model to perform a task on its own, without prior training, using only a brief description of the task and without the need for examples or contexts.
- *Example: "Design 10 spelling questions for a 7-year-old child. "*ㅤ
- One-shot: Refers to the ability of a model to perform a task after only one example has been provided to help it execute the instruction.
- *Example: "Design 10 deletro questions for a 7 year old child. Follow the following example:How do you write the word for the barking animal? "*ㅤ
- Few-shot: Refers to the ability of a model to perform a task after being trained with a few examples.
- Example: "Design 10 deletro questions for a 7-year-old child. Follow the following examples: how do you spell the word for the barking animal? How do you spell the sweet, red fruit that grows on trees?"
By default, ChatGPT is designed not to require the use of One-shot or Few-shot prompting, since it is trained to generate the appropriate results with its own knowledge base. However, these are techniques that can be useful in contributing to the specificity of prompts.
Chain-of-Thought Prompting
https://arxiv.org/abs/2205.11916
Chain-of-Thought is a method for improving the reasoning skills of language models. The concept of this technique is based on allowing models to decompose a multi-step problem into intermediate steps and thus solve problems that could not be solved with standard prompts methods.
This is the way to improve accuracy in arithmetic reasoning tasks, in which language models usually have quite a lot of difficulties to solve correctly.
A normal or standard Prompting
Input:
- Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? A: The answer is 11. Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
- A: The answer is 11.
- Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
Model Output:
- A: The answer is 27 (mal)
Using Chain of Throught Prompting
Input:
- Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?
- A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.
- Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
Model Output:
- A: The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9.
In this case, the standard prompt asks the model for a direct answer to a multi-step reasoning problem, leading to an incorrect answer. While the prompt using Chain-of-Thoughtdecomposes the problem into intermediate steps that lead to a correct answer.
Optimize results with specific text structures
ChatGPT is a natural language model capable of generating coherent and relevant text from a given prompt or question. In addition to generating free text, it can also generate tables, CSV files, mind maps and other formats. In this article, we present some ways to ask ChatGPT to generate these formats.
Tables
Tables are an effective way to present information in a clear and concise manner. To ask ChatGPT to generate a table, you need to provide it with a clear and specific indication of the table's content and structure.
For example: Generate a table with the names, ages and cities of the 10 students with the highest GPA in the school.
CSV
CSV (Comma Separated Values) files are a common way of storing data in a structured way. To ask ChatGPT to generate a CSV file, you need to provide it with a clear indication of the data to be included in the file.
For example: Generate a CSV file with the names, ages and e-mail addresses of the 20 employees of the company.
Mental map
Mind maps are a visual way of presenting information in an organized manner. To ask ChatGPT to generate a mind map, you need to provide it with a clear indication of the topics and the structure of the map.
For example: Generate a mind map describing the different elements that make up Darwin's theory of evolution.
Outline
Outlines are an effective way to present information in a hierarchical and structured manner. To ask ChatGPT to generate an outline, you need to provide it with a clear indication of the structure and topics to be included in the outline.
For example: Generate an outline on the different types of renewable energy, including solar energy, wind energy and hydropower.
JSON
JSON (JavaScript Object Notation) format is a common form of structured data exchange. To ask ChatGPT to generate a JSON file, you need to provide it with a clear indication of the data to be included in the file and the file structure.
Example: Mention the basic knowledge I should have to work in data science. Use JSON format with lists at the lower levels.
For example: Generate a JSON file with information about the most sold products in the store, including product name, price and number of units sold.
In summary, to ask ChatGPT to generate specific formats such as tables, CSV files, mind maps, outlines and JSON files, it is necessary to provide a clear and specific indication about the structure and data to be included. By doing so, accurate and relevant results can be obtained.
Json viewers:
Improve results by iterating
Improving results through iterations involves refining and enriching initial responses through iterations.
Each cycle starts from the previous response and adjusts, adds or deletes to improve its quality, providing feedback to the model on the necessary changes.
This process of continuous improvement increases the accuracy and relevance of the answers to our needs, achieved through constant feedback and gradual adjustment. This technique is applicable for:
- Refine responses until the desired result is achieved, providing feedback to ChatGPT on required changes.
- Create complex elements by dividing them into subtasks.
- Generate code in different languages, adding functions to previous answers. For this purpose, follow these steps:
- Start with simplicity, validating expected results.
- Adjust the complexity of the prompt if the results are not satisfactory.
- Experiment with model configurations and parameters.
- Use feedback to adjust the prompt on long-term projects.
- Document adjustments and achievements to improve efficiency in future refinements.
Example:
Input 1: You are an Al model that helps me to write code structures in python for the use of artificial intelligence with keras, do you understand your purpose?
Output: response
Input 2: Create the architecture of a convolutional network model for classifying images of dogs and cats, the training images are located in (the path of your files that you see in convolutional network topics) "/train/cats" "train/dogs".
Output: response
Input 3: image input should be 28 x 28
Output: response
Input 4: add some dropout layers and other technique to decrease overfitting
Output: response
Input 5: for data augmentation add the properties of rotation_range, width_shift_range and height_shift_range, just show me the code.
Output: response
Input 6: now show me the complete code but with callbacks like early stopping and other callbacks that help me to improve the model performance.
Output: response
Input 7: continue with the code, make it complete, do not give explanations.
Role play: asking ChatGPT to act in a certain way
- https://huggingface.co/datasets/fka/awesome-chatgpt-prompts
- https://github.com/f/awesome-chatgpt-prompts
ChatGPT is able to act as if it were a specific person or adopt a specific personality, which can be interesting for certain situations. For example, if we want to know your opinion about a movie, we could ask you directly.
- Prompt: "Give me your opinion on the interstellar movie."
- Answer: "As an AI language model, I have no emotions or personal opinions, but I can give you objective information about the movie Interstellar. It is a movie about..."
However, it is important to note that as an AI language model, ChatGPT has no emotions or personal opinions of its own.
For a more specific answer, we may ask you to act as a subject matter expert.
- Prompt: "I want you to act like a film critic. You will develop an engaging and creative opinion of a film. You can address issues such as plot, tone, acting and characters, direction, music, film effects, editing, pacing and dialogue. The most important thing is to emphasize how the film made you feel. what really resonated with you. You can also be critical of the film. Please avoid spoilers. My experience with "write your opinion about the interstellar movie.".
- Answer: "The film Interstellar is a stunning example of how cinema can combine an emotionally resonant story with spectacular visual effects and virtuoso direction. From the outset, the plot is established as an epic journey that traverses time and space, and the film does not disappoint in any respect. The acting by the entire cast is..."
In this case, ChatGPT will respond with a more detailed and in-depth opinion, providing a more complete movie review. This is possible because we can define and customize how we want ChatGPT to act and communicate.
This tool is useful in case you need an objective opinion within the capabilities of this, on any topic, or even to interact in a more personalized way with ChatGPT in a variety of situations, which will allow us to take advantage of this in a myriad of interesting or specific cases, such as asking for ideas for something acting as an expert on the subject and much more.