Prompt Engineering BAET
Prompt Engineering BAET
2
Introduction to Prompt
Engineering
3
What are Prompts?
4
What are Prompts?
• Instruction
• Context
• Input Data
• Output indicator
5
What are Prompts?
• Important parameters:
a. Temperature: It determines how creative the model should be
b. Max_tokens: Sets the maximum length for the model's output
c. Top_p: Cumulative probability distribution
• Prompting is stochastic in nature
6
Prompting Tools
Their are a wide variety of LLM models, APIs, and platforms available for
prompting.
7
Prompting Use Cases
Use Cases:
1. Text Summarization
2. Code Generation
3. Role Playing
4. Entity Extraction
and many more…
8
Text Summarization
9
Code Generation
10
Role Playing
11
Entity Extraction
Use the following text and extract the relevant keywords that
match the labels: name, color, age.
Text: Emily is going on a trip with John and Luuk. Their ages
are 22, 25 and 24 respectively. Additionally, they are all
wearing their favorite colored clothes. Emily wears a blue
color dress, John with brown and Luuk with green.
12
Advanced Techniques for
Prompting
13
Prompt Engineering Techniques
14
Zero vs Few Shot
Label: Neutral
15
Chain - of - thought (COT) prompting
• Complex reasoning
capabilities through
intermediate reasoning steps
• Combine it with few shot to get
better results
• Zero Shot -> "Let's think step
by step"
16
Program Aided Language Model (Pal)
17
Prompt Vulnerabilities
18
Prompt Vulnerabilities
19
Model Hallucinations
Causes:
• Insufficient training data
• Presence of unseen data
• Poor written prompts
20
Prompt Injections
21
Prompt Leaking
22
Jailbreaking
23
Reinforcement Learning from Human Feedback (RLHF)
24
Reinforcement Learning from Human Feedback (RLHF)
25
Continuing with Prompting
26
Continuing with Prompting
1. Guidelines:
a. GitHub - dair-ai/Prompt-Engineering-Guide
b. Prompt Engineering Guide (Papers, Datasets, Notebooks)
c. Prompt engineering - OpenAI API
2. Courses:
a. ChatGPT Prompt Engineering for Developers - DeepLearning.AI (Partnered with OpenAI)
3. Research Papers
a. https://arxiv.org/pdf/2302.03494.pdf
b. https://arxiv.org/pdf/2310.14735.pdf
27
Thank you for your
attention!
28