Skip to content

01 | Prompt Engineering


1. Introduction

Prompt Engineering is the process of designing and refining prompts to get a relevant response with a desired quality from a generative AI model. It is a trial-and-error process, with iteration and evaluation to get an acceptable response.

Prompt engineering can feel more like art than science, requiring us to understand the model’s capabilities (& quirks), the application domain (task context), and the user’s intent - to get responses right. For clarity, we’ll qualify the term further:

  • User Prompt - refers to the original natural language request from the user.
  • Model Prompt - refers to the refined version fed to the model for response.

In the simplest case, both refer to the same thing with the user prompt simply being fed directly to the model. In real-world apps, we will typically refine the prompt post-input to improve the quality of the response. For example: we might use a technique like retrieval augmented generation to ground the prompt in our knowledge base before feeding it to the model. In this case, the model prompt will be an enhanced version of the original user prompt. If no qualifier is used, assumed we are talking about the model prompt.

Prompt engineering now has two facets for us to consider:

  1. Educating Users so that the initial user prompt is itself as effective as possible. This can involve providing users with guidelines, templates, and tools to streamline their prompt generation.
  • Engineering Workflows so that the user prompt is or refined to be more effective given context like model capabilities, application requirements, or operationalization constraints. This can involve mechanisms like prompt chaining and evaluation to refine the prompt iteratively.

In this specific lesson, we’ll focus more on design patterns and best practices for the former. We’ll cover the latter in more detail when exploring end-to-end development workflows and LLM Ops.

2. Motivation

Why is prompt engineering critical for generative AI?

3. Core Concepts

4. Best Practices

5. Lab Exercises