Skip to main content

Prompt Best Practices

When interacting with large language models (LLMs), well-designed prompts are essential for obtaining accurate and relevant outputs. Here are some best practices to help you optimize your prompt design:

1. Build Clear and Concise Prompts​

Ensure that your prompt is clear and straightforward, avoiding vague or complex instructions so that the model can quickly understand and generate the desired content.

Example:

Please write an article on the future development of artificial intelligence.

2. Provide Contextual Information​

Provide the model with sufficient background information so it can understand the context and details of the task.

Example:

Based on the following article, summarize the main points: 
[Knowledge Base Content]

3. Use Role Play​

Ask the model to play a specific role to obtain more accurate and relevant output.

Example:

As a medical expert, please explain the symptoms and treatments of diabetes.

4. Use Delimiters​

Use delimiters (such as triple quotes, XML tags, etc.) to clearly mark different parts of the input, helping the model better understand the task structure.

Example:

'''
Please generate a product promotion copy based on the following information: Product Name: Smartwatch Features: Heart rate monitoring, GPS tracking, Message reminders
'''

5. Specify Output Format​

Clearly request the model to output the result in a specific format, such as a list, table, or particular text structure.

Example:

Please list the main points of the following article in bullet points: 
[Knowledge Base Content]

6. Provide Examples​

Provide examples of the desired output in your prompt so the model can "mimic" the required format, structure, concepts, grammar, or tone.

Example:

Please write a short essay on environmental protection based on the following example: Example: Environmental protection is our responsibility. We can protect the environment by reducing plastic usage, saving water, and other means.

7. Break Down Complex Tasks​

Break complex tasks into smaller sub-tasks and guide the model step by step to complete them.

Example:

Please write a story in the following steps:

1. Set the background and characters.
2. Describe the character’s goal and the challenges they face.
3. Tell how the character overcomes the challenges and ultimately achieves their goal.
4. End the story with an interesting conclusion.

8. Give the Model "Thinking" Time​

Add cues in the prompt to encourage the model to think, which can improve the accuracy of its responses.

Example:

Let’s analyze and think step by step to solve the following math problem: 
[Math Problem]

9. Use External Tools​

Instruct the model to use external tools or resources in the prompt to enhance the accuracy and richness of its response.

Example:

Please generate a sales report using the following data: 
[Data]

10. Conduct Systematic Testing and Optimization​

Continuously adjust and optimize your prompts by testing different prompt settings, observing the quality of the generated content, and making adjustments to the content or structure as needed.

Example:

Please write an article on artificial intelligence based on the following prompts:
Prompt: Definition of AI, Development history, Application fields, Future trends.

By following these best practices, you can more effectively design and use prompts to ensure that the generated content meets your needs and provides high-quality answers.