I. Prompt Engineering and Prompt Strategies
4. Prompting
Prompt Engineering and Prompting Strategies
With the increasing availability of generative AI applications, their effective use is becoming increasingly important. You have already learned how chatbots generate responses in the previous sections, so now the question arises: Which input produces the desired output?
Why is prompt engineering important?
The quality of LLM responses depends directly on the quality of the prompts given. A well-formulated prompt can lead to a precise, accurate, and relevant response. Conversely, a poorly structured prompt can lead to a vague, incorrect, or irrelevant response.
Currently, the literature presents various strategies to support users of large language models (LLMs) in developing well-formulated prompts. In this chapter, we will get to know eight prompting strategies:
- Assign a role
- Provide relevant context
- Give detailed instructions
- Guide the model toward a solution
- Request multiple versions
- Do not just describe—provide examples
- Specify the format of the response
- Build chains of argumentation
These prompting strategies can help you create detailed and structured prompts that make it particularly effective to tackle specific tasks. However, it is not necessary to use all strategies at once in a single prompt—you can selectively choose some of them depending on the task. Therefore: Experiment, experiment, experiment!
Productive use of large language models (LLMs) requires continuous and creative experimentation. Among other things, you may consider the following:
• Vary wording, length, degree of specificity, and any constraints.
• Switch back and forth between different examples, contexts, and instructions.
• Test both dialogue-oriented and concise declarative prompts.
• Try the same prompts with different LLMs.