Prompt Engineering for ChatGPT
How to apply prompt engineering to effectively work with large language models, like ChatGPT.
What you’ll learn
- How to apply prompt engineering to effectively work with large language models, like ChatGPT
- How to use prompt patterns to tap into powerful capabilities within large language models
- How to create complex prompt-based applications for your life, business, or education
Curriculum
Course Introduction
- Motivating Example: Building a Meal Plan with a Fusion of Food from Ethiopia and Uzbekistan that is Keto
- Overview of the Course
- Motivating Example: Act as a Speech Pathologist
- Setting Up an Account and Using ChatGPT
- What are Large Language Models?
- Randomness in Output
Introduction to Prompts
- What is a Prompt?
- Intuition Behind Prompts
- Everyone Can Program with Prompts
- Prompt Patterns
- The Persona Pattern
- Introducing New Information to the Large Language Model
- Prompt Size Limitations
- Prompts are a Tool for Repeated Use
- Root Prompts
- Reading a Prompt Pattern
- Format of the Persona Pattern
- Learn More About Prompt Patterns
Prompt Patterns I
- Question Refinement Pattern
- Cognitive Verifier Pattern
- Audience Persona Pattern
- Flipped Interaction Pattern
- Format of the Question Refinement Pattern
- Format of the Cognitive Verifier Pattern
- Format of the Audience Persona Pattern
- Format of the Flipped Interaction Pattern
Few-Shot Examples
- Few-shot Examples
- Few-shot Examples for Actions
- Few-Shot Examples with Intermediate Steps
- Writing Effective Few-Shot Examples
- Chain of Thought Prompting
- React Prompting
- Using Large Language Models to Grade Each Other
- Learn More About Chain of Thought Prompting
- Learn More About React
Prompt Patterns II
- Game Play Pattern
- Template Pattern
- Meta Language Creation Pattern
- Recipe Pattern
- Alternative Approaches Pattern
- Format of the Game Play Pattern
- Format of the Template Pattern
- Format of the Meta Language Creation Pattern
- Format of the Recipe Pattern
- Format of the Alternative Approaches Pattern
Prompt Patterns III
- Ask for Input Pattern
- Combining Patterns
- Outline Expansion Pattern
- Menu Actions Pattern
- Fact Check List Pattern
- Tail Generation Pattern
- Semantic Filter Pattern
- Course Conclusion & Thank You
- Format of the Ask for Input Pattern
- Format of the Outline Expansion Pattern
- Format of the Menu Actions Pattern
- Format of the Fact Check List Pattern
- Tail Generation Pattern
- Format of the Semantic Filter Pattern
- Continue Learning About Prompt Engineering
Large Language Models (LLMs) like ChatGPT, Claude, and Gemini have revolutionized natural language processing. These models are trained to predict the next word in a sequence based on previous words, which means they recognize and respond to patterns in language. By understanding and utilizing these patterns, you can significantly enhance the quality of your interactions with LLMs.
Prompt patterns are structured strategies designed to evoke specific behaviors from these models. By employing the right prompt pattern, you can guide the LLM to produce more accurate, relevant, and useful outputs. These patterns tap into the language structures and contexts that the models have been trained on, allowing you to communicate more effectively with the AI.
This course provides an overview of various prompt patterns and their key elements, serving as a quick reference for those working with LLMs. Each pattern is designed to elicit a particular type of response or behavior from the model, helping you to achieve your desired outcomes more efficiently.
For those interested in delving deeper into this subject, Vanderbilt University’s Professor Jules White offers a comprehensive, free, self-paced course on prompt engineering. This course provides a more thorough exploration of prompt patterns and their applications in AI interactions.
By mastering these prompt patterns, you can create more effective and productive interactions with generative AI, unlocking the full potential of these powerful language models.
Pattern Name | Core Structure | Purpose | Example |
---|---|---|---|
Persona | Act as Persona X Perform task Y |
Elicit responses from a specific perspective | Act as a gourmet chef. I am going to tell you what I am eating, and you will tell me about my eating choices. |
Question Refinement | Whenever I ask a question, suggest a better version | Improve question quality | From now on, whenever I ask a question, suggest a better version and ask me if I would like to use it instead. |
Cognitive Verifier | Generate additional questions about X Combine answers to produce Y |
Ensure comprehensive and accurate responses | When you are asked to create a recipe, generate additional questions about my ingredients and equipment. Combine answers to produce a recipe I can make. |
Audience Persona | Explain X to me Assume that I am Persona Y |
Tailor explanations to specific audience | Explain large language models to me. Assume that I am a bird. |
Flipped Interaction | Ask me questions to achieve X Ask until condition Y is met |
Gather necessary information through questioning | I would like you to ask me questions to help me create variations of my marketing materials. Ask questions until you have sufficient information about my current draft messages, audience, and goals. |
Game Play | Create a game around X Provide game rules |
Engage users in interactive learning experiences | Create a cave exploration game for me to discover a lost language. Describe where I am in the cave and what I can do. |
Template | Provide a template for output X is placeholder for content |
Structure responses in a specific format | Create a random strength workout using this template: NAME, REPS @ SETS, MUSCLE GROUPS WORKED, DIFFICULTY SCALE 1-5, FORM NOTES |
Meta Language Creation | When I say X, I mean Y | Create custom shorthand or commands | When I say “variations (something)”, I mean give me ten different variations of |
Recipe | Achieve X Perform steps A, B, C Provide complete sequence |
Break down complex tasks into steps | I would like to purchase a house. I know that I need to perform steps make an offer and close on the house. Provide a complete sequence of steps for me. |
Alternative Approaches | List alternative ways to accomplish task X (Optional) Compare pros/cons |
Explore multiple solutions | For every prompt I give you, if there are alternative ways to word it, list the best alternate wordings. Compare/contrast the pros and cons of each wording. |
Ask for Input | Ask me for input X | Prompt user for specific information | From now on, I am going to cut/paste email chains into our conversation. You will summarize what each person’s points are. Ask me for the first email chain. |
Menu Actions | When I type X, you will do Y Ask for next action |
Create custom command sets | Whenever I type: “add FOOD”, you will add FOOD to my grocery list and update my estimated grocery bill. At the end, you will ask me for the next action. |
Fact Check List | Generate facts contained in output Insert at POSITION |
Enhance accuracy and verifiability | Whenever you output text, generate a set of facts contained in the output. Insert at the end of the output. |
Tail Generation | At the end, repeat Y and/or ask me for X | Maintain context and guide user actions | Act as an outline expander. At the end, ask me for what bullet point to expand next. |
Semantic Filter | Filter this information to remove X | Focus on specific content | Filter this information to remove everything but the first sentence of each paragraph. |