LLM Prompt
Large Language Model Prompt
Providing information to an LLM and requesting an action
What is a Prompt?
A prompt is a piece of text and your way of communicating with LLMs, to provide information and request an action. While this communication is done in natural language form, not all communications achieve the same success level.
Even though LLMs have made significant advancements, there are still limitations to their capabilities. One critical factor for successful use of an LLM is a good prompt. This page summarizes tips on how to create effective prompts.
Tips on Writing a Good Prompt (Prompt Engineering)
1. Provide Necessary Information at the Top
If the LLM needs information to perform a task, provide the information at the beginning of the prompt. Use keywords such as “Context” to specify what the information represents.
Example:
2. Keep Instructions Short and Precise
Specify what exactly needs to be done in the bare minimum number of words required.
Example:
3. Note Expectations Clearly
State what you expect rather than what you don’t want.
Example:
4. Include Formatting Instructions
When necessary, specify the format or structure you want for the output.
Example:
5. Specify the Scope Using Identifiers
Use characters such as "
, """
, or similar identifiers to clearly demarcate the scope of the data provided within the prompt.
Example:
6. Explicitly Note Constraints and Goals
For complex prompts, categorize information into sections like Constraints and Goals. Mention goals after the constraints.
Example:
7. Place Important Instructions Near the End for Large Prompts
For larger prompts, place goals and important instructions as close as possible to the end of the prompt.
Example:
8. Stick to One Term for the Same Concept
Use consistent terminology throughout the prompt to avoid confusion.
Example:
9. Include Examples Specific to Your Data Context
Providing examples can significantly enhance the LLM's performance.
Example:
By following these tips, you can create effective prompts that guide LLMs to produce accurate and useful responses.
Last updated