All Tips You Need to Know for Writing a Prompt

The core purpose of this article is to teach you how to write an excellent prompt. We will start with the definition of prompt, the operation process, and the various elements that an excellent prompt should have, and gradually unfold detailed analysis and practical examples, so that you can master the skills and strategies of writing efficient prompts in a short time.
Introduction
Large Language Models (LLMs) play an increasingly important role. However, to truly utilize the power of these models, the key lies in how to input clear, detailed, and expected instructions to the model, which is the most important thing we are going to discuss today - the writing of the Prompt.
Prompt, as a structured input sequence, not only provides task requirements and background information for the model, but also determines the quality and relevance of the model output to a large extent. A well-designed Prompt can minimize misunderstandings, enable the model to understand the user's needs, and generate high-quality responses.
The core purpose of this article is to teach you how to write a good Prompt, we will start from the definition of Prompt, the operation process, and the elements of a good Prompt, step by step to develop a detailed analysis and practical examples, so that you can master the skills and strategies of writing an effective Prompt in a short period of time. By continuously optimizing your Prompt writing ability, you will be able to better guide the large language model and generate high-quality text output for various application scenarios.
Are you ready? Let's open the Prompt writing secrets together and unlock the infinite possibilities of the large language model!
Prompt Definition
Definition
In the field of Large Language Models (LLM), a Prompt is a structured sequence of inputs that guides a pre-trained language model in generating the expected output. It typically includes explicit task requirements, background information, formatting provisions, and examples to leverage the model's ability to generate high-quality responses for a given task.
Prompt's runtime process
Prompt's runtime process is closely related to the operation principles of the large language model. If you have a background in the large language model, it will be easy to understand, you can learn "a comprehensive understanding of what the large language model (LLM) is" and related chapters.
Prompt operation is divided into the following five steps:
1. Receive Input
-
The user or system provides the language model with a Prompt that contains task instructions, background information, examples, and formatting instructions.
-
For example, the Prompt could be, "Write an article about climate change, including its causes, effects, and solutions."
2. Text Processing and Coding
-
The model first preprocesses the input Prompt, including tokenization and encoding.
-
The preprocessing process converts the text into a series of lexical IDs (token IDs) which are passed to the Embedding layer for further processing.
3. Model Calculation
-
The encoded text is fed into a neural network based on the Transformer architecture, which consists of multiple layers of the Self-Attention Mechanism and Feed-Forward Neural Network.
-
In the Self-Attention Mechanism layer, the model is able to consider each word in the input sequence in relation to the other words and compute Attention Weights to capture distant dependencies.
-
Subsequently, the feed-forward neural network layer performs a nonlinear transformation on the output of the self-attention layer to generate a new representation.
-
Multiple Transformer layers are stacked together to allow the model to progressively build a deeper understanding of the input Prompt.
-
Positional Encoding (Positional Encoding) is also added to complement the positional information, since the self-attention mechanism itself does not distinguish the positional order of words.
4. Generating Output
-
The model samples the next vocabulary from the generated probability distribution based on the computational results. Each generated vocabulary is iteratively fed back into the model to generate subsequent vocabularies. This process continues until the output conditions are met (e.g., a predetermined sentence length is reached or a special terminator is encountered).
-
This process is called Decoding and can use Greedy Search, Beam Search, or other sampling methods (e.g., random sampling and kernel sampling) to generate optimal text output.
5. Formatting and Post-Processing
-
The generated output text may require further formatting and post-processing to ensure compliance with the output format and style required by Prompt. For example, it may be necessary to remove redundant content, adjust spaces or correct spelling errors.
-
If Prompt requires the generation of a summary of no more than 200 words, the generated text can be intercepted in the post-processing step, while ensuring that the summary is complete and coherent.
What is a Good PRMOPT
Subjectively: a good PROMPT is like chatting with your old friends, both clear and relevant, but also simple and straightforward.
Think About It from Another Perspective: Check Your Prompt, Can the AI Read it in One Breath?
Think differently and imagine if the AI reads your words smoothly. If the AI pauses while reading, and each pause is like an awkward moment in high school when reading a text aloud on stage, then your PROMPT needs to "lose weight".
Talk Like a Friend
A good PROMPT is like chatting with a friend, not too complicated but clear. You just need to know what you want and let the AI know what you want, then everything will be as simple as eating a big steamed bun.
In short, when your PROMPT can be understood by the AI, save you trouble, and be interesting and practical, then you are having fun with the AI! So, feel free to have a pleasant conversation with the AI!
Objectively: see below metrics...
The 4 Basic Elements of the Precise Creation of the PROMPT
Clear Objectives and Tasks
When designing an effective PROMPT, you need to be specific and clear in spelling out your desired outcomes and requirements. This includes clarifying the overall goal of the PROMPT and the specific tasks you wish to perform, such as generating text, answering questions, translating language, or performing sentiment analysis. Using clear, concise, and precise language helps to narrow down the output of the model and reduces the risk of misinterpretation and the generation of irrelevant content, thereby improving the quality and relevance of the content generated.
Avoid ambiguity: Use specific words and sentences to avoid making the model guess your intentions. This reduces comprehension errors and improves the quality of generated content.
Take an Example
- Not clear enough: "Describe climate change."
- Unambiguous: "Write a 200-word essay discussing the impact of climate change on global agricultural production, particularly on water management and crop yields."
Accurately expresses desired information or results.
- Not accurate enough: "Tell me about machine learning."
- Accurately expresses, "Explain what machine learning is, including its basic concepts and at least two commonly used algorithms (e.g., decision trees and neural networks), and discuss their respective application areas."
PROMPT can be significantly improved by clearly defining goals and tasks and using specific language to describe them. This not only helps the model to better understand the user's needs, but also ensures that the generated output is more in line with the user's expectations. Clear task definitions and specific language descriptions are key elements in creating an effective PROMPT.
Context and Background Information
Context and background information can help to better understand how to create high-quality prompts that guide generative AI models to produce accurate, efficient, and targeted responses. It contains sufficient contextual and background information, specific task objectives and expected outputs, and clarifies any necessary details, constraints, and target readers or user groups. A great prompt effectively reduces ambiguity and enables the model to excel at overviewing complex information and responding optimally.
Include the following:
1. Role and identity
-
Clarify the role of the task requester (e.g., student, researcher, product manager).
-
Knowing the requester's identity helps to customize the professionalism and tone of the answer.
2. Specific objectives of the task
-
Define the task to be accomplished or the question to be answered.
-
Include specific details and expected output.
3、Relevant history and current status
-
Provide background history relevant to the task, such as previous research, project progress, or market conditions.
-
Address the current environment or conditions, including any changes or influencing factors.
4. Specific Requirements and Conditions
-
Identify the specific requirements and conditions of the assignment (e.g., word limits, formatting requirements, time constraints).
-
Describe any constraints that must be met.
5. Readers or Audience
-
Clarify the target audience for the response.
-
Adapt the complexity and language style of the response to suit the particular reader.
Give an example
Suppose you are an urban planner designing a public transportation system for an emerging city. Write a report evaluating some of the globally advanced cities' transportation systems currently in place, including their strengths, weaknesses, and user satisfaction profiles. The report should include a detailed analysis of each transportation system and recommendations for adapting it to your city. Corresponding context:
1. Role and identity: urban planner
2. Specific objective of the assignment: designing a public transportation system for an emerging city
3. Relevant history and current situation:
- Current state of transportation in the city
- Context and motivation for the need of the system
4. Specific requirements and conditions:
- Need to evaluate the strengths and weaknesses of advanced transportation systems available worldwide.
- User satisfaction must be analyzed
5. Reader or audience: City management and the interested public
By providing this context and background information, the model is able to understand the context of the task, identify key factors and generate effective and relevant recommendations. For example, the model will be more inclined to provide practical, workable transportation system recommendations in your emerging city, rather than generalizations. This ensures that the task is accomplished in a way that is more in line with the actual needs and purpose.
Detailed Metrics or Assessment Dimensions
A good PROMPT should have detailed metrics or evaluation dimensions for achieving the mission objectives, providing a clear, comprehensive, and efficient assessment to ensure that the mission objectives are met. Ensure that the PROMPT achieves its objectives in an objective and evidence-based manner, so that the objectives of the mission can be effectively realized. Together, these elements ensure PROMPT assessment validity and reliability.
The core elements required for a good PROMPT focus on the following four points:
1. Clearly provide metrics or assessment dimensions that are directly related to the objectives and tasks:
- Key Points: The PROMPT should pinpoint which metrics or dimensions are key to assessing task accomplishment and analyze in detail how these metrics or dimensions relate to the task objectives.
2. The metrics or dimensions should be comprehensive, covering all necessary aspects of the assessment without omitting any key elements.
- Key point: Ensure that the assessment criteria are comprehensive and cover all important factors, so that the overall evaluation is more comprehensive and accurate, leaving no gaps in the assessment.
3. Each metric or dimension should have a corresponding metric to support its assessment process:
- Point: Provide detailed measurement criteria for each assessment dimension to ensure that each dimension has a clear evaluation basis, thus facilitating the actual operation and implementation of the assessment process.
4. Definitions of metrics or assessment dimensions should be clear and unambiguous, and easy to understand and implement:
- Point: The definition should have a high degree of clarity and objectivity, with clear scoring guidelines to ensure the transparency and fairness of the assessment, so that all aspects are easy to understand and implement.
An Example
Task Description: Comprehensive Student Assessment
Please calculate the overall performance of students based on their attendance and the number of extracurricular activities they participate in.
Description:
Poor correspondence between objectives and tasks: the assessment dimensions only include "attendance" and "number of extracurricular activities", and do not directly address academic performance.
Incomplete dimensions: Key dimensions such as "academic ability" and "behavioral performance" are missing to comprehensively assess students' overall performance.
Incomplete measurement criteria: only "number of days of attendance" and "number of activities participated" are used as measurement criteria, and there is a lack of assessment of academic and behavioral performance.
Unclear metrics: There are no clear criteria for assessing the relationship between "activity participation" and "attendance" and overall student performance.
Please assess the overall performance of the students with a total score of 100 points, with the following dimensions and criteria:
-
Academic Achievement (30 points): Please provide the average score on a percentage scale. For example, if the average score is 85, the score will be 25.5 (85/100 × 30).
-
Attendance (25 points): Please provide the percentage of attendance days to the total number of class days. For example, if the attendance rate is 95%, the score will be 23.75 points (95/100 × 25).
-
Participation in extracurricular activities (20 points): Please provide the number of times you participated in activities. For example, participation in more than 5 times will be scored 20 points, 3-4 times will be scored 15 points, 1-2 times will be scored 10 points, and no participation will be scored 0 points.
-
Character Performance (25 points): Please provide a behavioral record score, e.g., A (excellent) scores 25 points, B (good) scores 20 points, C (moderate) scores 15 points, and D (poor) scores 10 points.
Description:
High correspondence between objectives and tasks: the assessment dimensions include academic performance, class attendance, participation in extracurricular activities, and behavioral performance, which directly reflect students' overall performance.
Comprehensive and applicable dimensions: covering students' academics, attendance, activity participation, and conduct, comprehensively assessing students' performance in all aspects.
Measurement criteria are complete, such as academic grade point average, percentage of attendance, number of activities participated in, and character rating.
Clear and Objective Measurement Criteria: Clear scoring criteria, such as academic grades based on percentage, attendance calculated based on normal attendance records, activity participation graded by grade, and conduct scored by behavioral records, ensure that the assessment is transparent and fair.
Task Description: Generate Interview Summaries
Please summarize the candidate's performance and state whether he/she is intelligent, mature, and sunny.
Description:
Poor correspondence between objectives and tasks: only vague trait requirements are provided without clear assessment dimensions.
Incomplete dimensions: The assessment dimensions lack refinement and do not specifically describe how the candidate's performance on each trait will be assessed.
Incomplete measurement standards: The lack of specific measurement standards can easily lead to strong subjectivity, which cannot ensure the consistency of the assessment.
Unclear measurement criteria: the lack of clear scoring and evaluation details makes it difficult to ensure that the assessment process is transparent and fair.
Extract relevant content from the three talent traits (smart, mature, sunny) to generate a summary for the candidate's interview performance.
1. Smart (40 points)
-Learning: Assess whether the candidate has the ability to learn continuously, whether they can draw inferences from one instance and apply what he has learned. Please provide specific examples and a score.
-Curious: Assess whether the candidate maintains curiosity and constantly explores new methods and new ideas at work. Please provide specific examples and a score.
-Critical thinking: Assess whether the candidate can understand the nature and diversity of things, whether he can cope with changes, and make decisions and take actions thoughtfully. Please provide specific examples and a score.
2. Maturity (30 points)
3. Sunshine (30 points)
Description:
High correspondence between objectives and tasks: the relationship between the assessment dimensions and the interview traits is clearly defined, covering the traits of smartness, maturity, and sunshine of the candidates.
Dimensions are comprehensive and applicable: the dimensions are detailed and applicable to comprehensively assess the candidate's traits and overall abilities.
Measurement criteria are complete: Quantitative criteria are provided for learning, curiosity, dialectical thinking, self-awareness, empathy, objectivity, rationality, energy, sincerity, and non-complaining.
Clear and Objective Measurement Criteria: Clear scoring criteria ensure that each dimension is assessed on a specific basis and that the scoring process is transparent and fair.
Clear Input and Output Formats
Input format refers to the structure and form of the raw data received by the model. A clear input format defines how the data should be organized and presented to ensure that the model is able to parse and understand the data correctly. The output format is the expected structure and form of the results generated by the model. An explicit output format defines how the model should organize and present the generated content to meet specific requirements or standards.
Example:
Text format (e.g., long answers, summaries)
Structured data formats (e.g. JSON, XML, CSV)
Coded data formats (e.g. source code)
Template: A template is a pre-defined format or structure that guides the model in generating output.
An Example
JSON Format Output
An output format is the expected structure and form of the model's generated results. An explicit output format defines how the model should organize and present the generated content to meet specific requirements or standards.
Example of expected output:
{
"students": [
{
"name": "Alice",
"total_score": 255,
"average_score": 85,
"grades": {
"Math": 85,
"English": 78,
"Science": 92
}
}
]
}
Template Output
Output the template:
The output format shall follow the following JSON template.
{
"students": [
{
"name": "<NAME>",
"total_score": <TOTAL_SCORE>,
"average_score": <AVERAGE_SCORE>,
"grades": {
"Math": <MATH_SCORE>,
"English": <ENGLISH_SCORE>,
"Science": <SCIENCE_SCORE>
}
}
]
}
8 metrics to Optimize PROMPT
1. Samples and Examples
In cue engineering, samples are specific input-output pairs used in a particular task to guide and help the model understand the task requirements. Samples can be one-shots or few-shots, and are often used in the context of a cue to provide explicit examples of the task.
The significance of samples
1. Enhance model understanding:
-
Explicit task requirements: By providing concrete examples, the model can more clearly understand the goal of the task and the desired output format. This is important for tasks that require precise output formats.
-
Reduce ambiguity: Samples can remove ambiguity from the task description and provide clear guidelines, making it easier for the model to generate output that meets expectations.
2. Improve model performance:
-
Fast Learning: Providing samples allows the model to quickly learn the task characteristics with a small amount of data, reducing the need for training, which is the core concept of few-shot and one-shot learning.
-
Improve accuracy: By providing diverse examples, the model can better capture the nuances of the task and improve the accuracy and consistency of the generated results.
3. Adapt to diverse scenarios:
-
Cross-domain application: By carefully curated examples, the model can adapt to the task requirements of different domains, such as text categorization, sentiment analysis, Q&A generation, etc.
-
Task complexity: The samples can help the model cope with task requirements from simple to complex, providing task solutions from elementary to advanced.
Types of samples
1. One-shot Sample:
-
A single input/output pairing example is provided to the model to help the model understand the task requirements and the desired output format. Applicable when the model already has relevant domain knowledge.
-
Scenario: The model already has some basic knowledge and only needs an example to understand the specific format and expected output.
2. Few-shot example:
-
Provide the model with multiple (usually 2-5) input-output pairing examples to further clarify the task details and complexity. Suitable when the model has some understanding of the task but needs more concrete examples.
-
Applicable scenarios: the task is more complex, or the model is not familiar enough with the task and needs multiple examples to learn the task features.
Relationship between samples and metrics
When there are clear metrics or assessment dimensions in the prompt, the samples serve not only to demonstrate and guide, but also to assist in evaluating and optimizing the model's output. Explicit metrics make samples more instructive and evaluative, providing the model with clear indicators of success and directions for improvement. This combination helps to improve the model's performance on a given task, making the results it generates more in line with expectations.
An Example
Task: Generate a segment of a product evaluation based on the following description. The content of the evaluation needs to meet the following metrics:
- Accuracy: The review must reflect the product's features, including sound, comfort, and battery life.
- Completeness: The review should include specific pros and cons of the product, such as sound quality, wearing comfort, and battery life.
- Fluency: The review must be grammatically correct, easy to understand, and have coherent language.
Sample
Input:
The sound quality of this headset is very good, but it can be a little uncomfortable to wear for a long time. The battery life is also good and can support a full day of use.
Output:
-Pros: Good sound quality and long battery life.
-Cons: Uncomfortable ears after long-term wear.
-Comment: The sound quality of this headset is very good and can provide an excellent listening experience. In addition, the battery life is also excellent and can support a full day of use. However, wearing it for a long time may cause ear discomfort.
Description
-
The sample output clearly reflects the product features in the input, such as good sound quality and long battery life, while also including poor comfort. No exaggerations or omissions.
-
The example output mentions specific pros and cons of the product in detail, ensuring that the evaluation is comprehensive. For example, good sound quality and excellent battery life are emphasized, and it is noted that the ear is uncomfortable after wearing them for a long period of time.
-
The sample output is grammatically correct, clearly structured, and uses language that is easy to understand. For example, the synthesized sentences connect naturally and do not appear hard or broken
Specific application scenarios
1. Text categorization task:
Metrics: classification accuracy, recall.
Sample relationships: provide examples of positive, negative, and neutral classifications to help the model understand classification boundaries.
Examples:
Input: "This game is so exciting!"
Output: "Sports"
2. Sentiment analysis task:
Metrics: classification correctness (positive, neutral, negative), text fluency.
Sample relationships: multi-sentiment examples are shown to enable the model to better capture sentiment details.
Examples:
Task: Sentiment Analysis.
Example 1:
Input: Sentence - "I like this phone very much. It has great features."
Output: Sentiment - "Positive"
Example 2:
Input: Sentence - "I am very disappointed with the service this time."
Output: Sentiment - "Negative"
Example 3:
Input: Sentence - "This movie is just okay."
Output: Sentiment - "Neutral"
3. Translation task:
Metrics: translation accuracy, fluency, grammatical correctness.
Sample relations: bilingual examples help the model to master accurate translation pairs and ensure that the translation is faithful and fluent.
4. Text summarization task:
Metrics: summary content coverage, conciseness, fluency.
Sample relationship: show the long text and the corresponding high-quality summary, so that the model learns how to distill key information.
5. Q&A task:
Metrics: answer accuracy, completeness, relevance.
Sample relationship: guide the model to generate accurate and relevant answers through Q&A pair examples.
Task: Generate a reasonable question based on the following text.
Input: "Apple's latest iPhone 12 has attracted much attention, and its excellent camera and powerful processing power have impressed users."
Output: "Which of Apple's latest mobile phones has attracted much attention?"
2. Concise and Direct
PROMPT should avoid unnecessary background information and complex wording, clear instructions, streamlined content, be straight to the point, and clear task requirements so that the model can quickly focus on the task and accurately generate content.
An Example
Task description: summarize the core ideas of the novel 1984
I need you to help me summarize the main points and core ideas of the novel 1984. Please start with some background information about the book, including the year it was written and some information about the author, George Orwell, and then describe in detail the main plot of the novel, including but not limited to where and when the story takes place, as well as the relationships of the main characters and the main conflicts between them. In addition to this, please focus on analyzing the novel's thematic ideas and elaborating on them in relation to the specific plot, paying particular attention to revealing the effects of a totalitarian, surveillance society on human nature. You need to make sure that the details are sufficient and well analyzed, and you can be as exhaustive as possible.
Description:
Long-winded: contains redundant background and specific plot requirements, is overloaded with information and somewhat unnecessary.
Unconcise: overly wordy, tasks are broken down too finely, tends to get the executor bogged down in details and lose sight of the core point.
Easily misunderstood: the instructions are overly complex, which can easily lead to bias on the part of the performer in grasping the key points.
Please summarize the core ideas of 1984, especially its thematic ideas against totalitarianism and surveillance society.
Instructions:
Simplicity: removes lengthy descriptions and keeps instructions concise.
Directness: clear task requirements focusing on summarizing core ideas and thematic ideas.
Ease of execution: concise and clear instructions reduce the possibility of misunderstanding and enable the executor to focus on the task quickly.
3. Avoid Ambiguity
Avoiding ambiguity refers to ensuring that the message is conveyed clearly and accurately by describing the content of the statement or prompt in a clear and detailed manner, and that it can be accurately understood and acted upon, especially for language modeling and human-to-human communication.
1. Polysemy
Polysemy can lead to unnecessary ambiguity, and the potential for misunderstanding can be greatly reduced by choosing words with a single, clear meaning.
- Example: "Please introduce the apple." (An apple can be a fruit or a company.)
- Solution: Provide specific details or context to make the meaning of the word clear.
- Optimized description: "Please describe the Apple company."
2. Fuzzy phrases
Ambiguous phrases or statements with unclear structure can easily lead to comprehension bias and need to be described in detail to ensure that the meaning is clear.
- Example: "Explain the problem." (The specifics of the problem are not clear.)
- Solution: Clearly state the specific problem or provide background information.
- Optimized description: "Explain the effects of climate change on marine life."
3 . Clarify the referent
The use of pronouns is prone to referential ambiguity, which can be eliminated by clarifying the referent.
- Example: "He doesn't think it's a good idea." (The specifics of "he" and "do this" are not clear.)
- Solution: Specify the object or action that the pronoun refers to.
- Optimized description: "John didn't think it was a good idea to go out in the rain."
Through these measures, ambiguities in the language can be effectively reduced to make messaging more precise and effective, especially in the application of large language models to avoid erroneous or irrelevant responses.
4. Step-by-step and hierarchical guidance
Step-by-step refers to the decomposition of a complex task into multiple simple and well-defined steps, each of which is clearly articulated. This approach reduces complexity by refining the task to ensure that each part can be understood and performed independently. For example, when writing a research report, the task is broken down into five independent steps such as choosing a topic, conducting a literature review, designing the research methodology, collecting and analyzing data, and writing the report, making each step clear in terms of its objectives and methods.
When writing a research paper on the ethical issues of artificial intelligence:
- Choose a topic
- Conducting a literature review
- Designing the research methodology
- Data collection and analysis
- Writing the report
Hierarchical information refers to hierarchical and organized information that guides the user step-by-step towards deeper understanding and problem-solving. In this structure, high-level information provides the general framework and logical sequence, and low-level information refines specifics and operational details. For example, in the process of writing a report, the overall structure of the report (e.g., Introduction, Literature Review, Research Methods, Results and Discussion, and Conclusions and Recommendations) can be provided first, and then each section can be further refined for each part, describing its specific composition and content. This approach helps the user to gradually transition from the general concept to the specifics, ensuring full understanding and accurate implementation.
- General Structure: Introduction -> Literature Review -> Research Methodology -> Results and Discussion -> Conclusions and Recommendations -> References
- Detailed description:
-
Introduction: background introduction, research questions, research objectives
-
Literature review: categorization by topic, summarizing previous studies, presenting research gaps
-
Research methodology: sample selection, data collection method, data quality control
-
Results and Discussion: data presentation, interpretation of results, literature support, or rebuttal
-
Conclusions and recommendations: research findings, policy recommendations, research limitation,s and future directions
-
By combining a step-by-step and hierarchical guidance approach, it not only ensures that each step of the task is performed accurately, but also gradually guides the user to a deeper understanding and problem-solving.
An Example
Task description: write a research paper on the ethical issues of artificial intelligence
Write a research paper on the ethical issues of artificial intelligence.
Description:
Lack of step-by-step: the task description does not develop the writing process step-by-step, resulting in a task that is too vague and complex.
Lack of hierarchical information: the general framework or internal logic of the report is not provided, nor is there a breakdown of the specifics that should be included in each section.
Please write a research report on the ethical issues of artificial intelligence. To ensure that the report is complete and logically clear, please follow the steps and structure below:
a. Select a topic
- Identify the specific ethical issue you are researching, e.g. "Ethical Issues of Artificial Intelligence in the Healthcare Industry".
- Define the scope of the study, e.g. privacy protection and transparency in decision-making.
b. Conduct a literature review
- Search and read relevant literature (academic papers, books, white papers).
- Summarize the core ideas of each literature, paying special attention to extracting details relevant to your topic.
c. Design research methodology
- Identify the research methodology you will use (qualitative, quantitative or mixed).
- Describe the means of data collection: questionnaires, interviews or secondary data analysis.
d. Data Collection and Analysis
- Implement data collection to ensure consistency of approach.
- Analyze the data using appropriate analytical tools and techniques.
e. Report Writing
- Introduction:
- Describe the background, purpose and importance of the study.
- Specifically state the research problem and objectives.
- Literature Review:
- Summarize previous research results and theoretical frameworks by topic or classification.
- Research Methodology:
- Describe the design of the study, data collection and analysis methods.
- Results and Discussion:
- Present the results of the analysis and discuss their significance in the context of the literature.
- Conclusions and Recommendations:
- Summarize the findings of the study, make recommendations, and point out the limitations of the study and directions for future research.
- References:
- List all cited literature."
Instructions:
Step-by-step: the task is clearly broken down into multiple separate and specific steps with clear instructions from selecting a topic to writing each section.
Hierarchical information: the general structure of the research paper is provided, with specifics and requirements further refined in each section. Each level of information paves the way for the next level, making the process of writing the entire report logical and easy to achieve.
5. Consider Multiple Possibilities and Boundary Conditions
Consider multiple possibilities and boundary conditions
When designing the PROMPT, a variety of possible input scenarios and extreme conditions are considered to ensure that the model produces reasonable outputs in the face of a variety of non-ideal inputs. These include, but are not limited to, positive and negative examples, data scarcity, extreme values, formatting errors, and conflicting information.
Usage Scenario Analysis:
-
Chatbots: need to deal with various types of questions that a user may enter, including fuzzy queries, misspellings, syntax errors, etc.
-
Data processing and analysis tools: ensure that meaningful feedback or processing results are provided when faced with missing values, outliers, or inconsistently formatted data.
-
Customer service systems: Provide a reasonable response or request for further information when the description provided by the customer is incomplete or contradictory.
-
Automated testing: ensuring that no matter how unusual the input is during testing, the system has an appropriate response strategy to avoid crashes or invalid output.
An Example
Please provide a location and date to check the weather. The location should include the name of the city or region, and the date should be in the format yyyy-mm-dd.
1. if the location and date are not in the correct format, output "The input format is incorrect, please re-enter."
2. if the location does not exist or cannot be recognized, output "Unrecognized location, please check the location name you entered." 3. if the date is 30 days in the future, output "The date is 30 days in the future.
3. if the date is 30 days in the future, output "The date is out of the allowed range, please enter the date of the last month." 4. if the date is in the past, output "The date is out of the allowed range, please enter the date of the last month."
4. if the date is in the past, please output "The date is in the past, only future weather is supported at this time."
Note:
- The location name can be a city or region name, such as "New York" or "Tokyo".
- Dates must be in yyyyy-mm-dd format.
- All output should be friendly, concise and easy to understand.
Error Correction Mechanism
When designing the PROMPT, the common errors that may occur are taken into consideration, and corresponding detection and correction mechanisms are set up to improve the correctness and reliability of the model output. This includes automatically detecting input errors, setting default countermeasures, requesting user confirmation, and so on.
Usage Scenario Analysis:
-
Email auto-response: correct and prompt spelling errors to avoid misunderstanding, while requesting users to confirm key information to ensure the accuracy of the response.
-
Search engine: Automatically corrects search keywords entered by users and provides relevant tips or recommendations to enhance the user experience.
-
Form Submission System: Automatically detects and prompts for formatting errors in user input to avoid submitting invalid form data.
-
Translation tool: detects and corrects spelling or grammatical errors in input sentences, providing higher-quality translation results.
An Example
Please provide an email address and reply content to send an autoresponder. The email address should be in a valid email address format, and the content of the reply should be as detailed as possible.
1. if the email address is in the wrong format, please output "Invalid email address format, please re-enter the correct email address."
2. if the reply is empty or too short, please output "The reply is too short, please provide more detailed information." 3.
3. if a spelling error is detected, mark the error and suggest a change, e.g. "Spelling error 'adn' detected, suggest to change it to 'and'."
4. If the sending server is unavailable, output "Mail delivery failed, the server is temporarily unavailable, please try again later."
Caution:
- The email address must contain '@' and a valid domain name.
- The reply should contain at least 10 characters.
- Provide spelling error detection and suggested changes to enhance user experience.
6. Language and Cultural Sensitivity
Considering linguistic and cultural sensitivity and following ethical norms is essential to designing effective and secure Prompts. A good PROMPT is one that effectively guides the user or the AI system to generate input statements that meet expectations and produce high-quality responses, while at the same time demonstrating significant linguistic and cultural sensitivity and strict adherence to ethical norms in its design and use.
1. Linguistic and Cultural Sensitivity.
-
Multi-language support: PROMPT is multi-language adaptable to ensure that it can be accurately understood and used by users from different language backgrounds.
-
Cultural Adaptability: Takes into account differences in cultural backgrounds and avoids prejudice and discrimination against specific cultures, ethnic groups, religions, or political views.
-
Neutral Language Use: Use neutral, unbiased language to ensure universal acceptance in all cultural contexts.
2. Ethical Considerations.
-
Avoid offensive content: Ensure that language is not offensive, discriminatory or potentially misleading.
-
Privacy: Emphasize and protect user privacy, avoid disclosing personal information, and comply with relevant laws and regulations (e.g., GDPR).
-
Transparency and Informed Consent: Clearly inform users of the capabilities and limitations of AI systems to ensure their informed use.
-
Unbiased: Avoid systematic bias in algorithms and data models to ensure fair and equitable outputs.
Examples
Example Prompt 1.
"Please describe the customs of Chinese New Year."
Linguistic and Cultural Sensitivity.
Positive: Provides a topic that makes sense in a specific cultural context.
Room for Improvement: Need to ensure that people of all cultures understand what "Chinese New Year" is.
Ethical Considerations.
Positive: Language is neutral and not offensive.
Room for Improvement: Remind users to protect their privacy if they share their personal experiences.
Example Prompt 2.
"How do you think modernization has affected society?"
Language and Cultural Sensitivity.
Positive: This is a relatively neutral question that is suitable for people from different cultural backgrounds.
Room for Improvement: Avoid culturally specific political and economic biases when asking the question.
Ethical Considerations: Positive
Positive: The language is neutral and not offensive.
Room for Improvement: If discussing sensitive topics such as politics and economics, it is important to steer the conversation appropriately to avoid controversy.
7. Data Privacy and Security
1. Data Privacy.
-
Avoid Sensitive Information: When designing the PROMPT, make sure it does not contain or request sensitive information such as personally identifiable information (PII), financial data, health data, etc.
-
Desensitization: If real data needs to be tested, ensure that all data has been desensitized, i.e. all sensitive information has been replaced or deleted.
2. Compliance.
-
Compliance with privacy regulations: Ensure that the prompts are designed to comply with relevant privacy rules and regulations, such as GDPR, CCPA, etc. If the alert involves international users, cross-border privacy regulations should be considered.
-
Data Minimization: Prompt content should follow the data minimization principle, requiring the model to use only the minimum amount of information necessary to complete the task.
An Example
Please analyze the following customer-specific feedback, including their names, addresses, contact information, and the content of their feedback, and give suggestions for improvement based on this information:
1. Customer A: Name: Zhang San, Address: XX Street, Haidian District, Beijing, China, Phone: 123-456-7890, Feedback: Poor product quality.
2. Customer B: Name: Li Si, Address: XX Road, Pudong District, Shanghai, Tel: 098-765-4321, Feedback: Delivery time is too long.
Description:
Sensitive Information Exposure: The prompt contains the customer's name, address and contact information, which are all personal sensitive information (PII).
Privacy risk: direct exposure of customers' detailed personal information may violate privacy regulations (e.g. GDPR, CCPA).
Non-compliance: the entire prompt does not take into account data minimization principles and contains unnecessary details.
You are asked to analyze the following desensitized customer feedback data, identify the main issues, and provide recommendations for improvement based on this information:
1. customer 001: feedback: poor product quality.
2. customer 002: feedback: delivery time is too long.
Description:
Desensitization: Replace the customer's personal information with an anonymous ID (e.g. "Customer 001", "Customer 002").
Data Minimization: Keep only task-related feedback content and remove unnecessary personal information.
8. Constraints
Constraints are specific limitations or requirements imposed on the content of a prompt. Setting reasonable constraints is a key step in prompt design, which helps to improve the quality, relevance and applicability of the generated content. By restricting different types of constraints, such as content, format, style, etc., the AI model can be made to generate results that are more in line with the requirements, thus realizing the best results in multiple application scenarios.
Types of constraints
1. Content constraints
-
Definition: Content constraints are specific requirements on the topics, information points or viewpoints of the generated content to ensure that the output content centers around a specific topic.
-
Example: Write an article about the effects of climate change that must include at least three coping strategies.
-
Description: By specifying topics and points of information, it is possible to ensure that the generated content focuses and explores a specific issue in depth.
2. Formatting Constraints
-
Definition: Formatting constraints are requirements on the structure or layout of the output to ensure that the generated content conforms to the expected layout and organization.
-
Example: Generate a technical report with an introduction, body, and conclusion structure.
-
Description: This constraint is particularly useful for documents or reports, so that the generated content is easy to read and segment.
3. Style constraints
-
Definition: Style constraints are requirements for the writing style or tone of the generated content to ensure that the output meets the intended cultural and emotional context.
-
Example: Writing product descriptions with humor and a light tone.
-
Description: Applicable to advertising copy, blog posts, and other scenarios that require a specific style of expression to make the content more attractive.
4. Length Constraints
-
Definition: The length constraint is a requirement on the number of words, paragraphs, or characters in the generated content to ensure that the output content is within a predetermined length range.
-
Example: Write a newsletter of no more than 300 words.
-
Description: This constraint is commonly used for news reports, tweets, or marketing materials that need to convey information in a clear and concise manner.
5. Technical Constraints
-
Definition: A technical constraint is a requirement to use specific terminology or technical language in the generated content to ensure that the output is accurate in the area of expertise.
-
Example: The use of specific programming terminology in generated software descriptions.
-
Description: Applies to technical documentation or professional papers to ensure that the content is accurate and professional.
6. Time Constraints
-
Definition: A temporal constraint is a requirement that the generated content relates to a specific point in time or historical event, ensuring that the output is relevant to a specific time context.
-
Example: Describe the impact of the Industrial Revolution on the British economy in the 19th century.
-
Description: Applicable to historical research, time series analysis, and other scenarios to ensure that the content accurately reflects a specific historical period.
7. Target Audience Constraints
-
Definition: Target Audience Constraints is to set specific requirements for the audience of the generated content to ensure that the output content is suitable for the intended reading or usage group.
-
Example: Write an introduction to the fundamentals of calculus suitable for high school students.
-
Description: This constraint ensures that the complexity and presentation of the content is adapted to the comprehension of the target audience.
8. Contextual Constraints
-
Definition: Contextual constraints are requirements on the context or scene of the generated content to ensure that the output content matches the intended context or scene.
-
Example: Generating a CEO speech in the context of a business conference.
-
Description: Such constraints help generate content that is applicable to a specific context, making it more useful in application scenarios.
Most common example
constraints can be added when you require PROMPT to return content in a fixed format, for example, but PROMPT returns other information:
Only specific data or information is generated, and no other irrelevant content is included.
Some more examples
Type: Composite Constraint
Content constraint: Describes machine learning related content.
Format constraint: Include an introduction, methods, results, and conclusions.
Style constraint: Use a formal and professional tone.
Length constraint: The word count should not exceed 5000 words.
Type: Content constraints, length constraints
Content constraints: Definition of IoT and five practical applications.
Length constraint: no more than 200 words.
VI. Give a big example
#### Assignment Description
Write an article on the impact of climate change on global agricultural production.
Write an 800-word essay discussing in detail the impacts of climate change on global agricultural production, with particular emphasis on the impacts on water management and crop yields.
#### Background Information
In recent years, global climate change has had significant impacts on agricultural production. For example, irregular precipitation patterns and extreme weather events are complicating water resource management and affecting crop yields.
#### Role Description
Researcher
#### Task Objectives
To analyze the impacts of climate change on global agricultural production, with a particular focus on water resource management and crop yields.
#### Specific requirements and conditions
The article must include a specific discussion on water resource management and crop yields and should not exceed 200 words.
#### Target Audience
Agricultural scientists and policy makers
#### Metrics
- Accuracy: The content of the article must be a true reflection of the impacts of climate change on agricultural production.
- Completeness: Specific details on water management and crop yields need to be included.
- Fluency: the article is grammatically correct and well-spoken.
- Relevance: the content follows the theme of climate change impacts on agricultural production.
#### Step-by-step guide
1. describe the overall impact of climate change on global agricultural production.
2. discuss in detail the impacts of climate change on water resource management.
3. discuss in detail the impacts of climate change on crop yields.
#### Hierarchical Information
- Introduction: Introduces climate change and its overall impact on agricultural production.
- Water management: Discuss in detail how climate change will affect access to and management of water resources.
- Crop Yield: A detailed discussion of how climate change will affect crop growth and yield.
#### Consider multiple possibilities and boundary conditions
Example 1:
Input: North America: water scarcity, changing crop types.
Output: North America is experiencing severe water shortages that are affecting some traditional crops. Improved crop varieties and new irrigation techniques are the response.
Example 2:
Input: Africa: Changing precipitation patterns affecting crop cultivation.
Output: Irregular rainfall patterns in Africa have a major impact on small farmers. Crop yields fluctuate, affecting food security. International assistance and new technical support are needed.
#### Automatic Detection and Correction
Set up a mechanism to prompt re-entry of relevant information if water management and crop yields are not described as required.
Example:
Input: No mention of water management.
Output: "Please include a discussion of water management."
#### Linguistic and Cultural Sensitivity
Ensure that the content is friendly to readers from all cultural backgrounds and avoid using technical terms that interfere with understanding.
Example:
- Marketing articles: Use plain language and avoid technical jargon.
#### Data privacy and security
Example:
Input: Customer feedback content, customer IDs are desensitized.
#### Task Constraints
- Content constraints: Describe coping strategies for climate change impacts on agricultural production.
- Format constraints: Include an introduction, body and conclusion.
- Style constraint: Use a formal tone.
- Length constraint: no more than 800 words.
Summary
In today's world of large-scale language modeling (LLM), Prompts are the guiding tools that make AI obedient and smart. This in-depth article guides you through the art of designing powerful Prompts that unlock the full potential of AI and drastically reduce AI's "hallucination" problem - the generation of content that doesn't correspond to reality or is inexplicable.
Recap: The main problem addressed in this article
Haha, did you get it? If you've encountered the following problems before, this article is definitely a lifesaver:
-
Prompt ambiguity: AI-generated content is always off-kilter, making people crazy.
-
Insufficient details: AI is not clear about your needs and is full of nonsense.
-
Complexity: The AI is tired of reading your instructions and is "out of breath".
-
Illusion problem: The AI will come up with puzzling content from time to time, which will make you cry.
Review: How to do it, and have a great time!
-
Clear goals and tasks: Let the AI know what you want, and choose the right direction.
-
Adequate context and background: enough information, no more and no less, AI has the facts and not the mumbo jumbo.
-
Setting metrics or assessment dimensions: expect results, the AI is like a perfect score on your homework.
-
Simplicity and directness: less verbosity, AI understands in seconds.
-
Avoid ambiguity: Don't mess with the AI by using words you don't understand.
-
Step-by-step and hierarchical guidance: prioritize and win step-by-step.
-
Considering multiple possibilities and boundary conditions, extreme cases keep the AI awake at all times.
-
Corrective mechanisms: one-click corrections to prevent mistakes.
-
Language and cultural sensitivity: cross-cultural communication, AI falls in line.
-
Data privacy and security: Compliance and privacy, safe delivery.
-
Constraint setting: targeting, precise output.
Ready? With these Prompt design tricks, have a smooth conversation with AI, turn illusions into the past tense, generate efficiently, and enjoy your work!