Prompt Design
Prompt defines the specific way and context of interaction between users and AI. It is an important bridge connecting user intent and AI functionality. Through proper design and application, it can significantly improve the performance and user experience of AI Agents. As an asynchronous Agent product, Dakou relies on appropriate prompts for success, whether generating code, writing articles, or other tasks.
Some practical suggestions for prompt design:
Structured Prompts
- Clearly divide prompts into different modules, such as: user instructions, context, constraints, output specifications, examples, etc.
- Use clear separators (such as XML tags
, or simple ###) to divide different areas
Concise Expression, Clear Instructions
- Prompts should be concise and clear, avoiding ambiguity - the more direct, the better
- Do not provide unnecessary information, as it will distract attention
Clear Goals/Output
- Provide specific details
- Clearly state what you want and what you don't want
Use Instructions Rather Than Constraints
- Instructions: Provide clear directions on the required format, style, or content. They guide the model on what to do or produce.
- Constraints: A set of limitations or boundary conditions that restrict what the model should not do or avoid.
- Increasing research shows that focusing on positive instructions in prompts is more effective than over-relying on limitations. Consistent with humans preferring positive instructions over lists of what not to do. Tell the model what to do, not what not to do
Provide Examples
- Few-shot prompts: For classification tasks, ensure a mix of possible response categories in examples to avoid overfitting
- A good rule of thumb is to start testing accuracy with 6 few-shot examples
Continuously Experiment and Iterate Optimization
- Prompt engineering is an iterative process
- Record various prompt attempts to learn over time what works well and what doesn't
- Continuously experiment until you get the desired output
Others
- Transformer architecture models will pay special attention to the beginning and end of prompts
- Important things can be emphasized several times
- If the conversation is long, remind the model of key points
- Use prefixes effectively: Note/Important, etc., to mark content that requires LLM's focused attention