Prompt Engineering - an Art, a Science, or your next Job Title?

Maxim Salnikov
Maxim SalnikovDeveloper Engagement Lead at Microsoft
Prompt Engineering -
an Art, a Science, or
your next Job Title?
Maxim Salnikov
Developer Productivity Lead
Microsoft
• Building on web platform since 90s
• Organizing developer communities and technical conferences
• Speaking, training, blogging: Webdev, Cloud, OpenAI
Helping developers to succeed with the Cloud & AI technology
I’m Maxim Salnikov
• Generative AI’s impact on productivity could add up to
$4.4 trillion annually in value to the global economy.
• About 75% of the value that generative AI use cases
could deliver falls across customer
operations, marketing, sales, software engineering,
and R&D .
• Generative AI can revolutionize work by automating a
significant portion of employees' activities, up to 60-
70% of their current workload. This augmentation of
individual capabilities has the potential to transform
the way we work.
Artificial Intelligence
1956
Artificial Intelligence
The field of computer science that seeks to create
intelligent machines that can replicate or exceed
human intelligence
Machine Learning
1997
Machine Learning
Subset of AI that enables machines to learn from
existing data and improve upon that data to make
decisions or predictions
Deep Learning
2017
Deep Learning
A machine learning technique in which layers of neural
networks are used to process data and make decisions
Generative AI
2021
Generative AI powered by foundation
models
Create new written, visual, and auditory content given
prompts or existing data
Path to impact and usecases
Source: IDC, IDC PlanScape: Developing Your Path to Impact with Generative AI, #US51157323
Emerging model landscape
• OpenAI's GPT2, ChatGPT, GPT-3, GPT3.5, GPT4.0 (language) DALL-E 2 (image),
and Whisper (speech)
• Stability.ai's Stable Diffusion (image)
• Midjourney (image)
• Google's PaLM, PaLM2, LaMDA, Minerva, UL2, Bard (language), and Imagen
(image)
• Google/DeepMind's Chinchilla, Retro-7B, AlphaCode (language), Flamingo,
and Gato (multimodal)
• Meta's LLaMa, NLLB, OPT-175B, Sparse all-MLP (language), Make-a-Video
(video), and data2vec (multimodal)
• Microsoft's DeepNet (language) and MetaLM (multimodal)
• BigScience's BLOOM (language)
• AI21 Labs' Jurassic-X (language)
• Dolly 2.0 (language)
• …
One common thing…
Prompt Engineering
Process of designing, refining, and
optimizing input prompts to guide a
model toward producing more accurate
outputs while keeping cost efficiency
Prompt anatomy
<
Write a product launch email for new headphones.
This product is AI-powered and priced at $79.99.
The tone is friendly and exciting.
Output as a JSON object with "subject" and "body" fields.
Example:
{
"subject": "Introducing Our New AI-Powered Headphones!",
"body": "We are thrilled to announce the launch of our new AI-
powered headphones"
}
Output:
Instruction
Input data
Context
Target format
Example
Cue
<
Tokens
Prompts and cost efficiency
• Prompt and completion length
• Number of API calls in production
• Number of API calls during development
(experimentation stage)
• Type of deployed model
Model selection strategy: Start with heaviest models and gradually ramp down to cheaper ones
while the result is satisfactory
•
• Tokens can sometimes be counter-intuitive
• Tabular data is space-efficient
Space efficiency
General recommendations
• Be specific
• Order matters
• Double down
• Give the model an “out”
Technical recommendations
• Start with clear instructions and repeat the
instructions at the end
• Add clear syntax: headers, separators
• Break the task down
• Adjust parameters: Temperature and Top
probabilities
Zero-shot VS few-shot prompts
Zero-shot
The model predicts the answer given only a natural language description
of the task.
Few-shot
In addition to the task description, the model sees a few examples of the
task.
Customer question: Hi there, do you know how to choose
flood insurance?​
Classified topic: 2​
Customer question: Hi there, I have a question on my auto insurance.​
Classified topic: 1​
Classify customer's question. Classify between category 1 to 3.
Detailed guidelines for how to choose:
choose 1 if the question is about auto insurance.
choose 2 if the question is about home flood insurance.
choose 3 if the question is not relevant to insurance.
Classify customer's question. Classify between category 1 to 3.
Detailed guidelines for how to choose:
choose 1 if the question is about auto insurance.
choose 2 if the question is about home flood insurance.
choose 3 if the question is not relevant to insurance.
Customer question: {insert new question here}
Classified topic:
Customer question: What packages do you have in auto insurance?
Classified topic:
Zero Shot - Reasoning
Before
What is the annual water demand of a single-family
household containing four people who are at home an
average of 200 days per year and use an average of 100
liters of water per day?
The annual water demand of a single-family household
containing four people who are at home an average of
200 days per year and use an average of 100 liters of
water per day is 8,000,000 liters per year.
After
What is the annual water demand of a single-family
household containing four people who are at home an
average of 200 days per year and use an average of 100
liters of water per day?
Let’s think step by step and explain the calculation
step by step.
Step 1: Calculate the total number of days in a year:
There are 365 days in a year.
Step 2: Calculate the total number of days the family is at home:
The family is at home an average of 200 days per year.
Step 3: Calculate the total water demand of the family:
The family uses an average of 100 liters of water per day. Therefore, the total water
demand of the family is 100 liters x 200 days = 20,000 liters per year.
Step 4: Calculate the annual water demand of the single-family household:
The annual water demand of the single-family household is 20,000 liters per year.
Few Shot Reasoning – Example 1
1st prompt
Roger has 5 tennis balls. He buys 2 more cans of tennis
balls. Each can has 3 tennis balls. How many tennis balls
does he have now?
Answer: The answer is 11.
The cafeteria has 23 apples. If they used 20 to make lunch
and bought 6 more, how many do they have?
The answer is 27
2nd prompt—provide reasoning
Roger has 5 tennis balls. He buys 2 more cans of tennis
balls. Each can has 3 tennis balls. How many tennis balls
does he have now?
Answer: Roger started with 5 balls. 2 cans of 3 tennis balls
each is 6 tennis balls. 5+6 = 11. The answer is 11.
The cafeteria has 23 apples. If they used 20 to make lunch
and bought 6 more, how many do they have?
The cafeteria had 23 apples originally. They used 20 to
make lunch. So they had 23-20 = 3. They bought 6
more apples, so they have 3 + 6 = 9. The answer is 9.
Prompt Chaining
Entity Extraction
Please extract entities from the
following news article: 'The new
iPhone model is set to be released
next month. It has been highly
anticipated by Apple fans and is
expected to feature a larger screen
and improved camera
{'text': 'iPhone', 'type’:
'PRODUCT'}, {'text': 'Apple’,
'type': 'ORGANIZATION'}]
Summarization
Please summarize the information
about the product
[{'text': 'iPhone', 'type': 'PRODUCT'},
{'text': 'Apple', 'type':
'ORGANIZATION’}]
The iPhone is a line of smartphones
designed and marketed by Apple
Inc. These devices combine a
computer, camera, and internet
connectivity in a single device, and
are known for their sleek design and
user-friendly interface.
Sentiment Analysis
Please provide a sentiment for the
following text:
The iPhone is a line of smartphones
designed and marketed by Apple
Inc. These devices combine a
computer, camera, and internet
connectivity in a single device,
and are known for their sleek
design and user-friendly interface.
Positive
Few Shot Reasoning – Example 2
1st prompt—Reason Extraction
On average Joe throws 25 punches per minute.
A fight lasts 5 rounds of 3 minutes. How many
punches did he throw?
Let’s think step by step and explain the calculation
step by step.
In one minute, Joe throws 25 punches.
In three minutes, Joe throws 3 * 25 = 75 punches.
In five rounds, Joe throws 5*75 = 375 punches.
2nd prompt—Answer Extraction
One average Joe throws 25 punches per minute.
A fight lasts 5 rounds of 3 minutes. How many
punches did he throw?
In one minute, Joe throws 25 punches.
In three minutes, Joe throws 3 * 25 = 75 punches.
In five rounds, Joe throws 5*75 = 375 punches.
The cafeteria has 23 apples. If they used 20 to make lunch
and bought 6 more, how many do they have?
Therefore, the answer (Arabic numerals) is
The cafeteria had 23 apples originally. They used 20
to make lunch. So they had 23-20 = 3. They bought 6
more apples, so they have 3 + 6 = 9. The answer is 9.
Prompt Chunking (token limit)
Large Text
Beyond
Token
Limit
Chunks
Please summarize and extract topic: Global warming refers to
the gradual increase in the overall temperature of the Earth's
atmosphere, primarily caused by the burning of fossil fuels
such as coal, oil, and natural gas. This burning releases
carbon dioxide and other greenhouse gases into the
atmosphere, which trap heat and cause the Earth's
temperature to rise.
Climate change is a pressing issue that needs to be addressed
immediately. Governments around the world need to take
immediate action to reduce carbon emissions and invest in
renewable energy sources. Failure to do so will have dire
consequences for future generations
The text is discussing global warming, which is the gradual increase in
the overall temperature of the Earth's atmosphere caused by the
burning of fossil fuels. This burning releases greenhouse gases, such as
carbon dioxide, into the atmosphere which trap heat and cause the
temperature to rise. The text also highlights the urgency of the issue of
climate change and the need for governments to take action to reduce
carbon emissions and invest in renewable energy sources. Failure to
address this issue will have negative consequences for future
generations.
Topic: Climate change and Global warming.
Continue to
next prompt
Please summarize the following text:
'Climate change is a pressing issue that
needs to be addressed immediately. The
increasing levels of carbon dioxide in the
atmosphere are causing the Earth's
temperature to rise, which is leading to
more frequent and severe natural disasters.
Governments around the world need to take
immediate action to reduce carbon
emissions and invest in renewable energy
sources. Failure to do so will have dire
consequences for future generations'"
Climate change is a pressing issue that needs to
be addressed immediately. Governments
around the world need to take immediate
action to reduce carbon emissions and invest in
renewable energy sources. Failure to do so will
have dire consequences for future generations
Then all summaries are passed to GPT again to
summarize, i.e. second round of summarization. The sum
of the summaries has to fit within the token limit.
Retrieval Augmented Generation (RAG)
Extract precise answers from your unstructured documents with Azure OpenAI + Cognitive Search: article + repo
https://learn.microsoft.com/en-us/azure/search/retrieval-augmented-generation-overview
https://enterprise.promptengineering.rocks
App or
Copilot agent
API & SDK
Azure OpenAI
Service on your data
Data Sources
(search, files, databases, storage etc.)
Additional 3P Data Sources
(files, databases, storage data etc.)
Recently Announced
Azure OpenAI Service
on your data
https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/use-your-data
LangChain Semantic Kernel
https://github.com/microsoft/semantic-kernel
https://github.com/langchain-ai/langchain
Prompt Flow – streamline dev cycle of LLM-based apps
https://github.com/microsoft/promptflow
Learning resources
• Learn Prompting Community
• Prompting Guide by DAIR.AI
• Prompt Engineering for the developers on Deep Learning
• Prompt Examples on OpenAI
• Introduction to Prompt Engineering on Microsoft Learn
https://promptengineering.rocks
Maxim.Salnikov@microsoft.com
Let’s connect and chat!
Thank you!
1 of 28

Recommended

ChatGPT for Academic by
ChatGPT for AcademicChatGPT for Academic
ChatGPT for AcademicAndry Alamsyah
2.3K views36 slides
Introduction to ChatGPT by
Introduction to ChatGPTIntroduction to ChatGPT
Introduction to ChatGPTannusharma26
1.5K views1 slide
ChatGPT vs. GPT-3.pdf by
ChatGPT vs. GPT-3.pdfChatGPT vs. GPT-3.pdf
ChatGPT vs. GPT-3.pdfAddepto
495 views4 slides
ChatGPT-the-revolution-is-coming.pdf by
ChatGPT-the-revolution-is-coming.pdfChatGPT-the-revolution-is-coming.pdf
ChatGPT-the-revolution-is-coming.pdfLiang Yan
2.9K views8 slides
ChatGPT 101 - Vancouver ChatGPT Experts by
ChatGPT 101 - Vancouver ChatGPT ExpertsChatGPT 101 - Vancouver ChatGPT Experts
ChatGPT 101 - Vancouver ChatGPT ExpertsAli Tavanayan
1.1K views29 slides
A comprehensive guide to prompt engineering.pdf by
A comprehensive guide to prompt engineering.pdfA comprehensive guide to prompt engineering.pdf
A comprehensive guide to prompt engineering.pdfAnastasiaSteele10
236 views30 slides

More Related Content

What's hot

Prompting is an art / Sztuka promptowania by
Prompting is an art / Sztuka promptowaniaPrompting is an art / Sztuka promptowania
Prompting is an art / Sztuka promptowaniaMichal Jaskolski
286 views49 slides
Using the power of Generative AI at scale by
Using the power of Generative AI at scaleUsing the power of Generative AI at scale
Using the power of Generative AI at scaleMaxim Salnikov
908 views31 slides
ChatGPT-Template-slidesppt.net_.pptx by
ChatGPT-Template-slidesppt.net_.pptxChatGPT-Template-slidesppt.net_.pptx
ChatGPT-Template-slidesppt.net_.pptxRameshBabu161437
370 views27 slides
ChatGPT.pptx by
ChatGPT.pptxChatGPT.pptx
ChatGPT.pptxnitindhiman53
945 views9 slides
ChatGPT Deck.pptx by
ChatGPT Deck.pptxChatGPT Deck.pptx
ChatGPT Deck.pptxomornahid1
4.1K views17 slides
CHATGPT.pptx by
CHATGPT.pptxCHATGPT.pptx
CHATGPT.pptxSajedRahman2
300 views13 slides

What's hot(20)

Prompting is an art / Sztuka promptowania by Michal Jaskolski
Prompting is an art / Sztuka promptowaniaPrompting is an art / Sztuka promptowania
Prompting is an art / Sztuka promptowania
Michal Jaskolski286 views
Using the power of Generative AI at scale by Maxim Salnikov
Using the power of Generative AI at scaleUsing the power of Generative AI at scale
Using the power of Generative AI at scale
Maxim Salnikov908 views
ChatGPT-Template-slidesppt.net_.pptx by RameshBabu161437
ChatGPT-Template-slidesppt.net_.pptxChatGPT-Template-slidesppt.net_.pptx
ChatGPT-Template-slidesppt.net_.pptx
RameshBabu161437370 views
ChatGPT Deck.pptx by omornahid1
ChatGPT Deck.pptxChatGPT Deck.pptx
ChatGPT Deck.pptx
omornahid14.1K views
Praneet’s Pre On ChatGpt edited.pptx by Salunke2
Praneet’s Pre On ChatGpt edited.pptxPraneet’s Pre On ChatGpt edited.pptx
Praneet’s Pre On ChatGpt edited.pptx
Salunke2889 views
Prompt Engineering.pptx by ahmedmishfaq
Prompt Engineering.pptxPrompt Engineering.pptx
Prompt Engineering.pptx
ahmedmishfaq100 views
Revolutionary-ChatGPT by 9 series
Revolutionary-ChatGPTRevolutionary-ChatGPT
Revolutionary-ChatGPT
9 series1.2K views
ChatGPT Evaluation for NLP by XiachongFeng
ChatGPT Evaluation for NLPChatGPT Evaluation for NLP
ChatGPT Evaluation for NLP
XiachongFeng774 views
Increase Productivity with ChatGPT by PrinceGarg95
Increase Productivity with ChatGPTIncrease Productivity with ChatGPT
Increase Productivity with ChatGPT
PrinceGarg95743 views

Similar to Prompt Engineering - an Art, a Science, or your next Job Title?

Prompt Engineering - an Art, a Science, or your next Job Title? by
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Maxim Salnikov
61 views33 slides
Eco 365 Inspiring Innovation--tutorialrank.com by
Eco 365 Inspiring Innovation--tutorialrank.comEco 365 Inspiring Innovation--tutorialrank.com
Eco 365 Inspiring Innovation--tutorialrank.comPrescottLunt391
21 views15 slides
Marketing Plan For A New Factory by
Marketing Plan For A New FactoryMarketing Plan For A New Factory
Marketing Plan For A New FactoryMaggie Turner
2 views46 slides
CSSA KZN Chapter 2007 AGM by
CSSA KZN Chapter 2007 AGMCSSA KZN Chapter 2007 AGM
CSSA KZN Chapter 2007 AGMlokes
439 views61 slides
Chapter One Notes by
Chapter One NotesChapter One Notes
Chapter One NotesMrRedAHS
1.1K views80 slides
EIA 2015 Validating Revenue Model Assumptions by
EIA 2015 Validating Revenue Model AssumptionsEIA 2015 Validating Revenue Model Assumptions
EIA 2015 Validating Revenue Model AssumptionsEuropean Innovation Academy
1.1K views149 slides

Similar to Prompt Engineering - an Art, a Science, or your next Job Title?(20)

Prompt Engineering - an Art, a Science, or your next Job Title? by Maxim Salnikov
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
Maxim Salnikov61 views
Eco 365 Inspiring Innovation--tutorialrank.com by PrescottLunt391
Eco 365 Inspiring Innovation--tutorialrank.comEco 365 Inspiring Innovation--tutorialrank.com
Eco 365 Inspiring Innovation--tutorialrank.com
PrescottLunt39121 views
Marketing Plan For A New Factory by Maggie Turner
Marketing Plan For A New FactoryMarketing Plan For A New Factory
Marketing Plan For A New Factory
Maggie Turner2 views
CSSA KZN Chapter 2007 AGM by lokes
CSSA KZN Chapter 2007 AGMCSSA KZN Chapter 2007 AGM
CSSA KZN Chapter 2007 AGM
lokes439 views
Chapter One Notes by MrRedAHS
Chapter One NotesChapter One Notes
Chapter One Notes
MrRedAHS1.1K views
BUSI 620 MENTOR Education Your Life--busi620mentor by thomashard44
BUSI 620 MENTOR Education Your Life--busi620mentorBUSI 620 MENTOR Education Your Life--busi620mentor
BUSI 620 MENTOR Education Your Life--busi620mentor
thomashard44265 views
BUSI 620 MENTOR Education Planning--busi620mentor.com by agathachristie298
BUSI 620 MENTOR Education Planning--busi620mentor.comBUSI 620 MENTOR Education Planning--busi620mentor.com
BUSI 620 MENTOR Education Planning--busi620mentor.com
agathachristie298214 views
Apple Inc. An American Multinational Organization Essay by Jenny Mancini
Apple Inc. An American Multinational Organization EssayApple Inc. An American Multinational Organization Essay
Apple Inc. An American Multinational Organization Essay
Jenny Mancini2 views
Chapter One Powerpoint by MrRed
Chapter One PowerpointChapter One Powerpoint
Chapter One Powerpoint
MrRed1.7K views
BUSI 620 Inspiring Innovation/tutorialrank.com by jonhson108
 BUSI 620 Inspiring Innovation/tutorialrank.com BUSI 620 Inspiring Innovation/tutorialrank.com
BUSI 620 Inspiring Innovation/tutorialrank.com
jonhson10832 views
Busi 620 Enhance teaching / snaptutorial.com by HarrisGeorg50
Busi 620  Enhance teaching / snaptutorial.comBusi 620  Enhance teaching / snaptutorial.com
Busi 620 Enhance teaching / snaptutorial.com
HarrisGeorg5028 views
Innovators &amp; Innovation by DD D
Innovators &amp; InnovationInnovators &amp; Innovation
Innovators &amp; Innovation
DD D470 views

More from Maxim Salnikov

ChatGPT and not only: how can you use the power of Generative AI at scale by
ChatGPT and not only: how can you use the power of Generative AI at scaleChatGPT and not only: how can you use the power of Generative AI at scale
ChatGPT and not only: how can you use the power of Generative AI at scaleMaxim Salnikov
37 views42 slides
Using the power of OpenAI with your own data: what's possible and how to start? by
Using the power of OpenAI with your own data: what's possible and how to start?Using the power of OpenAI with your own data: what's possible and how to start?
Using the power of OpenAI with your own data: what's possible and how to start?Maxim Salnikov
56 views38 slides
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel... by
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...Maxim Salnikov
32 views23 slides
ChatGPT and not only: How to use the power of GPT-X models at scale by
ChatGPT and not only: How to use the power of GPT-X models at scaleChatGPT and not only: How to use the power of GPT-X models at scale
ChatGPT and not only: How to use the power of GPT-X models at scaleMaxim Salnikov
87 views32 slides
How Azure helps to build better business processes and customer experiences w... by
How Azure helps to build better business processes and customer experiences w...How Azure helps to build better business processes and customer experiences w...
How Azure helps to build better business processes and customer experiences w...Maxim Salnikov
79 views24 slides
The Status of Angular v13 by
The Status of Angular v13The Status of Angular v13
The Status of Angular v13Maxim Salnikov
101 views35 slides

More from Maxim Salnikov(11)

ChatGPT and not only: how can you use the power of Generative AI at scale by Maxim Salnikov
ChatGPT and not only: how can you use the power of Generative AI at scaleChatGPT and not only: how can you use the power of Generative AI at scale
ChatGPT and not only: how can you use the power of Generative AI at scale
Maxim Salnikov37 views
Using the power of OpenAI with your own data: what's possible and how to start? by Maxim Salnikov
Using the power of OpenAI with your own data: what's possible and how to start?Using the power of OpenAI with your own data: what's possible and how to start?
Using the power of OpenAI with your own data: what's possible and how to start?
Maxim Salnikov56 views
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel... by Maxim Salnikov
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
Maxim Salnikov32 views
ChatGPT and not only: How to use the power of GPT-X models at scale by Maxim Salnikov
ChatGPT and not only: How to use the power of GPT-X models at scaleChatGPT and not only: How to use the power of GPT-X models at scale
ChatGPT and not only: How to use the power of GPT-X models at scale
Maxim Salnikov87 views
How Azure helps to build better business processes and customer experiences w... by Maxim Salnikov
How Azure helps to build better business processes and customer experiences w...How Azure helps to build better business processes and customer experiences w...
How Azure helps to build better business processes and customer experiences w...
Maxim Salnikov79 views
Azure cloud for the web frontend developers by Maxim Salnikov
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developers
Maxim Salnikov75 views
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего... by Maxim Salnikov
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
Maxim Salnikov309 views
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт by Maxim Salnikov
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
Maxim Salnikov224 views
Securing Connected Cars Requires Digital Identity by Maxim Salnikov
Securing Connected Cars Requires Digital IdentitySecuring Connected Cars Requires Digital Identity
Securing Connected Cars Requires Digital Identity
Maxim Salnikov189 views
How to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects by Maxim Salnikov
How to Make Your IoT Devices Secure, Act Autonomously & Trusted SubjectsHow to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
How to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
Maxim Salnikov139 views

Recently uploaded

STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdfDr. Jimmy Schwarzkopf
19 views29 slides
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...Bernd Ruecker
37 views69 slides
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院IttrainingIttraining
52 views8 slides
handbook for web 3 adoption.pdf by
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdfLiveplex
22 views16 slides
The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
127 views24 slides
20231123_Camunda Meetup Vienna.pdf by
20231123_Camunda Meetup Vienna.pdf20231123_Camunda Meetup Vienna.pdf
20231123_Camunda Meetup Vienna.pdfPhactum Softwareentwicklung GmbH
41 views73 slides

Recently uploaded(20)

STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker37 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex22 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman33 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi127 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta26 views
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views

Prompt Engineering - an Art, a Science, or your next Job Title?

  • 1. Prompt Engineering - an Art, a Science, or your next Job Title? Maxim Salnikov Developer Productivity Lead Microsoft
  • 2. • Building on web platform since 90s • Organizing developer communities and technical conferences • Speaking, training, blogging: Webdev, Cloud, OpenAI Helping developers to succeed with the Cloud & AI technology I’m Maxim Salnikov
  • 3. • Generative AI’s impact on productivity could add up to $4.4 trillion annually in value to the global economy. • About 75% of the value that generative AI use cases could deliver falls across customer operations, marketing, sales, software engineering, and R&D . • Generative AI can revolutionize work by automating a significant portion of employees' activities, up to 60- 70% of their current workload. This augmentation of individual capabilities has the potential to transform the way we work.
  • 4. Artificial Intelligence 1956 Artificial Intelligence The field of computer science that seeks to create intelligent machines that can replicate or exceed human intelligence Machine Learning 1997 Machine Learning Subset of AI that enables machines to learn from existing data and improve upon that data to make decisions or predictions Deep Learning 2017 Deep Learning A machine learning technique in which layers of neural networks are used to process data and make decisions Generative AI 2021 Generative AI powered by foundation models Create new written, visual, and auditory content given prompts or existing data
  • 5. Path to impact and usecases Source: IDC, IDC PlanScape: Developing Your Path to Impact with Generative AI, #US51157323
  • 6. Emerging model landscape • OpenAI's GPT2, ChatGPT, GPT-3, GPT3.5, GPT4.0 (language) DALL-E 2 (image), and Whisper (speech) • Stability.ai's Stable Diffusion (image) • Midjourney (image) • Google's PaLM, PaLM2, LaMDA, Minerva, UL2, Bard (language), and Imagen (image) • Google/DeepMind's Chinchilla, Retro-7B, AlphaCode (language), Flamingo, and Gato (multimodal) • Meta's LLaMa, NLLB, OPT-175B, Sparse all-MLP (language), Make-a-Video (video), and data2vec (multimodal) • Microsoft's DeepNet (language) and MetaLM (multimodal) • BigScience's BLOOM (language) • AI21 Labs' Jurassic-X (language) • Dolly 2.0 (language) • …
  • 8. Prompt Engineering Process of designing, refining, and optimizing input prompts to guide a model toward producing more accurate outputs while keeping cost efficiency
  • 9. Prompt anatomy < Write a product launch email for new headphones. This product is AI-powered and priced at $79.99. The tone is friendly and exciting. Output as a JSON object with "subject" and "body" fields. Example: { "subject": "Introducing Our New AI-Powered Headphones!", "body": "We are thrilled to announce the launch of our new AI- powered headphones" } Output: Instruction Input data Context Target format Example Cue <
  • 11. Prompts and cost efficiency • Prompt and completion length • Number of API calls in production • Number of API calls during development (experimentation stage) • Type of deployed model Model selection strategy: Start with heaviest models and gradually ramp down to cheaper ones while the result is satisfactory
  • 12. • • Tokens can sometimes be counter-intuitive • Tabular data is space-efficient Space efficiency
  • 13. General recommendations • Be specific • Order matters • Double down • Give the model an “out”
  • 14. Technical recommendations • Start with clear instructions and repeat the instructions at the end • Add clear syntax: headers, separators • Break the task down • Adjust parameters: Temperature and Top probabilities
  • 15. Zero-shot VS few-shot prompts Zero-shot The model predicts the answer given only a natural language description of the task. Few-shot In addition to the task description, the model sees a few examples of the task. Customer question: Hi there, do you know how to choose flood insurance?​ Classified topic: 2​ Customer question: Hi there, I have a question on my auto insurance.​ Classified topic: 1​ Classify customer's question. Classify between category 1 to 3. Detailed guidelines for how to choose: choose 1 if the question is about auto insurance. choose 2 if the question is about home flood insurance. choose 3 if the question is not relevant to insurance. Classify customer's question. Classify between category 1 to 3. Detailed guidelines for how to choose: choose 1 if the question is about auto insurance. choose 2 if the question is about home flood insurance. choose 3 if the question is not relevant to insurance. Customer question: {insert new question here} Classified topic: Customer question: What packages do you have in auto insurance? Classified topic:
  • 16. Zero Shot - Reasoning Before What is the annual water demand of a single-family household containing four people who are at home an average of 200 days per year and use an average of 100 liters of water per day? The annual water demand of a single-family household containing four people who are at home an average of 200 days per year and use an average of 100 liters of water per day is 8,000,000 liters per year. After What is the annual water demand of a single-family household containing four people who are at home an average of 200 days per year and use an average of 100 liters of water per day? Let’s think step by step and explain the calculation step by step. Step 1: Calculate the total number of days in a year: There are 365 days in a year. Step 2: Calculate the total number of days the family is at home: The family is at home an average of 200 days per year. Step 3: Calculate the total water demand of the family: The family uses an average of 100 liters of water per day. Therefore, the total water demand of the family is 100 liters x 200 days = 20,000 liters per year. Step 4: Calculate the annual water demand of the single-family household: The annual water demand of the single-family household is 20,000 liters per year.
  • 17. Few Shot Reasoning – Example 1 1st prompt Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? Answer: The answer is 11. The cafeteria has 23 apples. If they used 20 to make lunch and bought 6 more, how many do they have? The answer is 27 2nd prompt—provide reasoning Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? Answer: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5+6 = 11. The answer is 11. The cafeteria has 23 apples. If they used 20 to make lunch and bought 6 more, how many do they have? The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23-20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9.
  • 18. Prompt Chaining Entity Extraction Please extract entities from the following news article: 'The new iPhone model is set to be released next month. It has been highly anticipated by Apple fans and is expected to feature a larger screen and improved camera {'text': 'iPhone', 'type’: 'PRODUCT'}, {'text': 'Apple’, 'type': 'ORGANIZATION'}] Summarization Please summarize the information about the product [{'text': 'iPhone', 'type': 'PRODUCT'}, {'text': 'Apple', 'type': 'ORGANIZATION’}] The iPhone is a line of smartphones designed and marketed by Apple Inc. These devices combine a computer, camera, and internet connectivity in a single device, and are known for their sleek design and user-friendly interface. Sentiment Analysis Please provide a sentiment for the following text: The iPhone is a line of smartphones designed and marketed by Apple Inc. These devices combine a computer, camera, and internet connectivity in a single device, and are known for their sleek design and user-friendly interface. Positive
  • 19. Few Shot Reasoning – Example 2 1st prompt—Reason Extraction On average Joe throws 25 punches per minute. A fight lasts 5 rounds of 3 minutes. How many punches did he throw? Let’s think step by step and explain the calculation step by step. In one minute, Joe throws 25 punches. In three minutes, Joe throws 3 * 25 = 75 punches. In five rounds, Joe throws 5*75 = 375 punches. 2nd prompt—Answer Extraction One average Joe throws 25 punches per minute. A fight lasts 5 rounds of 3 minutes. How many punches did he throw? In one minute, Joe throws 25 punches. In three minutes, Joe throws 3 * 25 = 75 punches. In five rounds, Joe throws 5*75 = 375 punches. The cafeteria has 23 apples. If they used 20 to make lunch and bought 6 more, how many do they have? Therefore, the answer (Arabic numerals) is The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23-20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9.
  • 20. Prompt Chunking (token limit) Large Text Beyond Token Limit Chunks Please summarize and extract topic: Global warming refers to the gradual increase in the overall temperature of the Earth's atmosphere, primarily caused by the burning of fossil fuels such as coal, oil, and natural gas. This burning releases carbon dioxide and other greenhouse gases into the atmosphere, which trap heat and cause the Earth's temperature to rise. Climate change is a pressing issue that needs to be addressed immediately. Governments around the world need to take immediate action to reduce carbon emissions and invest in renewable energy sources. Failure to do so will have dire consequences for future generations The text is discussing global warming, which is the gradual increase in the overall temperature of the Earth's atmosphere caused by the burning of fossil fuels. This burning releases greenhouse gases, such as carbon dioxide, into the atmosphere which trap heat and cause the temperature to rise. The text also highlights the urgency of the issue of climate change and the need for governments to take action to reduce carbon emissions and invest in renewable energy sources. Failure to address this issue will have negative consequences for future generations. Topic: Climate change and Global warming. Continue to next prompt Please summarize the following text: 'Climate change is a pressing issue that needs to be addressed immediately. The increasing levels of carbon dioxide in the atmosphere are causing the Earth's temperature to rise, which is leading to more frequent and severe natural disasters. Governments around the world need to take immediate action to reduce carbon emissions and invest in renewable energy sources. Failure to do so will have dire consequences for future generations'" Climate change is a pressing issue that needs to be addressed immediately. Governments around the world need to take immediate action to reduce carbon emissions and invest in renewable energy sources. Failure to do so will have dire consequences for future generations Then all summaries are passed to GPT again to summarize, i.e. second round of summarization. The sum of the summaries has to fit within the token limit.
  • 21. Retrieval Augmented Generation (RAG) Extract precise answers from your unstructured documents with Azure OpenAI + Cognitive Search: article + repo https://learn.microsoft.com/en-us/azure/search/retrieval-augmented-generation-overview
  • 23. App or Copilot agent API & SDK Azure OpenAI Service on your data Data Sources (search, files, databases, storage etc.) Additional 3P Data Sources (files, databases, storage data etc.) Recently Announced Azure OpenAI Service on your data https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/use-your-data
  • 25. Prompt Flow – streamline dev cycle of LLM-based apps https://github.com/microsoft/promptflow
  • 26. Learning resources • Learn Prompting Community • Prompting Guide by DAIR.AI • Prompt Engineering for the developers on Deep Learning • Prompt Examples on OpenAI • Introduction to Prompt Engineering on Microsoft Learn