Skip to playerSkip to main contentSkip to footer
  • 5/16/2025
Welcome to this hands-on AI-900 lab session, where we dive deep into fine-tuning GPT models using Azure AI Foundry! Fine-tuning allows developers to customize AI models for specific industries, use cases, and data sets, improving response accuracy and relevance. Whether you're preparing for the Microsoft AI-900 Certification or working on AI-driven applications, this tutorial will provide a step-by-step walkthrough of fine-tuning GPT models in Azure.

🔍 What You’ll Learn in This Video:
1️⃣ Introduction to Fine-Tuning GPT Models in Azure AI Foundry
2️⃣ Why Fine-Tuning is Essential for Custom AI Applications
3️⃣ Setting Up Azure AI Foundry for GPT Model Fine-Tuning
4️⃣ Uploading & Preparing Training Data for Customization
5️⃣ Training and Deploying a Fine-Tuned GPT Model
6️⃣ Testing & Optimizing Model Performance for Real-World Use Cases

🛠️ Who Is This For?
AI & ML Enthusiasts exploring custom AI solutions
Developers & data scientists working on AI-powered applications
Professionals preparing for the Microsoft AI-900 Certification
Businesses looking to customize AI for customer support, automation, & NLP

📌 Key Highlights:
✅ Hands-on demo of GPT fine-tuning in Azure AI Foundry
✅ Customizing AI models for industry-specific applications
✅ Training and deploying AI models with real-world datasets
✅ Optimizing GPT models for better accuracy & efficiency

Explore Our Other Azure Courses Practice Material on: https://www.youtube.com/@skilltechclub

Category

🤖
Tech
Transcript
00:00hey guys welcome back to skill tech club my name is maruti and i'll be going through another azure
00:14ai topic today now so far you understood what is azure ai foundry service you understood llms you
00:20understood that how we can actually use prompt engineering techniques also with that uh today
00:26we are going to focus on a very important topic called fine tuning most of the time when you have
00:31llms available you want to fine tune them as per your requirement most of the time with your own
00:37training data set this training data set is basically going to be applied on your llm and
00:43then it's going to train that particular model with that additional data which you are going to provide
00:48now how exactly we can do fine tuning and how this fine tuning is going to help you that's what you're
00:54going to understand today in this video but without wasting time let's get started with
00:59practical labs so i am in my azure ai foundry portal i do not have any projects right now in this case
01:07i am going to create a new project as usual now this time when i'm creating a project i have to make sure
01:12one thing that i'm going to create a project which is in the specific azure region i hope you already
01:19know azure regions and microsoft azure cloud is actually having more than 60 plus regions available
01:25across the globe so i hope you know the fundamentals of azure cloud if you do not know the fundamentals
01:31of azure cloud i strongly recommend you to check our ai 900 video series which is going to take you
01:37through the journey of azure cloud learning if you're familiar i am going to choose a region which
01:43is east us2 you can see right now i'm trying to create a new project and a new hub the name of the
01:49hub i'm giving maruti hub it's some number at the end of this location i want to choose east us2 only
01:55because when you need to do fine tuning of your gpt model you have to provision a certain resources in
02:02that particular region so i'm going to use east us2 uh this is going to connect with my newly created
02:08azure open ai service i'm fine with that and i'm going to click on next this is my hub name this is
02:16my location east us2 this is where i'm interested right now i'm going to click on create once the
02:22project is created we'll move forward with fine tuning but while the project is actually getting
02:27created i want to tell you one more thing this is an official lab document which i'm going to share
02:34it with you in the description of this particular video and in that lab document you will find a
02:40link of this particular training data set now as you can see right now this url is coming from microsoft
02:46learning so basically it's a github repository of microsoft learning from where i'm going to take this
02:52one document which is helping me to do the fine tuning of my model now this is some travel and hotel
02:58related document and this document is in the json l format i request you to please go through this
03:05link and then download this particular file in your computer make sure while saving this file in your
03:11computer you're going to save it in json l format not dot txt so you can basically hit this url you can
03:18do control s while saving this file just add double quotes at this beginning and end of this particular
03:27file link and that's going to save with this particular extension which you want so just do
03:32it and once you have saved your file this file will be useful in our fine tuning of the model now
03:38let's get back to azure ai foundry portal because very soon the project and hub creation is going to be
03:44done and once it is done we'll move forward yes my project is created it's just loading that page
03:52and once this page is loaded this is a newly created project so remember i do not have any kind
03:57of deployments inside this the location of the project is east us2 and it's successfully created
04:04the first thing which i'm going to do is i will go to my model catalog section in the model catalog
04:09section you know we have so many new models which are available uh in the list of these models recently
04:15i saw one of the coolest model of recent time which is deep seek you can see right now even deep seek r1
04:21is also available in azure ai portal so this is something which is really cool if you are interested
04:27in learning deep seek with azure ai just comment down that in the chat box and i'll create a separate
04:34video on that right now i want to search for some of the gpt models so i'm going to choose gpt35 and
04:42we're going to pick one of the model let's say gpt35 turbo now remember this time when i'm selecting
04:48this model my goal is not to deploy the model and trying some kind of a chat associated with that
04:54instead of deploying the model i want to fine tune this model so i'm going to take an existing llm
04:59and then i'm going to apply my training data set on that and then using this combination i'm going to
05:06train that model basically that process is known as fine tuning so on this page you can see right now
05:12the model id and the version and everything is available i am going to click on fine tune which is this tab
05:19in the fine tune section they're asking me select a model to fine tune which is gpt35 turbo the
05:24resource location is east us2 as i mentioned if you click on customize you can change certain details
05:30of this if you want but i do not want to do this i'm happy with everything this and i'm going to click
05:35on confirm now remember when you're trying to do fine tuning of this model there are a couple of
05:42configuration things which you have to specify i request when you try this thing first time you do as i'm
05:47showing you in the steps or you follow the link which i'm sharing with you in the description
05:53in the model suffix i'm going to add some meaningful name like ft travel now this is going to be a
05:58fine-tuning kind of a model for the travel related things so i'm just adding a name ft travel and
06:04because i'm following step-by-step instructions provided on the microsoft learning github repository
06:09i am just following steps exactly same the connected ai service will be my azure open ai service which is
06:16already there so i'm good with this let's click on next in the training data they're asking me where
06:21is your training data set i can actually have a plenty of options here i can choose data in azure
06:27foundry or i can choose files connected with the service or i can choose azure blob and other shared
06:34weapon location also but in this case i have a file available in my computer so i'm going to choose
06:39upload files and then i'm going to upload a file which is this file available in my computer in the
06:46json l format so i'm just clicking on uploading the file remember this is that file travel fine tune
06:51hotel dot json l which we have downloaded from that link and uh yes the size of the file is very small
06:58it's just uploaded here uh it's just taking some time in loading this below section so i just wait for
07:04this process to complete okay now you can see right now this is one of the possible issues which can
07:09happen at this time it's showing me that you may not have a sufficient permissions to upload the file
07:16to upload a data file you need to have a storage blob data owner role for the storage account which is
07:23this one now let me just quickly check this thing so this is a common issue i know what is the problem
07:29the problem is with the role assignment so we can actually manually also assign this role
07:33but this role assignment is something which should be done automatically even because i have just
07:39tried to create this thing maybe there are chances they will assign this role configuration in few
07:43minutes and after a few minutes if you try it will work but as of now i just want to check this thing
07:48now they are saying once the access permissions are updated on the file is verified upload a new training
07:55and try again or you can ask the admin for help now i have two options actually i can actually manually
08:01go and do this thing you can see we have storage blob data owner role this is something on the storage
08:06account which is with this name we have to do give so let me go back to my azure portal i'll go to
08:13the resources section we have a new resource group created for this project we have a storage account
08:21which is mentioned there with this particular name and in this storage account i need to have that kind
08:27of process now instead of doing this access management you want which is actually going to be done
08:32automatically we can do one thing we can go to the container section
08:39i can just create a new container here giving a name of that container ft data fine-tuning data
08:48and i'm going to click on create once this ft data is created i'll go inside that
08:57and i'll upload the same file here i have uploaded this file here and now i can directly refer this
09:03file so i'm going back to my azure ai foundry portal where i was getting that issue and now instead
09:10of upload file i'm going to choose azure blob and other shared web location this time i have to provide
09:17a file name and then i have to provide a file location here now this is going to ask me that
09:21okay you provide a file name and you provide input azure blob public url which is going to be publicly
09:27accessible url with sas or any other shared web link if you have the same now they are also specifying
09:34file must be in json l now what i'm going to do is i'm going to provide a file name which is
09:40the exact same name which i want to give so this is actually travel
09:46fine-tune hotel this is actually the name of that particular file so i'm just specifying this name
09:53here and then in the file location i'm going back to my ft data i'm going to click on generate sas
10:10and now this is actually giving me that this is a one particular file for which you're trying to
10:15generate sas i will say that this is going to have the read permission or maybe create write delete
10:22permissions on this and using this i want to generate a sas token basically using this blog sas url anyone
10:29can access this particular file with sas so i'm just going to copy this and i'm going to put it here in my
10:35file location remember if you do not want to go with this way you can actually make your container
10:42public by specifying the excess modifier of that to container level and then this is not going to
10:49be required so you don't need a sas token in that case now i'm happy with this i'll just click on import
10:54let's see if this is actually able to import that or not it's showing me file imported successfully and
11:01it got the data also configured with this this is cool i'm going to move forward to next remember
11:07these extra steps are not mentioned in that particular lab document so if something certain
11:12things are not working for you using the lab document follow the video guidelines now in the
11:18validation data i can choose what kind of validation i want to associate with that so if i have a separate
11:23set of validation data i can provide that also as of now i don't have so i'm just going to
11:28select none and i'll click on next task parameters i think i'm keeping all the default things right
11:34now i do not want to change it i'll click on next and then i'll click on submit when you do this this
11:41is actually going to start the fine tuning process and it can take some time so maybe i can come back and
11:47i can check the status of this particular fine tuning process you can see right now it's showing me queued
11:52but maybe after some time it's going to be completed so i can come back here and i can check it later
11:56as of now i can move forward to my next step and then i'll come back to this one later on okay now
12:03my fine tuning is actually going on i can click on this refresh and i can see whether it is started or
12:11it's just going to be done or not so right now it is just queued i'll wait for some time and then
12:16i'll come back and check it meanwhile i want to do some other things i'm going back to my model plus
12:22endpoint section in this model plus endpoint section i am going to focus on the deployment
12:27of the model so i'll click on deploy model i'm going to click on deploy base model right now
12:33not a fine tune one i'm going to deploy a base model and in this base model configuration i'm
12:38going to search for gpt 35 turbo so this is the same model which we have used for fine tuning i'm
12:44choosing this model the task for this model is actually chat completion which is perfectly fine
12:49and i'm going to click on confirm basically this is a model which is a base model not a fine-tuned one
12:56gpt35 turbo deployment type is standard uh in the customize section i just want to reduce the token
13:03rate limit to 5000 we do not want more than that for the lab purpose and then we are going to disable
13:11dynamic quota and we'll click on deploy
13:13so basically this is deploying my base model right now my base model is successfully deployed let's
13:21click on open in playground yes once it is open in playground as usual the first thing which i'm going
13:28to ask is what can you do this is a very common question which i always ask to every model so that i
13:37can understand what kind of things it can do for me the standard answer came because this is just a
13:44digital ai assistant so it can help me with various things like this which i mentioned in this particular
13:50completion now let's try a few things so that we can understand the base model and the fine tuning
13:55model properly so i'm going to change my system message now the default system message is like this
14:00you are an ai assistant that helps people to find information instead of this i am going to put you are an
14:06ai assistant that helps people plan their holidays so this is something which i have changed i'm going
14:11to click on apply changes continue and once the changes are applied i'm going to ask the same question
14:18again what can you do now it's showing me that i can assist with planning your holidays by suggesting
14:28destinations helping you find accommodations recommended activities and attractions so this is actually
14:34changed because of the system message i hope you know the purpose of system messages like this now
14:39let me try something better in the system message so instead of this one i'm saying that you are an ai
14:45travel assistant that helps people plan their trips your objective is to offer support for travel
14:51related inquiries such as visa requirements weather forecasts local attractions and cultural notes you should
14:58not provide any hotel flight rental car or restaurant recommendations ask engaging questions to help
15:05someone plan their trip and then think about what they want to do in on their holidays so basically this
15:12is going to ask an engaging question also at the end of the response okay i'm going to click on apply changes
15:18continue and now i'm going to ask series of questions to this so let me ask first as per the document
15:28where in rome should i stay now they are saying when deciding where you stay in rome it's essential
15:34to consider your preferences and interest they're giving me a description association with this they're
15:40also showing me do you have a specific budget in mind for accommodation and if you're looking for that
15:44you can go for lodging such as a hotel or a b and b or maybe some boutique guest house is giving me a
15:51suggestion with that cool another point i'm putting which is like i'm mostly there for a food where should i
15:58stay to be within a walking distance of affordable restaurants so this is my preference which i've
16:03given and when i give this thing it's going to ask me if you are a food lover and want to be with your
16:09walking in distance or affordable with the delicious things and all they are showing me you can try this
16:15you can try that they're saying you might consider staying in the neighborhoods like this area and the
16:20other area or maybe monte so basically they are not giving me any hotels because it's mentioned here
16:25that any hotel flight rental car or restaurant recommendations you should not provide so they
16:31are actually giving me the places but they are not giving me any specific hotels or car rental kind of
16:36things and all also give me a list of five bed breakfast in a specific area which i'm specifying
16:44which is test to live now when i do this if i send me this give me a list of five bed and breakfast in
16:52trustyville and it's giving me a response that i'm here to help you plan your trip but i don't have a
16:59real-time access to specific listings or booking information for bed and breakfast in this however i can
17:05suggest you some popular bed and breakfast in this and they are showing me certain names there so as
17:11per the instruction this particular system message is actually working perfectly fine it's not giving
17:16me any kind of links or some some configurations with that now the thing which you need to understand here
17:21is this model is actually providing you list of hotels here now obviously this domains clara residential
17:30sand castillo these are actually the name of the hotels and they are giving you that before booking
17:34you recommend reading reviews from other travelers also now even though i clearly mention here that
17:40you should not provide any hotel flight or rental car or restaurant recommendations they are still
17:44providing this because i have asked for that this is something which is an example of inconsistent
17:49behavior so that's the reason let's understand if fine-tuning model is going to behave proper in this
17:55kind of cases so we do not want this kind of inconsistent behavior and that is where fine-tuning is coming
18:00into the picture and it's going to help you in this so let me go back to my fine-tuning section the status
18:07of this particular fine-tuning is still running i have to wait until this is completed so let's wait for
18:12some time okay so now finally i am back to my fine-tune model which is available here you can see that the
18:20status of this fine-tuning is actually completed which means that my fine-tuning with that particular model
18:26is done i'm going to click on this particular fine-tune model and the next thing which i want
18:31you to see right now is this is something which is completed it's showing me that there is a section
18:37called metrics and this is going to show me that what kind of model is this this metrics are actually
18:43going to show me that whether this is fine-tuning properly done or not now you can see right now there
18:49is a section called loss there is a section called token accuracy now these are the sessions which are
18:54actually showing you whether your your fine-tuning is properly worked or not now i'm not going into
18:59in depth right now in this metric section but this is something which is showing me that my fine-tuning
19:04is completed successfully what i will do now is there is a button here which is showing me deploy
19:10remember if you want to use this model you have to deploy the fine-tune model so i'm going to click on
19:16deploy it's giving me an option here that which one you want to try the deployment name will be gpt35 turbo
19:24ft travel this is the name of my fine-tuning and the deployment type i'm choosing standard which is
19:30fine uh it's showing me this is going to be connected with which azure openei service connection
19:35i'm choosing the same one and i want to reduce the tokens per minute rate to 5k once all these things
19:41are good i think we are good to go with this let me just disable dynamic quota and we'll click on deploy
19:48so same like my base model this is a fine-tuned model which i'm deploying right now okay this will be
19:54done very soon so maybe it's going to take few minutes of time and the deployment of fine-tuning
19:59model is done then you can use that let's wait for some time you can see the deployment is going
20:04on in the provisioning state it's showing me creating so i will wait for some time once this
20:08is successfully done let me tell you one more thing right now right now the topic which we are
20:14understanding is a fine-tuning of your gpt model now fine-tuning is a good thing or bad this is one of
20:20the question which most people ask well the answer is this is a good thing because it is actually going
20:24to take your data and on top of your data which you have given into this model it will be trained
20:30which is a good thing but there is one particular drawback of fine-tuning which is this is time
20:35consuming as well as expensive yes of course when you do this fine-tuning you are going to use a
20:40compute power to train your model that's the reason if this model training is going to take few minutes or
20:46a few hours you have a cost associated with that so remember fine-tuning is expensive and time
20:52consuming but it is worth doing when you want to apply your own data also there is another question
20:57which people ask me is is there any other alternative way which is available well yes we have an alternative
21:04way which is known as rag retrieval augmented generation and i'm going to create one video on this
21:11tomorrow so you are going to get this video tomorrow tomorrow rag is going to be alternative
21:16of fine-tuning the there are pros and cons fine-tuning is easy rag is little complex fine-tuning is something
21:25which is expensive as well as time consuming when you do the model training while rag is something
21:31which is faster as well as is not going to be that much expensive so there are pros and cons in my case
21:38based on my past experience my most of the corporate clients are going to be using fine-tuning as well
21:43as rag both so it's worth learning both of the topics okay now you can see that is showing me
21:52provisioning state is succeeded uh it took almost four minutes for me to complete this particular one
21:58so this is actually successfully deployed and if it is deployed let's open in playground remember this is
22:04not a base model this time this is a fine-tuned model so we are going to ask the same question
22:09to taste whether this fine-tuned model is behaving properly and is working fine or not you can see
22:15in this left side section where i have gpt 35 turbo this is ft fine-tune travel version one this is
22:21a model which i'm going to use let me ask the same question which i have asked earlier first
22:27what can you do
22:29okay it's showing me i can help you to plan your business destination attractions activities
22:36and multiple things let me do one thing we are going to copy and paste
22:43the same thing which is here so we are going to provide this kind of a system message here which is
22:50you are an ai assistant and this time we are strictly specifying that you should not provide any hotel
22:55flight or rental car kind of a thing so this is something which is already there i think we
22:59already applied changes on this also so that is perfectly fine now i'm asking similar kind of
23:04questions so the next question which i will ask is where in a room should i stay remember last time
23:12when we tried certain things it was giving me a list of the hotels or places actually there now it's saying
23:19that are you looking for near iconic landmarks so this kind of a question they are giving me they are not
23:24giving many restaurant names here which is good then i'm going to ask a second one which is
23:30we did last time also which is i'm mostly there for the food where should i stay
23:37to be within working distance of affordable restaurants this was the second thing which we asked
23:43you can also compare this answers which we are getting this completion which we are getting with
23:48the previous one which we have done so you can see slightly change this time is showing me for food
23:53focused in rome you might enjoy this this this place names so these are the neighborhoods which
23:57they are saying so this is also perfect this is the same thing and now let me try the third one when
24:02i'm seeing that give me a list of five bed and breakfast in trusty wheel so let me just send this
24:10now i'm saying why i can't provide a real-time listing you can offer this thing and in this is
24:15showing me the same five things into this now they are also showing me the difference between this so they
24:20are showing me uh the five places which were there earlier also and this is showing me the five
24:26places which are here also now basically when we are trying to fine tune this model whether this is
24:32working or not is something which is based on this particular configuration now as i said based on this
24:37particular model customization and the data which you have provided if this is not giving you the hotel
24:42names in that that is something which we wanted but even with this fine tuning and all this is something
24:46which is not perfect which means that maybe we have to add more data and we have to fine tune that
24:50model now this is also something which is one of the common issue which happens with the fine tuning of
24:55the model that it's mostly going to be behaving with your default nature of the base model actually
25:02and that's something which is a limitation while on the other hand if you're going to use other options
25:06which i see like rag retrieval augmented generation that's actually going to focus on the top of the data which
25:12you're providing in the grounded context so we'll see that thing in the tomorrow's video i hope you
25:17understood the concept of fine tuning i hope you understood the pros and cons also and remember this
25:23is my new model which we have used right now the older model was gpt 35 turbo which is base this is
25:29a fine tune model which i'm using but yeah if you are going to try this thing practically just make sure
25:35it is going to be involving with a lot of cost and it is also going to be time consuming so make sure you
25:40understand this properly and if you need this then only you're going to do this that's it for today
25:46thank you so much guys uh this is maruti signing out i'll see you tomorrow happy learning

Recommended