ChatGPT prompt writing guide 🧭
When building a prompt, there are several elements to consider:
Indicates the type of content GPT will generate
Principles to follow when generating content
The role that GPT needs to play, such as lawyer or customer service
points to emphasize
- Task: Generate a product description for a new smartphone
- Instructions: The description should be informative, persuasive and highlight the unique features of the smartphone
- Role: Marketing representative
- Seed-word: "innovative"
Prompts can be:
As a marketing representative, generate an informative, persuasive product description that highlights the innovative features of the new smartphone. The smartphone has the following features [insert your features]
- Task: Generate a product review for a new laptop
- Instructions: The review should be objective, informative and highlight the unique features of the laptop
- Role: Tech expert
- Seed-word: "powerful"
Prompts can be:
As a tech expert, generate an objective and informative product review that highlights the powerful features of the new laptop.
In the above example, the seed-word is followed by the highlight verb, and there are two ways to strengthen the seed-word:
- seed-word: [insert your keyword]
- Task: Generate a story about a dragon
- Seed-word: "Dragon"
Please generate text based on the following seed-word: Dragon
- Use quotes that is related to the seed word '[insert your keyword]'
- Task: Generate a poem
- Seed-word: "love"
- Instructions: The poem should be written in the style of a sonnet.
- Role: Poet
Generate a sonnet related to the seed word 'love' as a poet
Several prompt types
1. Zero, One and Few Shot Prompting
When we talked about langchain before, we used Few Shot Prompting
This actually provides various examples for GPT, telling GPT what we want:
- Task: Write a product description for a new smartwatch
1.1 Zero Shot Prompting
Generate a product description for this new smartwatch with zero examples
1.2 One Shot Prompting
Generate a product comparison of this new smartphone with one example [latest iPhone]
1.3 Few Shot Prompting
Generate a product comparison of this new smartphone with few examples [3 other smartphones]
2. Self-consistent tips
The model can be prompted to generate text consistent with the provided input, useful for tasks such as fact checking, data validation, or consistency checking in text generation.
Generate a product review that is consistent with the following product information [insert product information]
Complete the following sentence in a way that is consistent with the context provided [insert sentence] Please ensure the following text is self-consistent [insert your sentence]
With self-consistency hints, researchers can better assess the accuracy, consistency, and reliability of models and identify areas for improvement.
3. Counter prompts
Methods for testing and evaluating algorithm performance. Designed to challenge and reveal the limitations of algorithms by including incomprehensible, misleading, or targeted weaknesses in the input. GPTs tend to be more vulnerable to this type of attack due to their large training data size and complexity.
Generate text that is difficult to classify as [insert label]
Generate text that is difficult to classify as having the sentiment of [insert sentiment]
Generate text that is difficult to translate to [insert target language]
After typing this, you will find that GPT starts talking nonsense. By using adversarial hints, researchers can discover and improve the weaknesses of existing algorithms, thereby improving their performance and security.
Some other useful mantras:
- brainstorm ideas
Let's think about this: [insert your topic]
Let's discuss [insert your topic]
This can be GPT to give you some divergent ideas💡
- text generation
Generate a story of at least 1000 words, including characters [insert characters] and a plot [insert plot] based on the following prompt [insert prompt]
Complete the following text [insert text] and make sure that it is coherent and consistent with the input text.
Guide the model to generate input of a specific type of text 📒
- generate dialogue
Generate a professional and accurate dialogue for a customer service chatbot, when the customer asks about [insert topic]
Generate a conversation between the following characters [insert characters] in the following context [insert context]
This technique is useful for tasks such as dialogue generation, story writing, and chatbot development. 💬
Group the following news articles into clusters based on topic: [insert articles]
Group the following scientific papers into clusters based on research area: [insert papers]
You can have the model group similar data points together based on certain characteristics or characteristics. 🗂
- Sentiment Classification
Perform sentiment analysis on the following customer reviews [insert reviews] and classify them as positive, negative, or neutral.
Perform sentiment analysis on the following product reviews [insert reviews] and classify them as positive, negative, or neutral.
Allows the model to determine the emotional color or attitude of the text, such as whether it is positive, negative, or neutral. 😄
- Text Categorization
Perform text classification on the following customer reviews [insert reviews] and classify them into different categories such as electronics, clothing and furniture based on their content.
Perform text classification on the following emails [insert emails] and classify them into different categories such as spam, important, or urgent based on their content and sender.
Let the model classify text into different categories. It is different from sentiment analysis. Sentiment analysis is specifically concerned with determining the sentiment or mood expressed in text. This might include determining whether the text expresses positive, negative, or neutral sentiment. Sentiment analysis is often used for customer reviews, social media posts, and other text that needs to express emotion. ⭐️
- named entity recognition
Perform named entity recognition on the following news article [insert article] and identify and classify people, organizations, locations, and dates.
Perform named entity recognition on the following research paper [insert paper] and identify and classify people, organizations, locations, and dates.
Have the model recognize and classify named entities in text, such as names of people, organizations, places, dates, and more. 🗺️
The above is the structure, usage and some practical examples of various prompts. I hope everyone has to help. Later, you can try to use https://flowgpt.com/ This more complex tool to generate more advanced prompts.
Bibliography: The Art of Asking ChatGPT for High-Quality Answers: A Complete Guide to Prompt Engineering Techniques (Making Money with ChatGPT) Paperback – January 25, 2023