- Blog
- Examples and Key Concepts of Prompt Usage
Examples and Key Concepts of Prompt Usage
Examples and Key Concepts of Prompt Usage
Text Summarization
One of the standard tasks in natural language generation is text summarization, which can involve different styles and domains. In fact, one of the most promising applications of language models is their ability to quickly summarize articles and concepts into easy-to-understand overviews.
Prompt
Plaintext
Explain antibiotics A:
Output
Plaintext
Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body’s immune system to fight off the infection. Antibiotics are usually taken orally... They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.
To refine the summary, you can optimize the prompt:Prompt
Plaintext
[Long paragraph content] Explain the above in one sentence: // Explain the above in one sentence:
Output
Plaintext
Antibiotics are medications used to treat bacterial infections by either killing the bacteria or stopping them from reproducing, but they are not effective against viruses and overuse can lead to antibiotic resistance.
Information Extraction
Language models can perform not only natural language generation but also text classification and other NLP tasks.Prompt
Plaintext
[Paragraph content: Mentions the use of AI technologies in research papers...] Mention the large language model based product mentioned in the paragraph above: // Identify the large language model mentioned in the paragraph above:
Output
Plaintext
The large language model based product mentioned in the paragraph above is ChatGPT.
Question Answering
Structured prompts can improve the precision of model responses.Prompt
Plaintext
Answer the question based on the context below. Keep the answer short and concise. Respond "Unsure about answer" if not sure about the answer. // Answer the question based on the context below. If unsure, respond "Unsure about answer". Context: Teplizumab traces its roots to...making it the first therapeutic antibody allowed for human use. Question: What was OKT3 originally sourced from? Answer:
Output
Plaintext
Mice.
Text Classification
Instructing with examples can guide the model to output specified classification formats.Prompt (with example)
Plaintext
Classify the text into neutral, negative or positive. Text: I think the vacation is okay.Sentiment: neutral Text: I think the food was okay. Sentiment:
Output
Plaintext
neutral
Error example (spelling error causing deviation)Prompt
Plaintext
Classify the text into nutral, negative or positive. Text: I think the vacation is okay. Sentiment:
Output
Plaintext
Neutral
Dialogue
Define the model's behavior through role prompting (Role Prompting).Technical tone dialoguePrompt
Plaintext
The following is a conversation with an AI research assistant. The assistant tone is technical and scientific. // The following is a conversation with an AI research assistant. The tone should be professional and technical. Human: Hello, who are you? AI: Greeting! I am an AI research assistant. How can I help you today? Human: Can you tell me about the creation of blackholes? AI:
Output
Plaintext
Sure! Black holes are regions of spacetime where the gravitational force is so strong that nothing...forming a singularity of infinite density.
Simplified tone dialoguePrompt
Plaintext
The following is a conversation with an AI research assistant. The assistant answers should be easy to understand even by primary school students. // The following is a conversation with an AI research assistant. Answers should be easy to understand, even for primary school students. Human: Hello, who are you? AI: Greeting! I am an AI research assistant. How can I help you today? Human: Can you tell me about the creation of black holes? AI:
Output
Plaintext
Sure! Black holes are created when a very massive star runs out of fuel and collapses in on itself...called a black hole.
Code Generation
Large language models can generate code from natural language descriptions.Simple program examplePrompt
Plaintext
/* Ask for the user's name and say "Hello" */
Output
Plaintext
let name = prompt("What is your name?"); console.log(
Hello, ${name}!);
Database query examplePrompt
Plaintext
""" Table departments, columns = [DepartmentId, DepartmentName] Table students, columns = [DepartmentId, StudentId, StudentName] Create a MySQL query for all students in the Computer Science Department """
Output
Plaintext
SELECT StudentId, StudentName FROM students WHERE DepartmentId IN (SELECT DepartmentId FROM departments WHERE DepartmentName = 'Computer Science');
Reasoning
Reasoning tasks require step-by-step prompting for accuracy.Basic arithmetic examplePrompt
Plaintext
What is 9,000 * 9,000?
Output
Plaintext
81,000,000
Logical reasoning example (step-by-step prompt correction)Original prompt
Plaintext
The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. A:
Incorrect output
Plaintext
No, the odd numbers in this group add up to an odd number: 119.
Optimized prompt
Plaintext
The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1. Solve by breaking the problem into steps. First, identify the odd numbers, add them, and indicate whether the result is odd or even.
Correct output
Plaintext
Odd numbers: 15, 5, 13, 7, 1 Sum: 41 41 is an odd number.
Subsequent chapters will introduce advanced prompt engineering techniques for more complex tasks.