Prompt Engineering Overview - Anthropic
Prompt Engineering Overview - Anthropic
ai
Prompt generator
Welcome User Guides API Reference Prompt Library Release Notes
Don’t have a first draft prompt? Try the prompt generator in the Anthropic
Console!
Developer Console PROMPT ENGINEERING Developer Console
Developer Discord
Prompt engineering overview Developer Discord
Support Support
While these tips apply broadly to all Claude models, you can find prompting When to prompt engineer
Get started Get started
tips specific to extended thinking models here.
This guide focuses on success criteria that are controllable through prompt
Overview Overview
engineering. Not every success criteria or failing eval is best solved by prompt
Initial setup Initial setup engineering. For example, latency and cost can be sometimes more easily improved by
If not, we highly suggest you spend time establishing that first. Check out Define your
Resource efficiency: Fine-tuning requires high-end GPUs and large
Build with Claude success criteria and Create strong empirical evaluations for tips and guidance. Build with Claude
memory, while prompt engineering only needs text input, making it much
Ask AI
Define success criteria Define success criteria more resource-friendly.
Cost-effectiveness: For cloud-based AI services, fine-tuning incurs Transparency: Prompts are human-readable, showing exactly what
significant costs. Prompt engineering uses the base model, which is information the model receives. This transparency aids in understanding
typically cheaper. and debugging.
Developer Discord Time-saving: Fine-tuning can take hours or even days. In contrast, prompt Developer Discord
Get started Get started effective techniques to more specialized techniques. When troubleshooting
Minimal data needs: Fine-tuning needs substantial task-specific, labeled
performance, we suggest you try these techniques in order, although the actual impact
data, which can be scarce or expensive. Prompt engineering works with
Overview Overview of each technique will depend on your use case.
few-shot or even zero-shot learning.
Initial setup Initial setup
Flexibility & rapid iteration: Quickly try various approaches, tweak 1. Prompt generator
Intro to Claude Intro to Claude
prompts, and see immediate results. This rapid experimentation is difficult
2. Be clear and direct
with fine-tuning.
Learn about Claude Learn about Claude 3. Use examples (multishot)
Domain adaptation: Easily adapt models to new domains by providing
Use cases Use cases 4. Let Claude think (chain of thought)
domain-specific context in prompts, without retraining.
Models & pricing Models & pricing 5. Use XML tags
Comprehension improvements: Prompt engineering is far more effective
Security and compliance than finetuning at helping models better understand and utilize external Security and compliance 6. Give Claude a role (system prompts)
content such as retrieved documents
7. Prefill Claude’s response
Build with Claude Preserves general knowledge: Fine-tuning risks catastrophic forgetting, Build with Claude
8. Chain complex prompts
where the model loses general knowledge. Prompt engineering maintains
Define success criteria Define success criteria
the model’s broad capabilities. 9. Long context tips
Develop test cases Develop test cases