6 Guide to prompt engineering
This chapter covers
- Basics of prompt engineering and core concepts
- Various prompt engineering techniques, including image prompting
- Understanding new threat vectors called prompt hijacking
- Challenges and best practices for prompt engineering
Many of the Generative AI models we have seen are prompt-based – the large language models from OpenAI, text-to-image models, Stable Diffusion, and others. We interact with these models using a prompt, and at least in the base of LLMs, they respond with a prompt. Prompts are the main modality of “talking” to these models, which makes understanding and crafting these prompts quite important.
Prompt engineering is a new technique and is the process of optimizing the performance of generative AI through crafting tailored text, code, or image-based inputs on a certain task or set of tasks. Prompts are one of the key approaches to steer the models to the desired outcome. Effective, prompt engineering boosts the capabilities of generative AI and returns better results that are more relevant, accurate, and creative.
In this chapter, we will introduce the basic concepts of prompt engineering, detail different prompt techniques, and provide some practical examples and tips for applying them in an enterprise. We will also touch on tools like Prompt Flow from Azure AI that help prompt engineering. Let us start by understanding what prompt engineering is.