Understanding Prompting
A Guide to Crafting Effective AI Prompts
Understanding Prompting
A Guide to Crafting Effective AI Prompts
Prompting is the most desirable skill of 2023, with the rise of companion applications based on LLM models despite any role we play in a team. Understanding the basics of Prompting will help us craft better prompts that could yield more accurate and helpful responses and get the information we need quickly and efficiently.

Prompting is a new discipline of designing optimal prompts to instruct the model to perform a task effectively using language models.
Elements of a Prompt,
- Instruction — a specific task you want the model to perform. e.g., “Write,” “Classify,” “Summarize,” “Translate,” “Order,” etc
- Separator — To separate instruction and context, we can use ### or “””
- Context — additional information that can steer the model to better responses.
- Input Data — Question that you are interested in finding a response for
- Output Indicator — Indicates the type or format of the output
Standard Promt formats
<Question>?
"What are the main causes of climate change?"
<Instruction>
"Describe the process of cellular respiration in simple terms."
- Q:
<Question>?
A:
"Q: What is the primary function of the mitochondria in a cell?
A:"
Designing a Prompt
Best Practices
1. Be specific and direct: Provide clear, concise instructions to help the model understand your intended goal. Avoid being too vague or ambiguous.
"Write a 300-word essay on the health benefits of a Mediterranean diet."
2. Set context: Include relevant background information to guide the model’s response if necessary. This can help ensure the generated text is relevant and well-informed.
"In the context of the COVID-19 pandemic, discuss the challenges faced by small businesses and provide three solutions to help them adapt."
3. Use appropriate keywords: Including relevant keywords or phrases can help guide the model’s focus and ensure it generates content related to your topic.
"Describe the process of photosynthesis in plants, including key terms such as chlorophyll, sunlight, and carbon dioxide."
4. Define output format: Clearly state the desired response format, such as a list, essay, or bullet points. This can help the model structure its output accordingly.
"List five environmental advantages of electric cars in bullet points."
5. Limit the response length: If you want a short answer, specify the desired response length by word count or the number of sentences.
"In three sentences, explain the main differences between renewable and non-renewable energy sources."
6. Break down the compiled tasks into small steps: For complex tasks, asking the model to provide a step-by-step process or a list of pros and cons can help produce more organized and insightful responses.
"Describe the characteristics of an ideal location for a small vegetable garden in your backyard, considering factors like sunlight, soil, and drainage."
"List six easy-to-grow vegetables suitable for a small backyard garden and explain why they are good choices for beginners."
"Explain the process of preparing the soil for a small vegetable garden, including the steps for testing and amending the soil."
7. Include examples: Provide examples of the desired output if the request is complex or requires a specific format. This can help the model better understand your expectations.
"Write a haiku about spring, similar to this example: 'Cherry blossoms bloom / Soft whispers on the breeze / Spring's sweet arrival.'"
8. Experiment and Iterate: Experiment with phrasings, keywords, or additional context to improve the results.
"Explain the concept of gravity for a preschooler, a middle school student, and an adult, adjusting the language and complexity for each audience."
"Explain the concept of gravity using an analogy or metaphor that would help someone with no background in science understand the idea."
9. Separate instruction and context: Put instructions at the beginning of the prompt and use ### or “”” to separate the instruction and context.
"###Analyze the impact of climate change on polar bears.###
Polar bears are found primarily in the Arctic region and are known for their white fur and hunting abilities on sea ice."
10. Say what to do instead of what not to do: Avoid instructing the model what not to do; it might lose the specificity and focus of the task.
"Write a positive review of a fictional restaurant focusing on the atmosphere, food quality, and service."
Tasks types:
1. Text Summarization
"Summarize the main points of the article 'The Impact of Artificial Intelligence on Society' in 100-150 words."
2. Information Extraction
"Extract the key information from the following job listing, including the job title, company name, location, responsibilities, and requirements."
3. Question Answering
"What is the significance of the Turing Test in the field of artificial intelligence, and why is it important for determining machine intelligence?"
4. Text Classification
"Classify the following text as either a news article, opinion piece, or advertisement: 'In recent years, the adoption of electric vehicles has skyrocketed...'"
5. Conversation
"Write a conversation between a customer and a sales representative at an electronics store, discussing the features and benefits of a new smartphone."
6. Code Generation
"Generate a Python function that takes two numbers as input and returns their sum. The function should be named 'add_numbers' and have parameters 'num1' and 'num2'."
7. Reasoning
"Evaluate the strengths and weaknesses of using solar power as a primary energy source for residential homes, considering factors such as cost, efficiency, and environmental impact."
Different types of Prompting
1. Zero-shot Prompting: Providing a single prompt without examples or prior knowledge for the model to generate a response based on its existing training.
Prompt: "Translate the following English sentence to French: 'The weather is beautiful today.'"
(Note: The model is not given any translation examples and is expected to generate a response based on its existing knowledge.)
2. Few-shot Prompting: Provide a few examples or instances along with the prompt to help the model better understand the context and desired output.
Prompt: "Given the following English to French translations:
'Hello' -> 'Bonjour'
'Goodbye' -> 'Au revoir'
Translate the following English sentence to French: 'Thank you very much.'"
3. Chain-of-Thought Prompting: Breaking down a complex task into smaller, more manageable steps or prompts, and then combining the results to form a complete response.
Prompt 1: "List three factors that contribute to climate change."
Prompt 2: "Explain how each of the factors listed in the previous response contributes to climate change."
4. Self-Consistency: Ensuring the model’s generated response is logically consistent and coherent by guiding it to consider its generated content when answering subsequent parts of a prompt.
Prompt: "What is the capital of France? Ensure your response is consistent with any previously provided information."
5. Generate Knowledge Prompting: Encouraging the model to generate new knowledge or insights based on its understanding of existing information and concepts.
Prompt: "Based on the current trends in renewable energy technology, predict potential breakthroughs in the next 10 years."
6. Automatic Prompt Engineer: A technique that automatically generates or refines prompts to optimize the performance and effectiveness of the language model.
7. Active-Prompt: A method that actively adapts the prompt during the generation process, allowing for more controlled and tailored outputs based on the model’s ongoing responses.
8. Directional Stimulus Prompting: Using specific cues or instructions in the prompt to guide the model toward generating content in a certain direction or style.
Prompt: "Write a brief, persuasive paragraph on the importance of recycling, using a conversational tone and everyday language."
9. ReAct (Reinforcement Learning with Action-conditional Text): A technique that combines reinforcement learning with action-conditional text prompts to improve the model’s performance on a specific task.
10. Multimodal CoT (Chain-of-Thought): An extension of Chain-of-Thought Prompting that integrates multiple modalities (e.g., text, images, audio) to generate more comprehensive and contextually relevant responses.
Prompt 1: "Describe the image below." (Include an image of a landscape)
Prompt 2: "Explain the role of the elements in the image in contributing to the overall visual appeal."
11. Graph Prompting: A technique that uses graph-based structures to represent and organize information in the prompt, helping the model understand complex relationships and dependencies between concepts more effectively.
Prompt: "Analyze the relationships between the following characters in a graph: Harry Potter, Hermione Granger, Ron Weasley, and Draco Malfoy. Describe the nature of their friendships or rivalries and how they evolve throughout the series."