1. GENERATIVE AI CON
AMAZON BEDROCK
Guido Nebiolo,AWS Ambassador @ Reply
23 November2023
(WITH REAL EXAMPLES INSIDE 😉)
2. 2
• 20 years developer
• 10 years paid developer
• 8 years paid developer on AWS (mainly)
• 3 years paid to teach developing on AWS
(and other topics)
WHOAMI
aws sts get-caller-identity
4. 4
WHAT IS GENERATIVE AI?
AI
ML
DL
Gen AI
Generative AI generates new
content for a variety of tasks
leveraging pretrained foundation
models that can be customized
with small fractions of data.
14. 14
FMS ON AWS
Out-of-the-Box
Managed
Model-as-a-Service
Managed ML Dev
Tooling
Proprietary Models
Provides a ready-to-use
solution with predefined
configurations, requiring
minimal setup and
customization
Build GenAI applications
on fully managed models
with choice of FMs
Tune or use publicly
available or open-source
models as is on managed
model
Build custom models from
scratch
15. 15
KEY FEATURES OF BEDROCK
Accelerate development of
generative AI applications
using FMs through an API,
without managing
infrastructure
Choose FMs from Amazon,
AI21 Labs, Anthropic, Cohere,
and Stability AI to find the right
FM for your use case
Privately customize FMs using
your organization’s data
Multilingual LLMs for text
generation in Spanish,
French, German,
Portuguese, Italian, and
Dutch
LLM f or thoughtf ul
dialogue, content
creation, complex
reasoning, creativ ity ,
and coding, based on
Constitutional AI and
harmlessness training
Powerf ul and v ersatile
language models that
can be used f or a wide
range of natural
language processing
tasks. Optimized f or
dialogue use case
Generation of unique,
realistic, high-quality
images, art, logos, and
designs
Text summarization,
generation,
classif ication, open-
ended Q&A, inf ormation
extraction, embeddings
and search
JURASSIC CLAUDE LLAMA SDXL TITAN
Text generation model
f or business applications
and embeddings model
f or search, clustering, or
classif ication in 100+
languages
COMMAND
16. 19
EMERGING GENERATIVE AI MODEL PATTERNS
Coherence
|
context
learning
Complexity | Time to market
In-context learning
using foundational
models
Model fine-tuning
using foundational
models
Training your own
model
#1: Contextual prompt engineering
#2: Retrieval augmented generation (RAG)
#3: Model fine-tuning
#4: Training models
18. 21
UNDERSTANDING PROMPT ENGINEERING
Summarize the following technical sentence:
Tags: generative ai, security, blogpost
Sentence: Security has been a hot topic since the
birth of Generative AI🔥. From the beginning, AWS
states that security is a shared responsibility
between us and them...
Summary:
21. 24
UNDERSTANDING PROMPT ENGINEERING
INSTRUCTION
INPUT DATA
OUTPUT INDICATOR
CONTEXT
Summarize the following
technical sentence
Sentence: Security has been a
hot topic since the birth of
Generative AI🔥. From the
beginning, AWS states that…
Summary:
22. 25
UNDERSTANDING PROMPT ENGINEERING
INSTRUCTION
INPUT DATA
OUTPUT INDICATOR
CONTEXT
Summarize the following
technical sentence
Sentence: Security has been a
hot topic since the birth of
Generative AI🔥. From the
beginning, AWS states that…
Summary:
Tags: generative ai, security,
blogpost
23. 26
UNDERSTANDING PROMPT ENGINEERING
Summarize the following technical sentence:
Tags: generative ai, security, blogpost
Sentence: Security has been a hot topic since the
birth of Generative AI🔥. From the beginning, AWS
states that security is a shared responsibility
between us and them...
Summary:
24. INSTRUCTION
INPUT DATA
OUTPUT INDICATOR
CONTEXT
Summarize the following
technical sentence
Sentence: Security has been a
hot topic since the birth of
Generative AI🔥. From the
beginning, AWS states that…
Summary:
Tags: generative ai, security,
blogpost
27
UNDERSTANDING PROMPT ENGINEERING
PLEASE
25. 28
UNDERSTANDING PROMPT ENGINEERING
Please summarize the following technical sentence:
Tags: generative ai, security, blogpost
Sentence: Security has been a hot topic since the
birth of Generative AI🔥. From the beginning, AWS
states that security is a shared responsibility
between us and them...
Summary:
27. 30 Prompt: Captures the beauty of a tropical beach on a hot, sunny day.Include palm trees, crystal-clear waters.
INFERENCE
PARAMETERS
Higher the value means more
randomness.
TEMPERATURE
28. 31 Prompt: Serene winter wonderland,showcasing a snow-covered forest with glistening trees, a frozen lake, and the peaceful,
cold atmosphere
INFERENCE
PARAMETERS
Higher the value means it will
only looks at a subset of tokens
whose probability adds up to a
certain threshold (Top P).
TOP P
29. 32 Prompt: Cozy mountain cabin surrounded by a snowy, alpine landscape, with smoke rising from the chimney and a sky full of
stars on a freezing night.
INFERENCE
PARAMETERS
Similar to Top P, but, instead of
working in percentage, it
specifies an absolute number of
tokens.
TOP K
32. 35
ZERO SHOT DEMO
PromptEngineering
we didn't provide the
model with any
examples of text
alongside their
classifications, the
LLM already
understands
"sentiment"
33. 36
FEW SHOT DEMO
PromptEngineering
Few-shot prompting
can be used as a
technique to enable
in-context learning
where we provide
demonstrations in
the prompt to steer
the model to better
performance.
35. enables complexreasoning capabilities through
intermediate reasoning steps.
CHAIN-OF-THOUGHT
generate knowledge to be used as part of the
prompt.
GENERATED KNOWLEDGE
38
MORE PROMPT ENGINEERING
TECHNIQUES
… AND MANY OTHERS
37. FMs knowledge is freezed at the time of of model
training.
POINT IN TIME
Generation of text that is not grounded in
accurate or real-world information.
HALLUCINATION
40
WHY RAG?
Retrieval Augmented Generation
38. 41
UNDERSTANDING RAG
RAG’s internal knowledge
can be easily altered or
even supplemented on the
fly, controlling what RAG
knows and doesn’t know.
Retrieval Augmented
Generation (RAG) is a machine
learning approach that combines
elements of both retrieval-based
models and generative models to
improve the performance of
natural language understanding
and generation tasks.
Retrieval Augmented Generation
46. 49
TAKE-AWAYS
• To get better results, give as many details as possible to LLMs.
• Use RAG to cut training costs and decrease TTM when delivering POC
or MVP.
• Consider fine-tuning LLMs instead of giving them too many examples to
learn from.
(How many shots can an LLM handle?)
• Go on and build something, best learning path is hands-one experience.
Be part of the revolution!