🥽 Basic Prompt
💥 Based on the complexity and characteristics of the task, you can select a few components from them to form your prompt.
Application of the framework and principles
Subsequently, we started with a basic prompt that only contains the context and instructions, gradually enriching the structural framework of our prompts. In this way, we visualize the role played by the five key components of the prompt framework and the output of the large language model in different situations.
Basic prompting
To begin with, we use a prompt only containing the context and instructions as the base example. Define the model's role as a history teacher (Context) and ask to write a multiple-choice question for a history course (instructions).
👁️ [Prompt example]:
Context: Suppose you are a history teacher with more than 30 years of teaching experience.
Instructions: Write a multiple-choice question for a history course.
Output:
Question:
During which period did the Industrial Revolution take place?
A) Ancient Greece
B) Renaissance
C) Victorian Era
D) Enlightenment
Answer:C) Victorian Era
Explanation:
The Industrial Revolution refers to a significant shift in manufacturing and economic
practices that occurred primarily in the late 18th and early 19th centuries.
It was a period of rapid industrialization and technological advancements, leading to the
mechanization of production processes and the emergence of factories. This period
witnessed the development of steam power, the expansion of railways, and the mass
production of goods. The Victorian Era, named after Queen Victoria of England, spanned
from 1837 to 1901, and it coincided with the height of the Industrial Revolution.
It was during this time that the impacts of industrialization were most prominent,
transforming societies and economies across Europe and the United States.
Based on the content of such basic prompts, the large language model outputs the corresponding results. However, with such "free" prompting instructions, the form, format, and content of the questions in the results generated by the large language model are unstable .
Addition of Relevance
Based on the basic prompt, we added the relevance message "the question should be related to the Renaissance" to specify the relevant knowledge points for the output generated by the model.
👁️ [Prompt example]:
Context: Suppose you are a history teacher with more than 30 years of teaching experience.
Instructions: Write a multiple-choice question for a history course.
Relevance: The question should be related to the Renaissance
Output:
Question:
Which influential artist is often regarded as the epitome of the Renaissance?
A) Leonardo da Vinci B) Michelangelo C) Vincent van Gogh D) Pablo Picasso
Answer: A) Leonardo da Vinci
Explanation:
Leonardo da Vinci is widely regarded as the epitome of the Renaissance, a period in European history characterized by a renewed interest in classical art, literature, and learning. Da Vinci, born in 1452 in Italy, was a polymath who excelled in various fields such as painting, sculpture, anatomy, engineering, and architecture. His masterpieces, such as the Mona Lisa and The Last Supper, exemplify the artistic achievements of the Renaissance. Da Vinci's attention to detail, scientific approach, and mastery of techniques set new standards for artists of his time and subsequent generations. His work not only demonstrated exceptional artistic skill but also reflected the spirit of humanism and curiosity that defined the Renaissance period.
In this case, the stability of the content involved in the output results of the model is guaranteed.
Clarify constraints
Adding a constraint to the prompt makes it clear what rules or restrictions the model should follow. In our next example, we add the constraint "There should be more than two correct answers among the four options".
👁️ [Prompt example]:
Context: Suppose you are a history teacher with more than 30 years of teaching experience.
Instructions: Write a multiple-choice question for a history course.
Relevance: The question should be related to the Renaissance.
Constraint: There should be more than two correct answers among the four options.
Output:
Question:
Which artistic techniques were commonly employed by Renaissance painters? (Select all that apply.)
A) Linear perspective B) Chiaroscuro C) Pointillism D) Sfumato
Answer:A) Linear perspective B) Chiaroscuro D) Sfumato
Explanation:
During the Renaissance, artists employed various techniques to achieve realistic and visually captivating artworks. Three of the options provided were commonly used during this period.
A) Linear perspective: Renaissance painters embraced the use of linear perspective to create depth and dimension in their compositions. By employing this technique, artists could accurately depict the illusion of distance and create the impression of three-dimensional space on a two-dimensional surface.
B) Chiaroscuro: Chiaroscuro, meaning "light-dark" in Italian, is a technique that involves the strong contrast between light and shadow. Renaissance painters used this technique to model forms, create a sense of volume, and evoke a dramatic effect in their paintings.
D) Sfumato: Sfumato is a technique characterized by the subtle blending of colors and tones to create soft, hazy transitions. It is particularly associated with the works of Leonardo da Vinci. Sfumato was employed to give a sense of atmospheric perspective and to achieve a smooth and realistic appearance, especially in portrayals of human faces.
C) Pointillism: Pointillism, a technique developed in the late 19th century, is not directly associated with the Renaissance. It involves the use of small, distinct dots of pure color that, when viewed from a distance, blend together to create a cohesive image. This technique was utilized by post-Impressionist painters such as Georges Seurat and Paul Signac.
Thus, options A, B, and D are the correct answers as they represent the artistic techniques commonly employed by Renaissance painters.
On the premise of stabilizing the output content ( the addition of Relevance ), the format of the questions is further specified as multiple choice questions, and the final output format is limited.
List of Demonstration
Based on the framework of the above four key components, we can further include demonstration for reference to clarify for the model the specific details of the output results and the output format that cannot be easily described in natural language.
👁️ [Prompt example]:
Context: Suppose you are a history teacher with more than 30 years of teaching experience.
Instructions: Write a multiple-choice question for a history course.
Relevance: The question should be related to the Renaissance.
Constraint: There should be more than two correct answers among the four options.
Demonstration:
Question: During the Renaissance, which of the following cities was a cultural center?
(A) London (B) Paris (C) Florence (D) Amsterdam
The correct answer is: A and C.
Answer Explanation:During the Renaissance, Florence was one of the most important cultural centers in Europe, where many important artists, scholars and thinkers worked and lived, including Leonardo da Vinci, Michelangelo and Dante. London also rose rapidly during the Renaissance to become a cultural and commercial center of Europe, attracting many cultural celebrities and merchants. Therefore, options A and C are the correct answers.
Output:
Question:
During the Renaissance, which of the following cities were renowned cultural centers? (Select all that apply.)
A) Rome B) Paris C) Florence D) Venice
The correct answer is: A, C, and D.
Answer Explanation:
During the Renaissance, several cities emerged as vibrant cultural centers, fostering artistic, intellectual, and scholarly advancements. The options provided represent significant cities during this period.
A) Rome: Rome, with its rich history as the center of the Roman Empire and the Catholic Church, continued to be a hub of artistic and intellectual activity during the Renaissance. It attracted artists, architects, and scholars who were inspired by the classical ruins and the patronage of the Church.
C) Florence: Florence, located in Italy, was one of the most important cultural centers during the Renaissance. It was renowned for its patronage of the arts by wealthy families such as the Medici. Many influential artists, scholars, and thinkers, including Leonardo da Vinci, Michelangelo, and Dante, lived and worked in Florence.
D) Venice: Venice, known for its unique location as a major port and hub of trade in the Mediterranean, played a significant role in the Renaissance. The city's prosperity and cosmopolitan atmosphere attracted artists, merchants, and intellectuals from diverse backgrounds, fostering a vibrant cultural scene.
B) Paris: While Paris would go on to become a cultural center in subsequent centuries, it did not reach its Renaissance cultural prominence until a later period. The Renaissance primarily thrived in Italy, and Paris rose to prominence as a cultural hub during later periods, such as the Enlightenment.
Therefore, options A, C, and D are the correct answers as they represent cities that were renowned cultural centers during the Renaissance.
As we can see, the large language model will follow the format of the given demonstration strictly and output the final result we need.
Sometimes, we can make the large language model understand the task instructions we want to give simply by enumerating multiple examples (or even a single example).
👁️ [Prompt example]:
Gu Ailing won the first crown of the New Year of the Rabbit. Scoring break advantage.
---- sports
Data released by the National Health Insurance Bureau showed that from January to March 2023, the total income of the basic medical insurance fund (including maternity insurance) was 910.48 billion yuan, an increase of 9.5% year-on-year.
---- medical
Berkshire Hathaway reduced its stake in BYD shares from 10.05% to 9.87%. The HKEx Disclosure Ease requires disclosure when a major shareholder increases or decreases its shareholding only if it crosses a certain round number percentage.
---- Finance
Edge computing products have served customers in industries such as online education, video, gaming, and connected cars.
----
Output:
Technology
Prompt Techniques
Basic prompting
Prompt-based approaches offer a powerful and flexible tool for resolving a wide range of NLP tasks. We can complete the task by expressing ourselves in natural language, so there's no need to adhere to a specific format.
Sentiment Analysis: LLMs can be trained to identify the sentiment expressed in a piece of text, such as positive, negative, or neutral. This can be useful for analyzing customer feedback, social media posts, and product reviews.
👁️ [Prompt example]:
Analyze the sentiment of the following text:
Text: 'I absolutely loved the movie! The acting was fantastic and the plot kept me engaged throughout the entire film.'
Output:
Sentiment: Positive
The sentiment of the provided text is clearly positive. The use of words like "absolutely loved," "fantastic," and "engaged" indicates a strong positive sentiment towards the movie. The person expressing their opinion seems to have thoroughly enjoyed the film, praising both the acting and the plot. Overall, the sentiment conveyed in the text is highly positive.
Entity Recognition: LLMs can identify entities in a text, such as people, places, organizations, and products. This can be used for named entity recognition in various domains, such as news articles or legal documents.
👁️ [Prompt example]:
Analyze the following paragraph and identify all the people, places, and organizations mentioned in the text, and then output the results in json format. ```
Text: 'The Apple event took place at the Steve Jobs Theater in Cupertino, California. Tim Cook, the CEO of Apple, introduced the new iPhone 13, which will be available for pre-order starting next week. The phone comes in several colors and features a faster processor and longer battery life.'
Output:
{"people": ["Tim Cook"],"places": ["Steve Jobs Theater","Cupertino, California"],"organizations": ["Apple"]}
Relation Extraction: LLMs can also extract relationships between entities in a piece of text, such as identifying that a person is the CEO of a company or that a product is made by a certain brand. This can be useful for tasks such as knowledge graph construction, where the relationships between entities are important for understanding the domain.
👁️ [Prompt example]:
Analyze the following sentence and extract the relationship between two entities, and then output the results in JSON format.```
Text: 'Elon Musk founded SpaceX in 2002 with the goal of reducing space transportation costs and enabling the colonization of Mars.'```
Output:
{
"entity1": "Elon Musk",
"entity2": "SpaceX",
"relationship": "founded"
}
Text Summarization: LLMs can also be used for text summarization, where they can automatically generate a summary of a longer piece of text, such as an article or report. This can be useful for quickly understanding the key points of a document without having to read the entire thing.
👁️ [Prompt example]:
Summarize the following paragraph:
Do we know where the kite in our heart really is? We will not get it again if we miss it in life, maybe we will repent and redeem ourselves, but all these seem to be too late. Whenever the kite is released in the sky, shouldn't we ask ourselves whether we really treasure what we have.
Each of us has done something in our youth that we will be ashamed of in the future. These things may be like a shadow that accompanies you for the rest of your life, so that you can only look down at it. But time will not turn around, their best efforts to make up for it, how is not a kind of self-help? The beauty and friendship of childhood, because of a cowardly negligence and ruined, if you are given another chance, you are willing to go out of your way to regain that former self?
But people are like that, always live within a certain time limit, where the world may be a few years later even they can not understand, but this is what we can not break through. For you, a thousand times, all over the body will still be righteous, maybe this is life, life is not just doing things worthwhile!
Output:
The paragraph reflects on the importance of appreciating and cherishing the valuable things in life. It highlights the idea that once an opportunity or something meaningful is missed, it may be difficult to regain it. The author suggests that individuals often carry regrets and shame from past actions, which can overshadow their lives. They express the notion that time cannot be reversed, but making efforts to make up for past mistakes is a form of self-help. The paragraph also mentions the loss of childhood innocence and friendships due to neglect, and poses the question of whether one would go to great lengths to regain their former self if given the chance. It concludes by acknowledging the limitations of human existence within the constraints of time, emphasizing the importance of righteousness and suggesting that life is not solely about accomplishing worthwhile tasks.
Text Clustering: LLMs can group similar texts together based on their content or features. This feature can be useful in tasks such as data mining, topic modeling, and customer segmentation.
👁️ [Prompt example]:
Cluster the following set of news articles into distinct groups based on their content:```
"Tesla's electric car sales continue to soar despite the pandemic"```
"New study suggests coffee consumption may lower risk of heart disease"```
"The latest iPhone model features a larger screen and improved camera"```
"COVID-19 cases surge in India, overwhelming healthcare system" ```
"Amazon announces plans to build a new fulfillment center in Texas"```
"Scientists discover new species of bird in the Amazon rainforest"```
"Global climate change conference to be held in Paris next month"```
"Starbucks introduces plant-based milk options in all U.S. stores"```
Output:
Based on their content, the news articles can be clustered into the following groups:
1. Electric Vehicles and Technology:
"Tesla's electric car sales continue to soar despite the pandemic"
"The latest iPhone model features a larger screen and improved camera"
2. Health and Well-being:
"New study suggests coffee consumption may lower risk of heart disease"
"Starbucks introduces plant-based milk options in all U.S. stores"
3. COVID-19 and Healthcare:
"COVID-19 cases surge in India, overwhelming healthcare system"
4. Environment and Wildlife:
"Scientists discover new species of bird in the Amazon rainforest"
"Global climate change conference to be held in Paris next month"
5. Business and Economy:
"Amazon announces plans to build a new fulfillment center in Texas"
These clusters group the articles based on their shared themes, such as electric vehicles/technology, health and well-being, COVID-19/healthcare, environment/wildlife, and business/economy.
Machine Translation: LLMs can be used for machine translation, where they can translate text from one language to another. This can be useful for businesses that operate globally, as well as for individuals who need to communicate with people who speak different languages.
👁️ [Prompt example]
Translate the following paragraph into Chinese.
Tales from Shakespeare is an English children's book written by Charles Lamb and his sister Mary Lamb in 1807. The book is designed to make the stories of Shakespeare's plays familiar to the young. However, as noted in the author's Preface, "[Shakespeare's] words are used whenever it seemed possible to bring them in; and in whatever has been added to give them the regular。
Output:
《莎士比亚故事集》是一本英文儿童读物,由查尔斯·兰姆和他的姐姐玛丽·兰姆于1807年写成。这本书旨在使莎士比亚的剧作故事对年轻人更加熟悉。然而,正如作者的前言中所指出的那样,"莎士比亚的话语在任何可能引入的地方都被使用了;而且在添加的任何内容中都会使它们变得更加规范。
Question Answering: LLMs can be used for question answering, where they can read a passage of text and answer questions about it. This can be useful for applications such as customer support, where customers can ask questions and receive quick, accurate answers.
👁️ [Prompt example]:
The Great Barrier Reef is the world's largest coral reef system, composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometers. It is located in the Coral Sea, off the coast of Australia. The reef is home to a diverse range of marine life, including over 1,500 species of fish, 600 types of coral, and numerous other species.
Question:What is the Great Barrier Reef and where is it located?
Output:
The Great Barrier Reef is indeed the world's largest coral reef system. It is composed of over 2,900 individual reefs and 900 islands, extending for more than 2,300 kilometers (1,400 miles). The reef is situated in the Coral Sea, off the northeastern coast of Australia. It stretches parallel to the coast of Queensland, running from the northern tip of Cape York Peninsula in the north to Bundaberg in the south. The Great Barrier Reef is a UNESCO World Heritage site and is widely regarded as one of the world's most remarkable natural wonders due to its immense size and ecological significance.
In order to take full advantage of LLM's powerful generation capabilities, we can look at more aspects or domains of generation tasks in addition to natural language tasks.If you want to learn more about prompt content, please click here .