Note for Prompt Engineering Techniques (Ibrahim John)

The Art of Asking ChatGPT for High-Quality Answers A Complete Guide to Prompt Engineering Techniques Copyright © 2023 Ibrahim John

Chapter 1: Introduction to Prompt Engineering Techniques (介绍)

Prompt engineering is the process of creating prompts or asking or instructions that guide the output of a language model like ChatGPT.

ChatGPT is a state-of-the-art language model that is capable of generating human-like text. It is built on the transformer architecture, which allows it to handle large amounts of data and generate high- quality text.

A prompt formula is a specific format for the prompt, it is generally composed of 3 main elements:

Chapter 2: Instructions Prompt Technique (要求说明)

The instructions prompt technique is a way of guiding the output of ChatGPT by providing specific instructions for the model to follow.

Exampes:

Generating customer service responses:

The instructions should be clear and specific.

Chapter 3: Role Prompting (定位角色)

The role prompting technique is useful for generating text that is tailored to a specific context or audience. You will need to provide a clear and specific role.

Generating customer service responses:

Chapter 4: Standard Prompts (标准模式)

Standard prompts are a simple way to guide the output of ChatGPT by providing a specific task for the model to complete.

Example: Generating a summary of a news article:

Example: Generating a product review:

Chapter 5: Zero, One and Few Shot Prompting (提供案例)

With minimal or no examples. These techniques are useful when there is limited data available for a specific task or when the task is new and not well-defined.

Example: Generating a product description for a new product with no examples available:

Example: Generating a product comparison with one example available:

Example: Generating a product review with few examples available:

Chapter 6: "Let’s think about this” prompt (思考模式)

Used to encourage ChatGPT to generate text that is reflective and contemplative. This technique is useful for tasks such as writing essays, poetry, or creative writing.

The - Prompt formula: "Let's think about this: [a topic or question]"

Examples:

Chapter 7: Self-Consistency Prompt (逻辑自恰)

Ensure that the output of ChatGPT is consistent with the input provided. This technique is useful for tasks such as fact-checking, data validation, or consistency checking in text generation.

The - Prompt formula: the input text followed by the instruction "Please ensure the following text is self-consistent"

Example: Text Summarization

Example: Fact-checking:

Example: Data validation:

Chapter 8: Seed-word Prompt (种子词汇)

This technique allows the model to generate text that is related to the seed word and expand on it.

The - Prompt formula: followed by the instruction "Please generate text based on the following seed-word"

Example: Text Generation

Chapter 9: Knowledge Generation prompt (知识生成)

used to elicit new and original information.

The - Prompt formula: "Please generate new and original information about X" where X is the topic of interest."

Chapter 10: Knowledge Integration prompts (知识整合)

This technique uses a model's pre-existing knowledge to integrate new information or to connect different pieces of information. This technique is useful for combining existing knowledge with new information to generate a more comprehensive understanding of a specific topic.

Chapter 11: Multiple Choice prompts (多选项)

This technique is useful for generating text that is limited to a specific set of options and can be used for question-answering, text completion and other tasks. The model can generate text that is limited to the predefined options.

Chapter 12: Interpretable Soft Prompts (可解释的软提示)

providing the model with a set of controlled inputs and some additional information about the desired output.

Chapter 13: Controlled Generation prompts (生成控制)

providing the model with a specific set of inputs, such as a template, a specific vocabulary, or a set of constraints, that can be used to guide the generation process.

Chapter 14: Question-answering prompts (问答)

providing the model with a question or task as input, along with any additional information that may be relevant to the question or task.

Chapter 15: Summarization prompts (总结)

providing the model with a longer text as input and asking it to generate a summary of that text.

Chapter 16: Dialogue prompts (对话)

provided with information about the desired output, such as the type of conversation or dialogue and any specific requirements or constraints.

Chapter 17: Adversarial prompts (对抗)

Adversarial prompts is a technique that allows a model to generate text that is resistant(抵制) to certain types of attacks or biases(偏见). This technique can be used to train models that are more robust(强健的) and resistant to certain types of attacks or biases.

To use adversarial prompts with ChatGPT, the model should be provided with a prompt that is designed to be difficult for the model to generate text that is consistent with the desired output. The prompt should also include information about the desired output, such as the type of text to be generated and any specific requirements or constraints.

Chapter 18: Clustering prompts (归类)

group similar data points together based on certain characteristics or features.

providing the model with a set of data points and asking it to group them into clusters based on certain characteristics or features.

Useful for tasks such as data analysis, machine learning, and natural language processing.

Chapter 19: Reinforcement learning prompts (强化学习)

allows a model to learn from its past actions and improve its performance over time. provided with a set of inputs and rewards, and allowed to adjust its behavior based on the rewards it receives. useful for tasks such as decision making, game playing, and natural language generation.

Chapter 20: Curriculum learning prompts (课程学习)

Allows a model to learn a complex task by first training on simpler tasks and gradually increasing the difficulty. Provided with a sequence of tasks that gradually increase in difficulty. Useful for tasks such as natural language processing, image recognition, and machine learning.

Chapter 21: Sentiment analysis prompts (观点分析)

Determine the emotional tone or attitude of a piece of text, such as whether it is positive, negative, or neutral. To provided with a piece of text and asked to classify it based on its sentiment. Useful for tasks such as natural language processing, customer service, and market research.

Chapter 22: Named entity recognition prompts (已命名事物识别)

identify and classify named entities in text, such as people, organizations, locations, and dates. To provided with a piece of text and asked to identify and classify named entities within the text.

Chapter 23: Text classification prompts (文本分类)

categorize text into different classes or categories. This technique is useful for tasks such as natural language processing, text analytics, and sentiment analysis. provided with a piece of text and asked to classify it based on predefined categories or labels.

Chapter 24: Text generation prompts

used to fine-tune a pre-trained model or to train a new model for specific tasks.

A. Reference