Unlocking prompt engineering techniques
The field of prompt engineering is an active area of research and innovation with new techniques and patterns emerging frequently, driven by the pursuit to improve the performance of the models and generate more natural human-like responses. In this section, we are going to look at some of the most common patterns.
Zero-shot prompting
Zero-shot refers to the ability of LLMs to generate reasonable responses to prompts that it has not been explicitly trained on. It relies solely on a descriptive prompt to specify the desired output, as depicted in Figure 3.4:
Figure 3.4 – Zero-shot prompting
For instance, a zero-shot prompt to get a poem could be Write a rhyming poem with 4 stanzas about
seasons changing
.
The main advantage of this method is that it’s easier; prompt crafting can be done without providing examples in the input. However, output quality can vary without concrete examples to base...