Azure OpenAI Workshop
Azure OpenAI Workshop
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
EAGLE
EAGLE
Question and
Answering
Data
Sentiment Analysis
Text
Images Information
Extraction
Speech Training Foundation Adaptation
Model
Instruction Follow
GPT-3 (2020)
175B
GPT-3 | 2020
17B
Turing-NLG | 2020
2
340M
BERT-Large | 2018
1
Generative AI
Business
Users
Application Platform
AI Builder
Power BI Power Apps Power Automate Power Virtual Agents
Scenario-Based Services
Applied AI Services
Bot Service Cognitive Search Form Recognizer Video Indexer Metrics Advisor Immersive Reader
Customizable AI Models
Cognitive Services Developers &
Vision Speech Language Decision OpenAI Service Data Scientists
Call Center Analytics: Call Center Analytics: Summary Convert Natural Language to
Search reviews for a specific
Automatically generate of customer support SQL (or vice versa) for telemetry
product / service
responses to customer inquiries conversation logs data
Customer 360: Hyper-personalisation using timely Summarization of customer queries & trends, Search, and Content Generation
Business Process Automation: Search through structured & unstructured documentation, Generate Code to query data models, Content
Generation
Azure Open AI Enterprise Readiness
Microsoft Azure Cloud
Runs on trust
Your data is your data Data is stored encrypted in your Azure subscription
Your data from any fine-tuning Azure OpenAI Service provisioned in your Azure subscription
is not used to train the Model fine tuning stays in your Azure subscription
foundation AI models and never moves into the foundation AI models
the most comprehensive enterprise Private Virtual Networks, Role Based Access Control
compliance and security controls Soc2, ISO, HIPPA, CSA STAR Compliant
Deployed in your Azure subscription,
secured by you, and tied to your datasets
and applications
Abuse detection—
ensure responsible use of your application
Fine Tuning
The model is trained via repeated gradient updates using a large corpus of example tasks.
1. 2. 3. 4.
Higher quality results Ability to train on more examples Token savings due Lower latency requests
than prompt design than can fit in a prompt to shorter prompts
Prompt Engineering
2 min demo
• Write a prompt to extract the information in the following structured format from the generated
customer support’s transcript in ISP company.
{ "issue": "product fault", "product": "Linksys router", "resolution": "resolved", "sentiment": "positive“,
“datetime:”Mar-12-2023 13:30:21” }
Advanced tips
• Add few-shot learning examples will improve clarity for complex scenario
• LLMs may suffer from greedy problem. Requires step by step reasoning or provide step by
step instruction will provide better result in very complex reasoning scenario
Fine-Tuning
GPT-3
Domain Data
Small Set of Labeled
Data Fine-tuning results is a new model being
• minimum of several
thousand examples high-dimensional generated with updated weights and biases.
• Maximum of 2.5M tokens
or 80-100mb size vector space
(Embeddings)
Fine-tuning This is in contrast to few-shot learning in which
model weights and biases are not updated.
GPT-4 Davinci-codex
GPT Turbo
Davinci
Curie Cushman-codex
Inferencing time
Babbage
Ada
Capability Capability
Fine tuning vs. prompt engineering
• Why fine tuning?
• You may have language patterns, context or communication or special
behavior that you need to hardwire into the LLM’s weights to simplify prompt
• Prompt engineering offers flexibility but comes at longer prompt -> higher
cost
batch_size The batch size to use for training. The We’ve seen good performance in the range of 0.01% to 4% of training set size. In general, we've found
controls the number of training batch size is the number of training that larger batch sizes tend to work better for larger datasets.
examples used in a single examples used to train a single
training pass forward and backward pass.
learning_rate_multiplier The learning rate multiplier to use for We recommend experimenting with values in the range 0.02 to 0.2 to see what produces the best
controls rate at which the training. The fine-tuning learning rate results. Empirically, we've found that larger learning rates often perform better with larger batch sizes.
model weights are updated is the original learning rate used for
pre-training, multiplied by this value. Empirically, we found learning_rate_multiplier has minor impact compared to n_epochs and batch_size.
prompt_loss_weight The weight to use for loss on the When a model is fine-tuned, it learns to produce text it sees in both the prompt and the completion.
controls how much the model prompt tokens. This value controls In fact, from the point of view of the model being fine-tuned, the distinction between prompt and
learns from prompt tokens vs how much the model tries to learn to completion is mostly arbitrary. The only difference between prompt text and completion text is that
completion tokens generate the prompt (as compared to the model learns less from each prompt token than it does from each completion token. This ratio is
the completion, which always has a controlled by the prompt_loss_weight, which by default is 0.1. If prompts are extremely long (relative
weight of 1.0.) Increasing this value to completions), it may make sense to reduce this weight to avoid over-prioritizing learning the
can add a stabilizing effect to training prompt.
when completions are short.
Empirically, we found prompt_loss_weight has minor impact compared to n_epochs and batch_size.
Azure Open Solution Patterns
Retrieval Augmented Generation
Database engine
App UX Orchestrator
Code generation
Visualization
service
Result Interpretation
Natural Language Interface For Data Analysis
Summarization
Stuff
Summarized
Input document
docume Orchestrator Map-Reduce
nt
Refine