Prompt Engineering
Prompt Engineering Defined
Prompt Engineering is the practice of designing inputs for AI tools that produce optimal outputs. Users ask questions or invoke commands of a large language model. Understanding how to structure prompts improves the reliability of AI-generated outputs.
Quality In → Quality Out
Best Practices
- Communication – provide deep context and background information.
- Define Goal – utilize the S.M.A.R.T. framework:
- Specific – goals should be well-defined and answer the 5 W’s (who, what, where, when, why). Narrow focus with clear instructions.
- Measurable – goals must have quantifiable criteria; define how to determine success.
- Attainable – goals should be realistic.
- Relevant – goals should align with objectives and be worthy of pursuit.
- Time Bound – goals should have a deadline to ensure accountability.
- Write goals directly in the prompt bar – clearly state what you want to achieve.
Context Provision
Describe the current state and desired future state for effective planning. Provide detailed instruction in questioning for clarity of the request.
Output Format
Use iterative refinement with the AI to modify prompts based on responses. Always state the preferred format of the output.
Prompt Techniques
- Zero-shot – best for simple tasks; LLMs are prompted without examples.
- Few-shot – ideal for complex or domain-specific tasks; provide a few examples to guide the model.
- Chaining – break complex tasks into a sequence of smaller prompts for improved accuracy.
Results & Collaboration
- Ask LLMs to cite sources for validation.
- Illustrate sequential execution of prompts.
- Check for hallucinations and biases.
- Templatize prompts for re-use to accelerate decision-making.