Prompt engineering: Quick Guide With Examples
Prompt engineering is a technique used to improve the performance and control of language models like GPT-3.5.
There are several types of prompt engineering strategies:
Closed Prompt (Question): Ask for specific information or calculations.
Example: "What is the capital of France?"
Open Prompt (Creative Request): Encourage free-form creative responses.
Example: "Write a short story about a haunted house."
Multi-turn Prompt (Dialog): Engage in a conversation or interaction with the model.
Example:
User: "Tell me a joke."
Model: "Why did the chicken cross the road?"
Conditional Prompt (Task with Constraints): Specify conditions for the response.
Example: "Write a poem about autumn using 10 lines."
Comparison Prompt (Compare and Contrast): Analyze similarities and differences.
Example: "Compare and contrast dogs and cats as pets."
Instructive Prompt (Step-by-Step): Provide instructions or guidance for a process.
Example: "Provide a step-by-step guide on how to tie a bowtie."
Prompt Variation: Experiment with wording while requesting the same information or action.
Example variations: "Tell me a joke," "Could you tell me a joke, please," "Share a joke with me."
Human Feedback Loop: Interact with the model iteratively, refining responses based on feedback.
Example: User provides feedback on a model-generated response to improve subsequent responses.
Regularization Techniques: Adjust parameters to control response randomness and length.
Example: Setting "temperature" to influence response creativity or "max tokens" for response length.
Domain-Specific Prompt (Specialized Content): Specify a domain or context for the response.
Example: "Write a research summary on quantum computing."
50 example of Prompt engineering
- Closed Prompt: "What is the capital of France?"
- Closed Prompt: "Calculate 25 multiplied by 4."
- Closed Prompt: "Define 'Photosynthesis'."
- Open Prompt: "Write a short story about a haunted house."
- Open Prompt: "Describe your favorite childhood memory."
- Open Prompt: "Explain the concept of artificial intelligence."
- Multi-turn Prompt:
- User: "Tell me a joke." Model: "Why did the chicken cross the road?" User: "I don't know. Why?" Model: "To get to the other side!"
- Multi-turn Prompt:
- User: "Can you recommend a good book to read?" Model: "What genre are you interested in?" User: "I enjoy science fiction." Model: "In that case, I recommend 'Dune' by Frank Herbert."
- Conditional Prompt: "Write a poem about autumn using 10 lines."
- Conditional Prompt: "Translate the following Spanish sentence into English: 'Hola, ¿cómo estás?'"
- Conditional Prompt: "Compose a letter of resignation for a job you never had."
- Comparison Prompt: "Compare and contrast dogs and cats as pets."
- Comparison Prompt: "Discuss the similarities and differences between classical music and rock music."
- Comparison Prompt: "Analyze the advantages and disadvantages of electric cars and hybrid cars."
- Instructive Prompt: "Provide a step-by-step guide on how to tie a bowtie."
- Instructive Prompt: "Explain the process of photosynthesis in plants."
- Instructive Prompt: "Create a recipe for a vegetarian lasagna."
- Prompt Variation: "Tell me a joke."
- Prompt Variation: "Could you tell me a joke, please?"
- Prompt Variation: "Share a joke with me."
- Human Feedback Loop: User provides feedback on a model-generated response to improve subsequent responses.
- Human Feedback Loop: User rates the model's response and asks for revisions if necessary.
- Regularization Technique: Adjusting the "temperature" parameter to control response randomness.
- Regularization Technique: Setting a maximum limit on the number of tokens in the response using "max tokens."
- Domain-Specific Prompt: "Write a research summary on quantum computing."
- Domain-Specific Prompt: "Compose a technical report on climate change mitigation strategies."
- Domain-Specific Prompt: "Generate marketing copy for a new smartphone."
- Emotional Prompt: "Write a love letter to someone you deeply care about."
- Emotional Prompt: "Describe the feeling of utter happiness."
- Emotional Prompt: "Write a letter expressing condolences for a loss."
- Persuasive Prompt: "Write an essay arguing for the importance of renewable energy sources."
- Persuasive Prompt: "Convince the reader to adopt a healthy lifestyle."
- Persuasive Prompt: "Make a case for the benefits of space exploration."
- Storytelling Prompt: "Create a character profile for a fearless adventurer."
- Storytelling Prompt: "Write the opening paragraph of a science fiction novel."
- Storytelling Prompt: "Describe a mysterious artifact found in an ancient tomb."
- Socratic Prompt: "Explain the Socratic method and its role in philosophical inquiry."
- Socratic Prompt: "Discuss the ethics of artificial intelligence in healthcare."
- Socratic Prompt: "Explore the concept of justice in Plato's 'Republic.'"
- Data Interpretation Prompt: "Analyze the following dataset of stock prices and predict future trends."
- Data Interpretation Prompt: "Interpret a graph showing the correlation between temperature and ice cream sales."
- Data Interpretation Prompt: "Examine a chart of population growth in urban areas and identify key patterns."
- Opinion Prompt: "Share your opinion on the impact of social media on society."
- Opinion Prompt: "Express your thoughts on the importance of preserving biodiversity."
- Opinion Prompt: "Discuss your views on the role of government in healthcare."
- Imaginative Prompt: "Imagine you are a time traveler from the future. Describe your first encounter with the past."
- Imaginative Prompt: "If you could have any superpower, what would it be, and how would you use it?"
- Imaginative Prompt: "Describe a world where humans have colonized Mars."
- Ethical Prompt: "Discuss the ethical dilemmas of genetic engineering in humans."
- Ethical Prompt: "Explore the moral implications of autonomous weapon systems."