Skip to content

Commit

Permalink
Interim check-in (refactoring)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitya committed Oct 15, 2023
1 parent b1d01e8 commit 1c6dd56
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
27 changes: 15 additions & 12 deletions 4-prompt-engineering-fundamentals/4.0-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,30 @@ CODE CHALLENGE:
If provided, should have an education focus - help show how the concepts can be applied to make the lives of teachers and students easier.
-->

## 4.1 Introduction

## Introduction
Our education startup is focused on ways in which we can [bring AI innovation to education](https://educationblog.microsoft.com/2023/06/collaborating-to-bring-ai-innovation-to-education) to support _administrators, educators and students_ with generative AI experiences. We're focusing on **personalized learning experiences** that can be activated with natural language (chat) interfaces so our users don't need any technical expertise to start using them.

By now, you are familiar with these two terms:

By now, we're familiar with these two terms:
- **Generative AI** - is a category of artificial intelligence capable of _generating new content based on pre-trained models_ - in response to a natural language input or "prompt".
- **Large Language Models (LLM)** - are a type of generative AI trained on massive quantities of text data to execute natural language processing (NLP) tasks at scale.

In this lesson, we're going to introduce a third term - **Prompt Engineering** - that reflects a new field of engineering focused on _more effective prompt design_ with tools and techniques to guide LLMs to deliver more relevant and consistent results for our generative AI applications.
- We'll define prompt engineering and motivate the need to design better prompts.
- We'll explore prompt usage in real-world examples to understand opportunities and limitations.
- We'll explore design techniques to help us iterate and validate prompts till they meet expectations.
- We'll define prompt engineering - and motivate the need to design better prompts.
- We'll explore prompt usage with examples - and understand opportunities and limitations.
- We'll explore design techniques - and iterate and validate prompts to meet expectations.


## Learning Goals

By the end of this lesson you will be able to:
- Describe Prompt Engineering - what it is, and why it matters to generative AI apps.
- Discuss Real-World Prompt Examples - illustrate their value and highlight their limitations.
- Apply Prompt-Engineering Techniques - to iterate & validate responses till desired criteria is met.
- Explore Prompt Engineering with OpenAI - using GitHub Codespaces, Jupyter Notebooks and OpenAI API key.
By the end of this lesson we will be able to:
- _Describe Prompt Engineering_ - what it is, and why it matters in generative AI apps.
- _Analyze Prompt Examples_ - to understand best practices & limitations for prompt design.
- _Apply Prompt Engineering Techniques_ - to iterate & validate prompts for response quality.
- _Explore Prompt Engineering with OpenAI_ - using GitHub Codespaces & Jupyter Notebooks.

Once we get an understanding of prompt engineering fundamentals, we can then answer this question for our education startup:

This will set the stage for you to explore more _advanced engineering techniques_ in the next lesson. It should also help you **apply these learnings** to your real-world application by answering this question:
_How can we engineer prompts to deliver a more reliable and consistent experience for our students, educators and adminstrators using our generative AI app?_

> _How can better prompt engineering help me deliver an enhanced experience to students, educators, adminstrators and other user audiences, in my education startup_.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Prompt Engineering.
Define it and explain why it is needed.
-->

In this lesson unit, we'll focus on answering two questions:
In this unit, we'll focus on answering two questions:
1. What is Prompt Engineering?
2. Why is Prompt Engineering needed?

Expand All @@ -17,20 +17,20 @@ Let's dive in!

## 4.1.1 What is Prompt Engineering?

We know that Generative AI applications can create new kinds of content (text, images, audio, code and more) in response to a text input (question) from the user. This text input is called a **prompt** and prompt engineering is the **process of designing and optimizing prompts** for Generative AI applications.
Generative AI applications take text-based inputs (or prompts) from the user, and respond with a relevant response. In the case of models like GPT3.5 and GPT-4 from OpenAI, the response is a **text completion** reflecting the model's attempt at continuation of the input text or related instruction.

Prompts tell the Generative AI model what to do. Think of them almost like a set of _instructions or questions_ that you provide to as a rubric to guide the model towards more relevant and consistent responses. And, just like with any rubric, the _quality_ of the returned response depends on the _clarity and guidelines_ provided by the instructions.
This makes models sensitive to the structure and content of the prompt. Prompts tell the Generative AI model what to do, effectively configuring the model weights to support completion of the desired task. Prompt _engineering_ is the process by which we **guide the model towards more relevant responses** by providing more useful instructions or context. We can approach this as a 2-part process:

Think of prompt engineering as a 2-part process:
1. **Prompt design** - the process of "writing a good first prompt" that provides core instructions to guide the model towards producing a _relevant_ response.
2. **Prompt optimization** - the process of "tuning the prompt" with repeated iterations - validating results each time till the _quality_ of prompt responses meets desired expectations.
1. **Prompt construction** - the process of "writing a good first prompt" that guides the model towards producing a _relevant_ response as the text completion.
2. **Prompt optimization** - the process of "refining that prompt" by iterating on the input and validating the output, till it produces a _desired quality_ of that response.

The most important thing to remember is that prompt engineering is **more art than science**. Think of it as a trial-and-error process where you can learn and apply recommended techniques (some of which we'll cover in this lesson) first, to improve the quality of results. But you'll also bring your own application domain knowledge and intuition next, to refine the prompt further till you get the results you need.
The main thing we need to remember is that prompt engineering is more art than science. It's a trial-and-error process where we can start off by learning and applying best practices for prompt engineering - but then bring in our own intuition and domain-specific knowledge to customize those techniques further till we get results that meet our expectations.


## 4.1. 2 Why do we need Prompt Engineering?

Just like with rubrics, prompts can benefit from an _iterate and validate_ process where we design the prompt, then see how well those instructions were understood by analyzing the responses, then refine the prompt and try again. Iterate till results are _closer_ to our expectations.
Generative Pre-Trained Transformer (GPT) models like OpenAI's GPT-3 and GPT-4 are powerful - but they are not perfect. Prompts help users "program" models like this to complete a desired task, ideally by giving it instructions or examples to follow. But because prompts use natural language, different users can construct prompts for the same request in different ways, making the model more sensitive to the structure and content in prompts.


But why do we need an entire **prompt engineering discipline** with tools, techniques and best practices, for use in generative AI applications? Shouldn't our intuition be enough? It's because LLMs are great at _generating content_ but are clueless about the _meaning_ of the content they just created. So they can't tell if the output was relevantand met your expectations for quality.

Expand Down
17 changes: 6 additions & 11 deletions 4-prompt-engineering-fundamentals/4.5-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ Wrap the section with a summary and resources for self-guided learning.
-->


## Additional Resources
## Learning Resources

- [Prompt Engineering: How to talk to the AIs](https://www.linkedin.com/learning/prompt-engineering-how-to-talk-to-the-ais/talking-to-the-ais?u=0) (Apr 2023, LinkedIn Learning)
- [Prompt Engineering 201](https://amatriain.net/blog/prompt201) - Advanced Methods and Toolkits (2023)
- [ChatGPT Prompt Engineering For Developers](https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/) - DeepLearning.AI Short Course (2023)
- [Apply Prompt Engineering with Azure Open AI](https://learn.microsoft.com/en-us/training/modules/apply-prompt-engineering-azure-openai/) - Microsoft Learn Module (2023)
- [Prompt Engineering Overview: Semantic Kernel](https://learn.microsoft.com/en-us/semantic-kernel/prompt-engineering/) (May 2023)
- [Advanced Prompt Engineering Techniques for LLMs](https://tungmphung.com/advanced-yet-simple-prompt-engineering-techniques-for-large-language-models/) (Apr 2023)
- [Azure OpenAI for Education Prompts](https://techcommunity.microsoft.com/t5/education-blog/azure-openai-for-education-prompts-ai-and-a-guide-from-ethan-and/ba-p/3938259) (Sep 2023)
- [Prompts For Education: Prompt Library](https://github.com/microsoft/prompts-for-edu) (Sep 2023)
- [LLM Parameters Demystified: Getting The Best Outputs from Language AI](https://txt.cohere.com/llm-parameters-best-outputs-language-ai/) (Jun 2022)
- [Best Practices for Prompt Engineering with OpenAI](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api) - Open AI
1. [Introduction to Generative AI](https://learn.microsoft.com/training/paths/introduction-generative-ai/) - Microsoft Learning Path (2023)
1. [Introduction to Prompt Engineering](https://learn.microsoft.com/azure/ai-services/openai/concepts/prompt-engineering) - Azure OpenAI Documentation (2023)
1. [Prompt Engineering Techniques](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/advanced-prompt-engineering?pivots=programming-language-chat-completions) - Azure OpenAI Documentation (2023)
1. [Prompt Engineering Overview](https://learn.microsoft.com/en-us/semantic-kernel/prompt-engineering/) - Semantic Kernel Documentation (2023)
1. [Azure OpenAI for Education Prompts](https://techcommunity.microsoft.com/t5/e1.ucation-blog/azure-openai-for-education-prompts-ai-and-a-guide-from-ethan-and/ba-p/3938259) - Microsoft Tech Community (2023)

0 comments on commit 1c6dd56

Please sign in to comment.