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 that optimizes the performance of generative AI by crafting tailored text, code, or image-based inputs on a certain task or set of tasks. Prompts are one key approach to steering 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 and detail different prompt techniques. We will also provide practical examples and tips for immediate application in an enterprise setting. We will also explore tools like Prompt Flow from Azure AI that facilitate prompt engineering. Let's dive in and understand what prompt engineering is all about.