You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/openai/includes/fine-tune-models.md
+25-9Lines changed: 25 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,29 @@ manager: nitinme
14
14
> `gpt-35-turbo` - Fine-tuning of this model is limited to a subset of regions, and isn't available in every region the base model is available.
15
15
>
16
16
> The supported regions for fine-tuning might vary if you use Azure OpenAI models in an Azure AI Foundry project versus outside a project.
17
+
>
18
+
19
+
| Model ID | Standard Training Regions | Global Training (Preview) | Max request (tokens) | Training Data (up to) | Modality |
20
+
| --- | --- | :---: | :---: | :---: | --- |
21
+
|`gpt-35-turbo` (1106) | East US2 <br> North Central US <br> Sweden Central <br> Switzerland West | - | Input: 16,385<br> Output: 4,096 | Sep 2021 | Text to Text |
22
+
|`gpt-35-turbo` (0125) | East US2 <br> North Central US <br> Sweden Central <br> Switzerland West | - | 16,385 | Sep 2021 | Text to Text |
23
+
|`gpt-4o-mini` (2024-07-18) | North Central US <br> Sweden Central | - | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | Oct 2023 | Text to Text |
24
+
|`gpt-4o` (2024-08-06) | East US2 <br> North Central US <br> Sweden Central | - | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | Oct 2023 | Text & Vision to Text |
25
+
|`gpt-4.1` (2025-04-14) | North Central US <br> Sweden Central | ✅ | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | May 2024 | Text & Vision to Text |
26
+
|`gpt-4.1-mini` (2025-04-14) | North Central US <br> Sweden Central | ✅ | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | May 2024 | Text to Text |
27
+
|`gpt-4.1-nano` (2025-04-14) | North Central US <br> Sweden Central | ✅ | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 32,768 | May 2024 | Text to Text |
17
28
18
-
| Model ID | Fine-tuning regions | Max request (tokens) | Training Data (up to) | Modality |
19
-
| --- | --- | :---: | :---: | --- |
20
-
|`gpt-35-turbo` (1106) | East US2 <br> North Central US <br> Sweden Central <br> Switzerland West | Input: 16,385<br> Output: 4,096 | Sep 2021 | Text to Text |
21
-
|`gpt-35-turbo` (0125) | East US2 <br> North Central US <br> Sweden Central <br> Switzerland West | 16,385 | Sep 2021 | Text to Text |
22
-
|`gpt-4o-mini` (2024-07-18) | North Central US <br> Sweden Central | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | Oct 2023 | Text to Text |
23
-
|`gpt-4o` (2024-08-06) | East US2 <br> North Central US <br> Sweden Central | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | Oct 2023 | Text & Vision to Text |
24
-
|`gpt-4.1` (2025-04-14) | North Central US <br> Sweden Central | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | May 2024 | Text & Vision to Text |
25
-
|`gpt-4.1-mini` (2025-04-14) | North Central US <br> Sweden Central | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 65,536 | May 2024 | Text to Text |
26
-
|`gpt-4.1-nano` (2025-04-14) | North Central US <br> Sweden Central | Input: 128,000 <br> Output: 16,384 <br> Training example context length: 32,768 | May 2024 | Text to Text |
29
+
> [!NOTE]
30
+
> **Global** training (in Public Preview) provides [more affordable](https://aka.ms/aoai-pricing) training per-token, but does not offer [data residency](https://aka.ms/data-residency). It is currently available to Azure OpenAI resources in the following regions, with more regions coming soon:
- Read the [When to use Azure OpenAI fine-tuning guide](../concepts/fine-tuning-considerations.md).
17
-
18
15
- An Azure subscription - <ahref="https://azure.microsoft.com/free/cognitive-services"target="_blank">Create one for free</a>.
19
16
- An [Azure AI project](../../../ai-foundry/how-to/create-projects.md) in Azure AI Foundry portal.
20
17
- An [Azure OpenAI connection](/azure/ai-foundry/how-to/connections-add?tabs=azure-openai#connection-details) to a resource in a [region where fine-tuning is supported](/azure/ai-services/openai/concepts/models#fine-tuning-models).
- If you do not already have access to view quota, and deploy models in Azure AI Foundry portal you will require [additional permissions](../how-to/role-based-access-control.md).
22
22
23
+
> [!NOTE]
24
+
> The REST API does not currently support **Global** training jobs. Inspecting Global training jobs via the API may return incorrect information.
23
25
24
26
### Supported models
25
27
26
-
The following models support fine-tuning:
27
-
28
-
-`gpt-35-turbo` (1106)
29
-
-`gpt-35-turbo` (0125)
30
-
-`gpt-4o` (2024-08-06)
31
-
-`gpt-4o-mini` (2024-07-18)
32
-
-`gpt-4.1` (2024-04-14)
33
-
-`gpt-4.1-mini`(2025-04-14)
28
+
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
34
29
35
30
Or you can fine tune a previously fine-tuned model, formatted as `base-model.ft-{jobid}`.
36
31
37
-
38
-
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
39
-
40
32
## Review the workflow for the Python SDK
41
33
42
34
Take a moment to review the fine-tuning workflow for using the Python SDK with Azure OpenAI:
@@ -155,7 +147,7 @@ In this example we are also passing the seed parameter. The seed controls the re
155
147
response = client.fine_tuning.jobs.create(
156
148
training_file=training_file_id,
157
149
validation_file=validation_file_id,
158
-
model="gpt-35-turbo-0125", # Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
150
+
model="gpt-4.1-2025-04-14", # Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
159
151
seed=105# seed parameter controls reproducibility of the fine-tuning job. If no seed is specified one will be generated automatically.
160
152
)
161
153
@@ -193,7 +185,7 @@ client = AzureOpenAI(
193
185
194
186
client.fine_tuning.jobs.create(
195
187
training_file="file-abc123",
196
-
model="gpt-35-turbo-0125", # Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
188
+
model="gpt-4.1-2025-04-14", # Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
197
189
hyperparameters={
198
190
"n_epochs":2
199
191
}
@@ -278,13 +270,64 @@ Once you're satisfied with the metrics from your fine-tuning job, or you just wa
278
270
279
271
If you're deploying for further validation, consider deploying for [testing](../how-to/fine-tune-test.md?tabs=python) using a Developer deployment.
280
272
273
+
Unlike the previous SDK commands, deployment must be done using the control plane API which requires separate authorization, a different API path, and a different API version.
274
+
275
+
|variable | Definition|
276
+
|--------------|-----------|
277
+
| token | There are multiple ways to generate an authorization token. The easiest method for initial testing is to launch the Cloud Shell from the [Azure portal](https://portal.azure.com). Then run [`az account get-access-token`](/cli/azure/account#az-account-get-access-token()). You can use this token as your temporary authorization token for API testing. We recommend storing this in a new environment variable. |
278
+
| subscription | The subscription ID for the associated Azure OpenAI resource. |
279
+
| resource_group | The resource group name for your Azure OpenAI resource. |
280
+
| resource_name | The Azure OpenAI resource name. |
281
+
| model_deployment_name | The custom name for your new fine-tuned model deployment. This is the name that will be referenced in your code when making chat completion calls. |
282
+
| fine_tuned_model | Retrieve this value from your fine-tuning job results in the previous step. It will look like `gpt-4.1-2025-04-14.ft-b044a9d3cf9c4228b5d393567f693b83`. You will need to add that value to the deploy_data json. Alternatively you can also deploy a checkpoint, by passing the checkpoint ID which will appear in the format `ftchkpt-e559c011ecc04fc68eaa339d8227d02d`|
r = requests.put(request_url, params=deploy_params, headers=deploy_headers, data=deploy_data)
315
+
316
+
print(r)
317
+
print(r.reason)
318
+
print(r.json())
319
+
320
+
```
321
+
322
+
Learn more about cross region deployment and use the deployed model [here](../how-to/fine-tuning-deploy.md#use-your-deployed-fine-tuned-model).
323
+
281
324
If you're ready to deploy for production or have particular data residency needs, follow our [deployment guide](../how-to/fine-tuning-deploy.md?tabs=python).
282
325
283
326
## Continuous fine-tuning
284
327
285
328
Once you have created a fine-tuned model you might want to continue to refine the model over time through further fine-tuning. Continuous fine-tuning is the iterative process of selecting an already fine-tuned model as a base model and fine-tuning it further on new sets of training examples.
286
329
287
-
To perform fine-tuning on a model that you have previously fine-tuned you would use the same process as described in [create a customized model](#create-a-customized-model) but instead of specifying the name of a generic base model you would specify your already fine-tuned model's ID. The fine-tuned model ID looks like `gpt-35-turbo-0125.ft-5fd1918ee65d4cd38a5dcf6835066ed7`
330
+
To perform fine-tuning on a model that you have previously fine-tuned you would use the same process as described in [create a customized model](#create-a-customized-model) but instead of specifying the name of a generic base model you would specify your already fine-tuned model's ID. The fine-tuned model ID looks like `gpt-4.1-2025-04-14.ft-5fd1918ee65d4cd38a5dcf6835066ed7`
288
331
289
332
```python
290
333
from openai import AzureOpenAI
@@ -298,7 +341,7 @@ client = AzureOpenAI(
298
341
response = client.fine_tuning.jobs.create(
299
342
training_file=training_file_id,
300
343
validation_file=validation_file_id,
301
-
model="gpt-35-turbo-0125.ft-5fd1918ee65d4cd38a5dcf6835066ed7"# Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
- If you don't already have access to view quota, and deploy models in Azure AI Foundry portal you'll require [additional permissions](../how-to/role-based-access-control.md).
20
20
21
-
21
+
> [!NOTE]
22
+
> The REST API does not currently support **Global** training jobs. Inspecting Global training jobs via the API may return incorrect information.
22
23
23
24
### Supported models
24
25
25
-
The following models support fine-tuning:
26
-
27
-
-`gpt-35-turbo` (1106)
28
-
-`gpt-35-turbo` (0125)
29
-
-`gpt-4o` (2024-08-06)
30
-
-`gpt-4o-mini` (2024-07-18)
31
-
-`gpt-4.1` (2024-04-14)
32
-
-`gpt-4.1-mini`(2025-04-14)
33
-
34
-
Or you can fine tune a previously fine-tuned model, formatted as base-model.ft-{jobid}.
35
-
36
26
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
37
27
28
+
Or you can fine tune a previously fine-tuned model, formatted as base-model.ft-{jobid}.
38
29
39
30
40
31
## Review the workflow for the REST API
@@ -138,7 +129,7 @@ curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2024-10-
138
129
-H "Content-Type: application/json" \
139
130
-H "api-key: $AZURE_OPENAI_API_KEY" \
140
131
-d '{
141
-
"model": "gpt-35-turbo-0125",
132
+
"model": "gpt-4.1-2025-04-14",
142
133
"training_file": "<TRAINING_FILE_ID>",
143
134
"validation_file": "<VALIDATION_FILE_ID>",
144
135
"seed": 105
@@ -229,20 +220,47 @@ If you're deploying for further validation, consider deploying for [testing](../
229
220
230
221
If you're ready to deploy for production or have particular data residency needs, follow our [deployment guide](../how-to/fine-tuning-deploy.md?tabs=rest).
231
222
223
+
|variable | Definition|
224
+
|--------------|-----------|
225
+
| token | There are multiple ways to generate an authorization token. The easiest method for initial testing is to launch the Cloud Shell from the [Azure portal](https://portal.azure.com). Then run [`az account get-access-token`](/cli/azure/account#az-account-get-access-token()). You can use this token as your temporary authorization token for API testing. We recommend storing this in a new environment variable. |
226
+
| subscription | The subscription ID for the associated Azure OpenAI resource. |
227
+
| resource_group | The resource group name for your Azure OpenAI resource. |
228
+
| resource_name | The Azure OpenAI resource name. |
229
+
| model_deployment_name | The custom name for your new fine-tuned model deployment. This is the name that will be referenced in your code when making chat completion calls. |
230
+
| fine_tuned_model | Retrieve this value from your fine-tuning job results in the previous step. It will look like `gpt-4.1-2025-04-14.ft-b044a9d3cf9c4228b5d393567f693b83`. You'll need to add that value to the deploy_data json. Alternatively you can also deploy a checkpoint, by passing the checkpoint ID which will appear in the format `ftchkpt-e559c011ecc04fc68eaa339d8227d02d`|
231
+
232
+
```bash
233
+
curl -X POST "https://management.azure.com/subscriptions/<SUBSCRIPTION>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.CognitiveServices/accounts/<RESOURCE_NAME>/deployments/<MODEL_DEPLOYMENT_NAME>api-version=2024-10-21" \
234
+
-H "Authorization: Bearer <TOKEN>" \
235
+
-H "Content-Type: application/json" \
236
+
-d '{
237
+
"sku": {"name": "standard", "capacity": 1},
238
+
"properties": {
239
+
"model": {
240
+
"format": "OpenAI",
241
+
"name": "<FINE_TUNED_MODEL>",
242
+
"version": "1"
243
+
}
244
+
}
245
+
}'
246
+
```
247
+
248
+
Learn more about cross region deployment and use the deployed model [here](../how-to/fine-tuning-deploy.md#use-your-deployed-fine-tuned-model).
249
+
232
250
233
251
## Continuous fine-tuning
234
252
235
253
Once you have created a fine-tuned model, you might want to continue to refine the model over time through further fine-tuning. Continuous fine-tuning is the iterative process of selecting an already fine-tuned model as a base model and fine-tuning it further on new sets of training examples.
236
254
237
-
To perform fine-tuning on a model that you have previously fine-tuned, you would use the same process as described in [create a customized model](#create-a-customized-model) but instead of specifying the name of a generic base model you would specify your already fine-tuned model's ID. The fine-tuned model ID looks like `gpt-35-turbo-0125.ft-5fd1918ee65d4cd38a5dcf6835066ed7`
255
+
To perform fine-tuning on a model that you have previously fine-tuned, you would use the same process as described in [create a customized model](#create-a-customized-model) but instead of specifying the name of a generic base model you would specify your already fine-tuned model's ID. The fine-tuned model ID looks like `gpt-4.1-2025-04-14.ft-5fd1918ee65d4cd38a5dcf6835066ed7`
238
256
239
257
```bash
240
258
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2023-12-01-preview \
0 commit comments