Skip to content

🐻 How to write effective prompts

Abstract

This section covers "how to write effective prompts" briefly.

🦜 Video lecture for this chapter - Link

Here are the 9 tips you can use to write prompts effectively for large language models.

  1. Be clear and specific - When the instruction is clear and specific, it reduces the risk of misinterpretation and ensures more accurate and relevant responses from the chatbot.
  2. Be concise - Make sure that your prompt is concise i.e., written in few words. The more concise your prompt, the better the chatbot will understand your prompt.
  3. Use action verbs - Start the instruction element in the prompt with an action verb that tells the chatbot what you want it to do,Β e.g.,Β "summarize the given text," "write a poem," or "generate a tweet."
  4. Provide sufficient context - Provide the relevant and sufficient background information in your prompt. This helps the chatbot to understand the broader context and generate more meaningful responses.
  5. Use delimiters - Delimiters separate different elements of the prompt and help the chatbot to better understand the prompt. The use of delimiters is more effective in the case of complex tasks.
  6. Specify Tone - Tone determines the style, formality, and overall emotion of the generated output. By specifying the desired tone, you guide the chatbot towards generating output that aligns with your desired style and emotional impact.
  7. Specify Format Don’t forget to specify the desired format for the response, such as a table, bulleted list, numbered list, summary etc. Without a specified format, the chatbot generates the response in a random way which may or may not aligns with your requirement.
  8. Specify Constraints: Use constraints to limit the scope of the LLM's response, ensuring it stays relevant and focused to your specific needs.
  9. Use Examples: Specifying examples in prompts is important as they provide concrete guidance for the chatbot to understand and generate the output which is inline with the given examples.