Preface#
Just as using tips for a good search engine can greatly improve your search efficiency, some flexible techniques for communicating with ChatGPT can greatly enhance your ability to use AI.
I divide the learning of these techniques into three stages:
- Learning the basic principles
- Learning how to structure and write prompts
- Exploring how to let GPT assist you in writing prompts
Below, I will explain these three stages separately.
Basic Principles#
There are two basic principles: 1. Be as clear as possible 2. Make GPT think as much as possible
Clear#
The essence of GPT is probabilistic inference, and the more information it obtains, the more accurate it becomes. In extreme cases, if you say "one" to ChatGPT, it will be confused because it doesn't know what you mean and cannot make inferences.
Suppose you want to know how to make an authentic Sichuan-style Mapo Tofu. In the past, if you searched "Mapo Tofu" on Google, the search engine would show you many recipe websites based on keywords. You could easily find a recipe by clicking on a few results on the first page.
But if you directly say "Mapo Tofu" to a chatbot, it may not accurately understand your needs. The chatbot may give answers that are unrelated to the actual recipe. On the other hand, if you provide a detailed description like "Please provide a recipe for making authentic Sichuan-style Mapo Tofu, including the required ingredients, steps, tips, etc., and provide explanations after each step, and finally summarize the taste characteristics of this dish
", then the chatbot can accurately understand your needs and provide specific and useful recipes.
This shows that when using a chatbot, it is necessary to provide clear and specific descriptions, rather than simple keywords, in order to obtain high-quality answers. This is very different from using a search engine. Clear expression can help the chatbot better understand the requirements and provide better responses. While ensuring the lower limit of output quality, it can also improve the upper limit of output quality!
This is completely different from the experience of using Google and other search engines in the past.
Make GPT think more#
Making GPT think more means making it reason instead of answering directly.
By adding requirements for step-by-step reasoning in the prompt, the language model can spend more time on logical thinking, and the output results will be more reliable and accurate. Take an example from OpenAI: if you need GPT to determine whether a student's answer is correct, the prompt is "Determine if the student's solution is correct", when facing complex calculation problems and answers, GPT has a high probability of giving incorrect answers because GPT does not reason the answer before answering like a human would, but immediately gives a judgment. In a short judgment, it is impossible to give the correct answer (just like humans cannot calculate complex mathematics in a short time). If the prompt is changed to "First solve the problem yourself, then compare your solution with the student's solution and evaluate whether the student's solution is correct. Do not determine the correctness of the student's solution before you have completed the problem yourself
". By providing clear guidance and conditions in the prompt, the GPT model can spend more time deducing the answer, thereby obtaining more accurate results.
Another effective method is to guide the GPT model to decompose a complex task into multiple simple subtasks and complete them one by one.
This method of task decomposition involves first dividing a large, complex task into several smaller, more manageable subtasks. Next, we guide the GPT model to focus on the reasoning process of each subtask separately. After completing all the subtasks, the results of each part are combined to form a comprehensive final result. The advantage of using this method is that it allows the GPT model to concentrate more on each subtask, thereby effectively improving the accuracy and quality of the output.
Some ready-to-use prompts to enhance performance#
The following statements can be added to the end of any conversation to improve the quality of GPT's responses to some extent.
PS (Plan and Solve): Let’s first understand the problem and devise a plan to solve the problem. Then, let’s carry out the plan and solve the problem step by step.
PS+ (Plan and Solve): Let’s first understand the problem, extract relevant variables and their corresponding numerals, and make a plan. Then, let’s carry out the plan, calculate intermediate variables (pay attention to correct numerical calculation and commonsense), solve the problem step by step, and show the answer.
APE (Automatic Prompt Engineer): Let’s work this out in a step by step way to be sure we have the right answer.
OPRO (Optimization by PROmpting): Take a deep breath and work on this problem step-by-step.
A little bit of arithmetic and a logical approach will help us quickly arrive at the solution to this problem.
Let's combine our numerical command and clear thinking to quickly and accurately decipher the answer.
Structured Prompt#
When you want ChatGPT to perform more complex tasks, you need more complex prompts. So how do you write complex prompts? You can use the following structured prompt techniques.
What is structure? Let's take daily reading and writing as an example. In the books we read, they use various grammar elements such as titles, subtitles, paragraphs, and sentences. In our own writing process, we also express our ideas by dividing them into chapters and paragraphs. In short, the concept of a structured prompt is similar to the writing process: it helps us express our ideas clearly and systematically through structure.
Just as we use various writing templates in our daily lives to facilitate reading and expression, such as ancient "eight-legged essays," modern resume templates, student experiment report templates, and paper templates, these structural templates help us present content in an organized manner. Similarly, writing a structured prompt can also use various high-quality templates, which not only make the writing process easier but also improve the effectiveness and efficiency of the content. Therefore, choosing or creating suitable templates, just like using PowerPoint templates, can greatly improve the quality of structured prompts.
One of my templates is:
####**Background**
Describe the background of the task.
####**Objective**
Tell GPT what its ultimate goal is.
####**Implementation Strategy**
Tell GPT how to achieve the above goal step by step.
####**Output Example**
Provide an output example.
####**Constraints and Important Points**
Tell GPT about the constraints or important points.
In the implementation strategy part, you can use the AOT structure:
AoT (Algorithm of Thoughts) imitates algorithmic thinking. It implements tasks through the following workflows.
- Define the problem: AoT first clearly states the problem.
- Collect information: AoT prompts the LLM to obtain necessary information.
- Analyze information: The LLM analyzes the collected information.
- Propose hypotheses: Propose an initial solution.
- Test hypotheses: The LLM refutes the hypotheses and imagines potential results.
- Draw conclusions: The LLM provides a complete solution.
Based on the above principles, let's take a look at the example of book list filtering:
-
Book List Clustering
####Background
I have a rich book list that covers various types of books.
####Objective
Please classify them based on the content and characteristics of the books. The classification should not exceed 5 categories and ensure accuracy.
####Implementation Strategy
take a deep breath and think step by step:
- Determine possible book genres and preliminarily classify them based on book titles.
- Collect relevant introductions or content information for each book.
- Further classify the books based on the collected information.
- Evaluate whether the books in each category have similar themes or content.
- If the books in a category are not similar enough, consider further subdivision or adjustment of the classification.
- Finally, confirm that the books in each category are similar and provide relevant keywords.
####Constraints and Important Points
- Please ensure that the classification is based on facts, that is, the actual content of the books.
- Provide keywords for each category to help understand the characteristics of the category.
- Please ensure that there are no more than 5 categories.
####Book list:
-
Book List Filtering
####Background
I am looking for detailed information about some books in order to decide whether to read them.
####Objective
Please provide summaries for the following books. This will help me understand the content and characteristics of each book and help me make decisions.
####Implementation Strategy
take a deep breath and think step by step:
- For the given book list, first determine the complete titles and authors of the books.
- Search for and collect detailed summaries for each book.
- Simplify the collected summaries to ensure clarity and completeness of information.
- Based on the information provided in the summaries, make a preliminary assessment of the books, including possible target audience, style, themes, etc.
- Integrate all the information and provide it to the user in the order of the book list.
-
Example
Book: "XXXX", Author: "AAAA":
- Summary: This book describes...
- Evaluation: Suitable for readers who like historical novels, the style tends to be descriptive, and the theme focuses on...
####Constraints and Important Points
- The provided information must be based on facts.
- If the specific content of a book is unknown, state it directly.
- Provide complete and concise summaries as much as possible.
####Book list:
There are still many aspects of structured prompts to explore. Interested friends can follow Li Jigang on Jike or refer to LangGPT.
Let GPT help you complete the prompt#
The real change is that you can teach GPT how to write prompts and let it help you complete the task.
You can feed all the above techniques to GPT and make it an expert in prompt writing. In this mode, you only need to provide a draft prompt, and GPT can automatically optimize it. This means that with a simple initial input, GPT can use its learned techniques to help you refine and improve the quality of the prompt.
Specifically, the advantages of this method include:
- Improving the quality of prompts: A well-trained GPT can write prompts based on best practices, ensuring their completeness and fully unleashing the potential of the GPT model.
- Saving energy and time: This method automates the previously tedious process of prompt writing, saving users from starting from scratch and greatly saving time and energy.
- Facilitating iteration and optimization: With the assistance of GPT, users can quickly iterate and optimize prompt versions, evaluate their effectiveness, and choose the best template, making optimization easy.
- Wide adaptability: GPT can learn and master prompt writing techniques for different domains and tasks, easily adapting to new requirements.
Summary#
From the above content, we can see the three levels of efficient communication with ChatGPT:
- Understanding the basic principles: This is the foundation of using ChatGPT, emphasizing clarity and prompting GPT to think deeply. Through vivid and vivid analogies, we can better understand and apply these principles.
- Mastering the techniques of structured prompts: In this level, we learn how to use frameworks such as background, objective, strategy, and constraints to guide GPT to effectively solve complex problems.
- Using GPT to assist in prompt writing: This represents the high-level interaction with ChatGPT, achieving the goal of automatically generating high-quality prompts, reducing repetitive labor.
By gradually delving into these three levels, we can establish a more efficient and rich collaborative relationship with ChatGPT, fully unleash its tremendous potential, and create more value.
References#
[https://guangzhengli.com/blog/zh/gpt-embeddings/]
https://mp.weixin.qq.com/s/HH2JthU7pmiSjbHsJKpy7w algorithm of thoughts
https://twitter.com/bindureddy/status/1700715030046802148 thought tree