Holland & Barrett: Gen AI Prompt Engineering for Tech teams

Dobo Radichkov
Dobo RadichkovSr. Director, OLX Ventures at OLX Group
GenAI <> Tech
Focus on OpenAI ecosystem
Dobo Radichkov
20231109
3
OpenAI ecosystem
▪ GPT-3.5-Turbo
▪ GPT-4
▪ GPT-4-Turbo
Text à Text
Other
Text & Image à Text Text à Image
Speech ⟷ Text Chat
▪ Text à Speech:
– TTS-1
– TTS-1-HD
▪ Speech à Text: Whisper
▪ GPT-4-Vision ▪ DALLl-E-3
▪ DALLl-E-2
▪ ChatGPT web & native apps
▪ GPTs
▪ Assistants API (with retrieval
and code interpreter)
▪ Embedding models: Ada-002
▪ Moderation models
▪ Base models
▪ Legacy models
4
OpenAI ecosystem
▪ GPT-3.5-Turbo
▪ GPT-4
▪ GPT-4-Turbo
Text à Text
Other
Text & Image à Text Text à Image
Speech ⟷ Text Chat
▪ Text à Speech:
– TTS-1
– TTS-1-HD
▪ Sppech à Text: Whisper
▪ GPT-4-Vision ▪ DALLl-E-3
▪ DALLl-E-2
▪ ChatGPT web & native apps
▪ GPTs
▪ Assistants API (with retrieval,
function calling, code
interpreter)
▪ Embedding models: Ada-002
▪ Moderation models
▪ Base models
▪ Legacy models
Today’s focus
5
DIY vs Off-the-shelf?
Short-
term
Long-
term
Effort High Low
Cost High Low
AI skills High
Short-
term
Long-
term
Effort Low Low
Cost Low High
AI skills Low
Prompt Engineering Optimise output through prompt
engineering techniques
Retrieval Augmented
Generation (RAG)
Boost performance with additional
context (usually based on semantic
search enabled by Vector DBs)
Parameter-Efficient
Fine-Tuning (PEFT)
Fine-tune subset of an existing
FM with domain-specific examples
Full Fine-Tuning Fine-tune entire FM
with domain-specific examples
Full Training (build
your own FM)
Start from scratch
6
DIY vs Off-the-shelf?
Short-
term
Long-
term
Effort High Low
Cost High Low
AI skills High
Short-
term
Long-
term
Effort Low Low
Cost Low High
AI skills Low
Prompt Engineering
Retrieval Augmented
Generation (RAG)
Parameter-Efficient
Fine-Tuning (PEFT)
Full Fine-Tuning
Full Training (build
your own FM)
Optimise output through prompt
engineering techniques
Boost performance with additional
context (usually based on semantic
search enabled by Vector DBs)
Fine-tune subset of an existing
FM with domain-specific examples
Fine-tune entire FM
with domain-specific examples
Start from scratch
Start
here!
7
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Examples
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
8
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
With persona
System You are a chemist professor skilled at explaining chemistry concepts to a first-grader.
Respond in 50 words.
User What is a molecule?
Assistant A molecule is like a tiny building block that's super, super small. You can't see it, but it's there!
Lots of these tiny blocks stick together to make everything around us, like water, air, and even
you! They are like the pieces of a puzzle that make up everything.
Without persona
System Respond in 50 words.
User What is a molecule?
Assistant A molecule is the smallest unit of a chemical compound that can exist while retaining the
chemical properties of that compound. It is composed of two or more atoms bonded together
through shared electrons, forming a stable structure that participates in chemical reactions.
9
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Using triple quotes (or similar)
System You are a Japanese poet always responding with Haikus
User Summarize the text delimited by triple quotes with a haiku
”””
A molecule is like a tiny building block that's super, super small. You can't see it, but it's there! Lots of
these tiny blocks stick together to make everything around us, like water, air, and even you! They are like
the pieces of a puzzle that make up everything.
”””
Assistant Blocks unseen, so small,
Bind to shape the world we know,
Puzzle of life's sprawl.
Using XML
User You are given an article delimited by <ARTICLE></ARTICLE> tags and a mood delimited by
<MOOD></MOOD> tags.
Your task is to rewrite the article in the style of the mood. Respond with plain text in 50 words.
<ARTICLE>A molecule is like a tiny building block that's super, super small. You can't see it, but it's there!
Lots of these tiny blocks stick together to make everything around us, like water, air, and even you! They
are like the pieces of a puzzle that make up everything.
</ARTICLE>
<MOOD>flabbergasted</MOOD>
Assistant A molecule, imagine this, is an astonishingly minuscule building block—so diminutive, it's invisible! Yet, it's
the cornerstone of existence! These specks congregate to conjure, well, everything! Water, air, our very
beings! Astoundingly, they're the enigmatic fragments that seamlessly assemble the grand tapestry of
reality. Unbelievable!
10
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Text processing steps
User You are given text delimited by triple quotes.
Step 1 - Summarize the text in 1 sentence
Step 2- Translate the text to Bulgarian
Step 3 - Write a question whose answer is the output from step 2
Step 4 - Respond with the question and the answer delimited by new line
"""
A molecule, imagine this, is an astonishingly minuscule building block—so diminutive, it's invisible! Yet, it's
the cornerstone of existence! These specks congregate to conjure, well, everything! Water, air, our very
beings! Astoundingly, they're the enigmatic fragments that seamlessly assemble the grand tapestry of
reality. Unbelievable!
"""
Assistant Step 1 - Summarize the text in 1 sentence:
Molecules are incredibly small yet fundamental components that make up all aspects of reality.
Step 2 - Translate the text to Bulgarian:
Молекулите са невероятно малки, но основни компоненти, които съставят всички аспекти на
реалността.
Step 3 - Write a question whose answer is the output from step 2:
Как бихте описали молекулите в едно изречение на български език?
Step 4 - Respond with the question and the answer delimited by new line:
Как бихте описали молекулите в едно изречение на български език?
Молекулите са невероятно малки, но основни компоненти, които съставят всички аспекти на
реалността.
11
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
One-shot
User Summarise the topic and mood of a piece of text.
Examples:
"""
A molecule, imagine this, is an astonishingly minuscule building block—so diminutive, it's invisible! Yet, it's
the cornerstone of existence! These specks congregate to conjure, well, everything! Water, air, our very
beings! Astoundingly, they're the enigmatic fragments that seamlessly assemble the grand tapestry of
reality. Unbelievable!
"""
Topic: Molecules
Mood: Amazement
"""
The new OpenAI features released on Dev Day this week are awesome. I look forward to trying out
assistants, JSON response and the new GPT-4V model!
"""
Assistant Topic: OpenAI's new features
Mood: Enthusiasm
Tip: For simple outputs, gpt-3.5-turbo with one or two examples
can typically match gpt-4 performance for 3% of the cost
12
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Confluence article as context
User Answer the question enclosed in <QUESTION></QUESTION> tags in 50 words using the provided context
enclosed in <CONTEXT></CONTEXT>.
<CONTEXT>
(... Inventory valuation Confluence page omitted ...)
</CONTEXT>
<QUESTION>
How long would it take to build this capability with a small data team of data warehousing and data
engineering specialists?
</QUESTION>
Assistant The timeline to build this inventory valuation and COGS reporting system with a small data team would
vary based on team expertise, requirements complexity, and unforeseen challenges. Typically, such a
project could take several months to over a year.
13
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Work out solution independently and verify
System First work out your own solution to the problem. Then compare your solution to the student's solution and
evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you
have done the problem yourself.
User Problem Statement: I'm building a solar power installation and I need help working out the financials.
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 /
square foot
What is the total cost for the first year of operations as a function of the number of square feet.
Student's Solution: Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x
Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000
Assistant
Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 10x
Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000
The student's solution is incorrect. They made an error in the maintenance cost calculation, using 100x
instead of 10x. The correct total cost for the first year of operations is 360x + 100,000.
14
Prompt
Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Separate workings and explanation from final answer
System First work out your own solution to the problem. Then compare your solution to the student's solution and
evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you
have done the problem yourself.
Enclose your workings in <WORKINGS></WORKINGS>
Enclose your final answer in <ANSWER></ANSWER>
Enclose any additional explanation in <EXPLANATION></EXPLANATION>
User Problem Statement: I'm building a solar power installation and I need help working out the financials.
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 /
square foot
What is the total cost for the first year of operations as a function of the number of square feet.
Student's Solution: Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x
Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000
Assistant <WORKINGS>
Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 10x
Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000
</WORKINGS>
<ANSWER>
The student's solution is incorrect.
</ANSWER>
<EXPLANATION>
The student made a mistake in calculating the maintenance cost. The maintenance cost is $100,000 plus
$10 per square foot, not $100 per square foot. Therefore, the total cost should be 360x + 100,000, not 450x
+ 100,000.
</EXPLANATION>
15
Prompt Engineering
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Respond with pre-defined JSON schema
System First work out your own solution to the problem. Then compare your solution to the student's solution and
evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you
have done the problem yourself.
Respond strictly with a JSON object, with 3 keys:
- workings, for your workings
- answer, for your final answer indicating correctness,
- explanation, for any additional explanations (optional)
User Problem Statement: I'm building a solar power installation and I need help working out the financials.
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 /
square foot
What is the total cost for the first year of operations as a function of the number of square feet.
Student's Solution: Let x be the size of the installation in square feet.
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x
Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000
Assistant {
"workings": "Let x be the size of the installation in square feet. n1. Land cost: 100x n2. Solar panel cost:
250x n3. Maintenance cost: 100,000 + 10x nTotal cost: 100x + 250x + 100,000 + 10x = 360x + 100,000",
"answer": "Incorrect",
"explanation": "The student incorrectly calculated the maintenance cost. The maintenance cost is $10 per
square foot, not $100. Therefore, the total cost should be 360x + 100,000, not 450x + 100,000."
}
16
Prompt Engineering
▪ Call external function based on model
output (model generates function
signature)
▪ Integrate function response back into
next model prompt
Adopt Persona
Delimiters
Step-by-step Instructions
One/Few-shot Learning
Additional Context
Give time to “think”
Inner monologue
JSON response
External tools
Function calling Retrieval
▪ Perform semantic search of user input
against a Vector database
▪ Inject search results into prompt to
further contextualise prompt
Prompt 1 Prompt 2
External
function
Prompt 1
Vector DB
Function
signature
Function
response
User
input Additional
relevant
context
Output Output
Retrieval Augmented
Generation (RAG)
17
Retrieval Augmented Generation (RAG)
Use OpenAI ADA-2
as embedding model
18
VectorDB recommendation: pg_vector extension for
Aurora PgSQL (AWS released this over the Summer)
19
Which GPT model do I use?
Note: Assume 500 input and 500 output tokens
gpt-3.5-turbo gpt-4 / gpt-4-turbo
Response
quality
Medium – can be partially mitigated with
few-shot learning
High
Speed Slow – ~100 tokens / sec
5x faster vs gpt-4!
Very slow – ~20 tokens / sec
Cost High – $1.5 / 1000 prompts*
15-30x cheaper vs gpt-4!
Very high –
• $20 / 1000 prompts* (gpt-4-turbo)
• $45 / 1000 prompts* (gpt-4)
Use for • Simple instructions
• Simple outputs
• Basic reasoning
• Simple chat responses
• Simple JSON outputs
• Complex instructions
• Complex outputs
• Advanced reasoning
• High-quality chat responses
• Complex JSON outputs
• Multi-modal inputs (images / text)
1 of 18

Recommended

JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue" by
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JSFestUA
293 views57 slides
FinalReport by
FinalReportFinalReport
FinalReportVinh Xuan Ho
138 views4 slides
A class action by
A class actionA class action
A class actionLuciano Colosio
800 views49 slides
Final project by
Final project Final project
Final project tsyun
180 views7 slides
Chemistry 121 - Chemistry in the Modern WorldWeekly Worksheet .docx by
Chemistry 121 - Chemistry in the Modern WorldWeekly Worksheet .docxChemistry 121 - Chemistry in the Modern WorldWeekly Worksheet .docx
Chemistry 121 - Chemistry in the Modern WorldWeekly Worksheet .docxedward6king79409
4 views15 slides
A Research Proposal On Kanaka Raju Pandiri by
A Research Proposal On Kanaka Raju PandiriA Research Proposal On Kanaka Raju Pandiri
A Research Proposal On Kanaka Raju PandiriNicole Gomez
3 views80 slides

More Related Content

Similar to Holland & Barrett: Gen AI Prompt Engineering for Tech teams

Adaptive technologies by
Adaptive technologiesAdaptive technologies
Adaptive technologiesMaina WaGĩokõ
413 views62 slides
GoF Design patterns I: Introduction + Structural Patterns by
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
3.1K views38 slides
Assignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docx by
Assignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docxAssignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docx
Assignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docxssuser562afc1
2 views37 slides
Ed techjoker faculty presentation by
Ed techjoker faculty presentationEd techjoker faculty presentation
Ed techjoker faculty presentationbtopro
214 views114 slides
Large Components in the Rearview Mirror by
Large Components in the Rearview MirrorLarge Components in the Rearview Mirror
Large Components in the Rearview MirrorMichelle Brush
105 views146 slides
Principled io in_scala_2019_distribution by
Principled io in_scala_2019_distributionPrincipled io in_scala_2019_distribution
Principled io in_scala_2019_distributionRaymond Tay
156 views19 slides

Similar to Holland & Barrett: Gen AI Prompt Engineering for Tech teams(20)

GoF Design patterns I: Introduction + Structural Patterns by Sameh Deabes
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
Sameh Deabes3.1K views
Assignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docx by ssuser562afc1
Assignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docxAssignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docx
Assignment- Week 3 - Assignment 1CourseINF690 INF690 ISS Caps.docx
ssuser562afc12 views
Ed techjoker faculty presentation by btopro
Ed techjoker faculty presentationEd techjoker faculty presentation
Ed techjoker faculty presentation
btopro214 views
Large Components in the Rearview Mirror by Michelle Brush
Large Components in the Rearview MirrorLarge Components in the Rearview Mirror
Large Components in the Rearview Mirror
Michelle Brush105 views
Principled io in_scala_2019_distribution by Raymond Tay
Principled io in_scala_2019_distributionPrincipled io in_scala_2019_distribution
Principled io in_scala_2019_distribution
Raymond Tay156 views
Kernel Development: Drawing Lessons from "Mistakes" (Japan Linux Symposium 2009) by Toshiharu Harada, Ph.D
Kernel Development: Drawing Lessons from "Mistakes" (Japan Linux Symposium 2009)Kernel Development: Drawing Lessons from "Mistakes" (Japan Linux Symposium 2009)
Kernel Development: Drawing Lessons from "Mistakes" (Japan Linux Symposium 2009)
John P. Uyemura - Cmos Logic Circuit Design (1999, Springer) - libgen.lc.pdf by Yashwant Srikrishnan
John P. Uyemura - Cmos Logic Circuit Design (1999, Springer) - libgen.lc.pdfJohn P. Uyemura - Cmos Logic Circuit Design (1999, Springer) - libgen.lc.pdf
John P. Uyemura - Cmos Logic Circuit Design (1999, Springer) - libgen.lc.pdf
Deep Learning for Natural Language Processing by Jonathan Mugan
Deep Learning for Natural Language ProcessingDeep Learning for Natural Language Processing
Deep Learning for Natural Language Processing
Jonathan Mugan5K views
Using construction grammar in conversational systems by CJ Jenkins
Using construction grammar in conversational systemsUsing construction grammar in conversational systems
Using construction grammar in conversational systems
CJ Jenkins2.7K views
Building Fast, Modern Web Applications with Node.js and CoffeeScript by royaldark
Building Fast, Modern Web Applications with Node.js and CoffeeScriptBuilding Fast, Modern Web Applications with Node.js and CoffeeScript
Building Fast, Modern Web Applications with Node.js and CoffeeScript
royaldark9.5K views
object oriented programming(syed munib ali 11b-023-bs) by munibali55
object oriented programming(syed munib ali 11b-023-bs)object oriented programming(syed munib ali 11b-023-bs)
object oriented programming(syed munib ali 11b-023-bs)
munibali55270 views
Functional Programming with Immutable Data Structures by elliando dias
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
elliando dias4.8K views
Entity Component Systems by Yos Riady
Entity Component SystemsEntity Component Systems
Entity Component Systems
Yos Riady1.3K views
Deep Learning with Python (PyData Seattle 2015) by Alexander Korbonits
Deep Learning with Python (PyData Seattle 2015)Deep Learning with Python (PyData Seattle 2015)
Deep Learning with Python (PyData Seattle 2015)
Alexander Korbonits22.8K views
Introduction to Design Patterns and Singleton by Jonathan Simon
Introduction to Design Patterns and SingletonIntroduction to Design Patterns and Singleton
Introduction to Design Patterns and Singleton
Jonathan Simon5.7K views

More from Dobo Radichkov

Unleashing the Power of GPT & LLM: A Holland & Barrett Exploration by
Unleashing the Power of GPT & LLM: A Holland & Barrett ExplorationUnleashing the Power of GPT & LLM: A Holland & Barrett Exploration
Unleashing the Power of GPT & LLM: A Holland & Barrett ExplorationDobo Radichkov
133 views18 slides
Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl... by
Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl...Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl...
Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl...Dobo Radichkov
184 views14 slides
Customer lifecycle management for fun and profit at OLX, Berlin marketplace c... by
Customer lifecycle management for fun and profit at OLX, Berlin marketplace c...Customer lifecycle management for fun and profit at OLX, Berlin marketplace c...
Customer lifecycle management for fun and profit at OLX, Berlin marketplace c...Dobo Radichkov
1.3K views34 slides
OLX Ventures blockchain perspective, Feb 2018 by
OLX Ventures blockchain perspective, Feb 2018OLX Ventures blockchain perspective, Feb 2018
OLX Ventures blockchain perspective, Feb 2018Dobo Radichkov
707 views45 slides
Real-time serverless analytics at Shedd – OLX data summit, Mar 2018, Barcelona by
Real-time serverless analytics at Shedd – OLX data summit, Mar 2018, BarcelonaReal-time serverless analytics at Shedd – OLX data summit, Mar 2018, Barcelona
Real-time serverless analytics at Shedd – OLX data summit, Mar 2018, BarcelonaDobo Radichkov
473 views40 slides
OLX Group presentation for AWS Redshift meetup in London, 5 July 2017 by
OLX Group presentation for AWS Redshift meetup in London, 5 July 2017OLX Group presentation for AWS Redshift meetup in London, 5 July 2017
OLX Group presentation for AWS Redshift meetup in London, 5 July 2017Dobo Radichkov
4.8K views114 slides

More from Dobo Radichkov(6)

Unleashing the Power of GPT & LLM: A Holland & Barrett Exploration by Dobo Radichkov
Unleashing the Power of GPT & LLM: A Holland & Barrett ExplorationUnleashing the Power of GPT & LLM: A Holland & Barrett Exploration
Unleashing the Power of GPT & LLM: A Holland & Barrett Exploration
Dobo Radichkov133 views
Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl... by Dobo Radichkov
Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl...Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl...
Data and Analytics at Holland & Barrett: Building a '3-Michelin-star' Data Pl...
Dobo Radichkov184 views
Customer lifecycle management for fun and profit at OLX, Berlin marketplace c... by Dobo Radichkov
Customer lifecycle management for fun and profit at OLX, Berlin marketplace c...Customer lifecycle management for fun and profit at OLX, Berlin marketplace c...
Customer lifecycle management for fun and profit at OLX, Berlin marketplace c...
Dobo Radichkov1.3K views
OLX Ventures blockchain perspective, Feb 2018 by Dobo Radichkov
OLX Ventures blockchain perspective, Feb 2018OLX Ventures blockchain perspective, Feb 2018
OLX Ventures blockchain perspective, Feb 2018
Dobo Radichkov707 views
Real-time serverless analytics at Shedd – OLX data summit, Mar 2018, Barcelona by Dobo Radichkov
Real-time serverless analytics at Shedd – OLX data summit, Mar 2018, BarcelonaReal-time serverless analytics at Shedd – OLX data summit, Mar 2018, Barcelona
Real-time serverless analytics at Shedd – OLX data summit, Mar 2018, Barcelona
Dobo Radichkov473 views
OLX Group presentation for AWS Redshift meetup in London, 5 July 2017 by Dobo Radichkov
OLX Group presentation for AWS Redshift meetup in London, 5 July 2017OLX Group presentation for AWS Redshift meetup in London, 5 July 2017
OLX Group presentation for AWS Redshift meetup in London, 5 July 2017
Dobo Radichkov4.8K views

Recently uploaded

Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
61 views21 slides
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueShapeBlue
93 views15 slides
The Role of Patterns in the Era of Large Language Models by
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language ModelsYunyao Li
80 views65 slides
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
197 views13 slides
Business Analyst Series 2023 - Week 4 Session 7 by
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7DianaGray10
126 views31 slides
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...ShapeBlue
138 views18 slides

Recently uploaded(20)

CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue93 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li80 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue197 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10126 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue138 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue103 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue140 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue163 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays53 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue144 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue117 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue88 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue120 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty62 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue181 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue123 views
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
ShapeBlue94 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue79 views

Holland & Barrett: Gen AI Prompt Engineering for Tech teams

  • 1. GenAI <> Tech Focus on OpenAI ecosystem Dobo Radichkov 20231109
  • 2. 3 OpenAI ecosystem ▪ GPT-3.5-Turbo ▪ GPT-4 ▪ GPT-4-Turbo Text à Text Other Text & Image à Text Text à Image Speech ⟷ Text Chat ▪ Text à Speech: – TTS-1 – TTS-1-HD ▪ Speech à Text: Whisper ▪ GPT-4-Vision ▪ DALLl-E-3 ▪ DALLl-E-2 ▪ ChatGPT web & native apps ▪ GPTs ▪ Assistants API (with retrieval and code interpreter) ▪ Embedding models: Ada-002 ▪ Moderation models ▪ Base models ▪ Legacy models
  • 3. 4 OpenAI ecosystem ▪ GPT-3.5-Turbo ▪ GPT-4 ▪ GPT-4-Turbo Text à Text Other Text & Image à Text Text à Image Speech ⟷ Text Chat ▪ Text à Speech: – TTS-1 – TTS-1-HD ▪ Sppech à Text: Whisper ▪ GPT-4-Vision ▪ DALLl-E-3 ▪ DALLl-E-2 ▪ ChatGPT web & native apps ▪ GPTs ▪ Assistants API (with retrieval, function calling, code interpreter) ▪ Embedding models: Ada-002 ▪ Moderation models ▪ Base models ▪ Legacy models Today’s focus
  • 4. 5 DIY vs Off-the-shelf? Short- term Long- term Effort High Low Cost High Low AI skills High Short- term Long- term Effort Low Low Cost Low High AI skills Low Prompt Engineering Optimise output through prompt engineering techniques Retrieval Augmented Generation (RAG) Boost performance with additional context (usually based on semantic search enabled by Vector DBs) Parameter-Efficient Fine-Tuning (PEFT) Fine-tune subset of an existing FM with domain-specific examples Full Fine-Tuning Fine-tune entire FM with domain-specific examples Full Training (build your own FM) Start from scratch
  • 5. 6 DIY vs Off-the-shelf? Short- term Long- term Effort High Low Cost High Low AI skills High Short- term Long- term Effort Low Low Cost Low High AI skills Low Prompt Engineering Retrieval Augmented Generation (RAG) Parameter-Efficient Fine-Tuning (PEFT) Full Fine-Tuning Full Training (build your own FM) Optimise output through prompt engineering techniques Boost performance with additional context (usually based on semantic search enabled by Vector DBs) Fine-tune subset of an existing FM with domain-specific examples Fine-tune entire FM with domain-specific examples Start from scratch Start here!
  • 6. 7 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Examples Additional Context Give time to “think” Inner monologue JSON response External tools
  • 7. 8 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools With persona System You are a chemist professor skilled at explaining chemistry concepts to a first-grader. Respond in 50 words. User What is a molecule? Assistant A molecule is like a tiny building block that's super, super small. You can't see it, but it's there! Lots of these tiny blocks stick together to make everything around us, like water, air, and even you! They are like the pieces of a puzzle that make up everything. Without persona System Respond in 50 words. User What is a molecule? Assistant A molecule is the smallest unit of a chemical compound that can exist while retaining the chemical properties of that compound. It is composed of two or more atoms bonded together through shared electrons, forming a stable structure that participates in chemical reactions.
  • 8. 9 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Using triple quotes (or similar) System You are a Japanese poet always responding with Haikus User Summarize the text delimited by triple quotes with a haiku ””” A molecule is like a tiny building block that's super, super small. You can't see it, but it's there! Lots of these tiny blocks stick together to make everything around us, like water, air, and even you! They are like the pieces of a puzzle that make up everything. ””” Assistant Blocks unseen, so small, Bind to shape the world we know, Puzzle of life's sprawl. Using XML User You are given an article delimited by <ARTICLE></ARTICLE> tags and a mood delimited by <MOOD></MOOD> tags. Your task is to rewrite the article in the style of the mood. Respond with plain text in 50 words. <ARTICLE>A molecule is like a tiny building block that's super, super small. You can't see it, but it's there! Lots of these tiny blocks stick together to make everything around us, like water, air, and even you! They are like the pieces of a puzzle that make up everything. </ARTICLE> <MOOD>flabbergasted</MOOD> Assistant A molecule, imagine this, is an astonishingly minuscule building block—so diminutive, it's invisible! Yet, it's the cornerstone of existence! These specks congregate to conjure, well, everything! Water, air, our very beings! Astoundingly, they're the enigmatic fragments that seamlessly assemble the grand tapestry of reality. Unbelievable!
  • 9. 10 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Text processing steps User You are given text delimited by triple quotes. Step 1 - Summarize the text in 1 sentence Step 2- Translate the text to Bulgarian Step 3 - Write a question whose answer is the output from step 2 Step 4 - Respond with the question and the answer delimited by new line """ A molecule, imagine this, is an astonishingly minuscule building block—so diminutive, it's invisible! Yet, it's the cornerstone of existence! These specks congregate to conjure, well, everything! Water, air, our very beings! Astoundingly, they're the enigmatic fragments that seamlessly assemble the grand tapestry of reality. Unbelievable! """ Assistant Step 1 - Summarize the text in 1 sentence: Molecules are incredibly small yet fundamental components that make up all aspects of reality. Step 2 - Translate the text to Bulgarian: Молекулите са невероятно малки, но основни компоненти, които съставят всички аспекти на реалността. Step 3 - Write a question whose answer is the output from step 2: Как бихте описали молекулите в едно изречение на български език? Step 4 - Respond with the question and the answer delimited by new line: Как бихте описали молекулите в едно изречение на български език? Молекулите са невероятно малки, но основни компоненти, които съставят всички аспекти на реалността.
  • 10. 11 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools One-shot User Summarise the topic and mood of a piece of text. Examples: """ A molecule, imagine this, is an astonishingly minuscule building block—so diminutive, it's invisible! Yet, it's the cornerstone of existence! These specks congregate to conjure, well, everything! Water, air, our very beings! Astoundingly, they're the enigmatic fragments that seamlessly assemble the grand tapestry of reality. Unbelievable! """ Topic: Molecules Mood: Amazement """ The new OpenAI features released on Dev Day this week are awesome. I look forward to trying out assistants, JSON response and the new GPT-4V model! """ Assistant Topic: OpenAI's new features Mood: Enthusiasm Tip: For simple outputs, gpt-3.5-turbo with one or two examples can typically match gpt-4 performance for 3% of the cost
  • 11. 12 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Confluence article as context User Answer the question enclosed in <QUESTION></QUESTION> tags in 50 words using the provided context enclosed in <CONTEXT></CONTEXT>. <CONTEXT> (... Inventory valuation Confluence page omitted ...) </CONTEXT> <QUESTION> How long would it take to build this capability with a small data team of data warehousing and data engineering specialists? </QUESTION> Assistant The timeline to build this inventory valuation and COGS reporting system with a small data team would vary based on team expertise, requirements complexity, and unforeseen challenges. Typically, such a project could take several months to over a year.
  • 12. 13 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Work out solution independently and verify System First work out your own solution to the problem. Then compare your solution to the student's solution and evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you have done the problem yourself. User Problem Statement: I'm building a solar power installation and I need help working out the financials. - Land costs $100 / square foot - I can buy solar panels for $250 / square foot - I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot What is the total cost for the first year of operations as a function of the number of square feet. Student's Solution: Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000 Assistant Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 10x Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000 The student's solution is incorrect. They made an error in the maintenance cost calculation, using 100x instead of 10x. The correct total cost for the first year of operations is 360x + 100,000.
  • 13. 14 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Separate workings and explanation from final answer System First work out your own solution to the problem. Then compare your solution to the student's solution and evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you have done the problem yourself. Enclose your workings in <WORKINGS></WORKINGS> Enclose your final answer in <ANSWER></ANSWER> Enclose any additional explanation in <EXPLANATION></EXPLANATION> User Problem Statement: I'm building a solar power installation and I need help working out the financials. - Land costs $100 / square foot - I can buy solar panels for $250 / square foot - I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot What is the total cost for the first year of operations as a function of the number of square feet. Student's Solution: Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000 Assistant <WORKINGS> Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 10x Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000 </WORKINGS> <ANSWER> The student's solution is incorrect. </ANSWER> <EXPLANATION> The student made a mistake in calculating the maintenance cost. The maintenance cost is $100,000 plus $10 per square foot, not $100 per square foot. Therefore, the total cost should be 360x + 100,000, not 450x + 100,000. </EXPLANATION>
  • 14. 15 Prompt Engineering Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Respond with pre-defined JSON schema System First work out your own solution to the problem. Then compare your solution to the student's solution and evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you have done the problem yourself. Respond strictly with a JSON object, with 3 keys: - workings, for your workings - answer, for your final answer indicating correctness, - explanation, for any additional explanations (optional) User Problem Statement: I'm building a solar power installation and I need help working out the financials. - Land costs $100 / square foot - I can buy solar panels for $250 / square foot - I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot What is the total cost for the first year of operations as a function of the number of square feet. Student's Solution: Let x be the size of the installation in square feet. 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000 Assistant { "workings": "Let x be the size of the installation in square feet. n1. Land cost: 100x n2. Solar panel cost: 250x n3. Maintenance cost: 100,000 + 10x nTotal cost: 100x + 250x + 100,000 + 10x = 360x + 100,000", "answer": "Incorrect", "explanation": "The student incorrectly calculated the maintenance cost. The maintenance cost is $10 per square foot, not $100. Therefore, the total cost should be 360x + 100,000, not 450x + 100,000." }
  • 15. 16 Prompt Engineering ▪ Call external function based on model output (model generates function signature) ▪ Integrate function response back into next model prompt Adopt Persona Delimiters Step-by-step Instructions One/Few-shot Learning Additional Context Give time to “think” Inner monologue JSON response External tools Function calling Retrieval ▪ Perform semantic search of user input against a Vector database ▪ Inject search results into prompt to further contextualise prompt Prompt 1 Prompt 2 External function Prompt 1 Vector DB Function signature Function response User input Additional relevant context Output Output Retrieval Augmented Generation (RAG)
  • 16. 17 Retrieval Augmented Generation (RAG) Use OpenAI ADA-2 as embedding model
  • 17. 18 VectorDB recommendation: pg_vector extension for Aurora PgSQL (AWS released this over the Summer)
  • 18. 19 Which GPT model do I use? Note: Assume 500 input and 500 output tokens gpt-3.5-turbo gpt-4 / gpt-4-turbo Response quality Medium – can be partially mitigated with few-shot learning High Speed Slow – ~100 tokens / sec 5x faster vs gpt-4! Very slow – ~20 tokens / sec Cost High – $1.5 / 1000 prompts* 15-30x cheaper vs gpt-4! Very high – • $20 / 1000 prompts* (gpt-4-turbo) • $45 / 1000 prompts* (gpt-4) Use for • Simple instructions • Simple outputs • Basic reasoning • Simple chat responses • Simple JSON outputs • Complex instructions • Complex outputs • Advanced reasoning • High-quality chat responses • Complex JSON outputs • Multi-modal inputs (images / text)