Skip to content

Commit eb89342

Browse files
Merge pull request #4931 from voutilad/global-training
Update Fine Tuning walkthrough and add Global Training
2 parents 0f868c1 + 19a5d88 commit eb89342

19 files changed

+192
-100
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ _repo.*/
1111

1212
.openpublishing.buildcore.ps1
1313

14+
*sec.endpointdlp
15+
1416
# CoPilot instructions and prompts
1517
.github/copilot-instructions.md
16-
.github/prompts/*.md
18+
.github/prompts/*.md

articles/ai-services/openai/includes/fine-tune-models.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,29 @@ manager: nitinme
1414
> `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.
1515
>
1616
> 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 |
1728

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:
31+
>- Australia East
32+
>- Brazil South
33+
>- France Central
34+
>- Germany West Central
35+
>- Italy North
36+
>- Japan East _(no vision support)_
37+
>- Korea Central
38+
>- Norway East
39+
>- Poland Central
40+
>- Southeast Asia
41+
>- Spain Central
42+
>- South Africa North

articles/ai-services/openai/includes/fine-tuning-openai-in-ai-studio.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
ms.custom: include, build-2024
1010
---
1111

12-
[!INCLUDE [Feature preview](~/reusable-content/ce-skilling/azure/includes/ai-studio/includes/feature-preview.md)]
13-
1412
## Prerequisites
1513

1614
- Read the [When to use Azure OpenAI fine-tuning guide](../concepts/fine-tuning-considerations.md).
17-
1815
- An Azure subscription - <a href="https://azure.microsoft.com/free/cognitive-services" target="_blank">Create one for free</a>.
1916
- An [Azure AI project](../../../ai-foundry/how-to/create-projects.md) in Azure AI Foundry portal.
2017
- 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).
@@ -25,26 +22,18 @@ ms.custom: include, build-2024
2522

2623
### Supported models
2724

28-
The following models support fine-tuning:
29-
30-
- `gpt-35-turbo` (1106)
31-
- `gpt-35-turbo` (0125)
32-
- `gpt-4o` (2024-08-06)
33-
- `gpt-4o-mini` (2024-07-18)
34-
- `gpt-4.1` (2024-04-14)
35-
- `gpt-4.1-mini`(2025-04-14)
25+
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
3626

3727
Or you can fine tune a previously fine-tuned model, formatted as base-model.ft-{jobid}.
3828

39-
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
40-
4129
## Review the workflow for Azure AI Foundry
4230

4331
Take a moment to review the fine-tuning workflow for using Azure AI Foundry:
4432

4533
1. Prepare your training and validation data.
46-
1. Use the **Fine-tune model** wizard in Azure AI Foundry portal to train your custom model.
47-
1. Select a model to finetune.
34+
1. Use the **Create a fine-tuned model** wizard in Azure AI Foundry portal to train your custom model.
35+
1. Select a training method.
36+
1. Select a base model.
4837
1. [Choose your training data](#choose-your-training-data).
4938
1. Optionally, [choose your validation data](#choose-your-validation-data).
5039
1. Optionally, [configure your parameters](#configure-your-parameters) for your fine-tuning job.

articles/ai-services/openai/includes/fine-tuning-python.md

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,15 @@ ms.author: mbullwin
2020
- Fine-tuning access requires **Cognitive Services OpenAI Contributor**.
2121
- 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).
2222

23+
> [!NOTE]
24+
> The REST API does not currently support **Global** training jobs. Inspecting Global training jobs via the API may return incorrect information.
2325
2426
### Supported models
2527

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.
3429

3530
Or you can fine tune a previously fine-tuned model, formatted as `base-model.ft-{jobid}`.
3631

37-
38-
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
39-
4032
## Review the workflow for the Python SDK
4133

4234
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
155147
response = client.fine_tuning.jobs.create(
156148
training_file=training_file_id,
157149
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.
159151
seed = 105 # seed parameter controls reproducibility of the fine-tuning job. If no seed is specified one will be generated automatically.
160152
)
161153

@@ -193,7 +185,7 @@ client = AzureOpenAI(
193185

194186
client.fine_tuning.jobs.create(
195187
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.
197189
hyperparameters={
198190
"n_epochs":2
199191
}
@@ -278,13 +270,64 @@ Once you're satisfied with the metrics from your fine-tuning job, or you just wa
278270

279271
If you're deploying for further validation, consider deploying for [testing](../how-to/fine-tune-test.md?tabs=python) using a Developer deployment.
280272

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` |
283+
284+
```python
285+
import json
286+
import os
287+
import requests
288+
289+
token= os.getenv("<TOKEN>")
290+
subscription = "<YOUR_SUBSCRIPTION_ID>"
291+
resource_group = "<YOUR_RESOURCE_GROUP_NAME>"
292+
resource_name = "<YOUR_AZURE_OPENAI_RESOURCE_NAME>"
293+
model_deployment_name ="gpt-41-ft" # custom deployment name that you will use to reference the model when making inference calls.
294+
295+
deploy_params = {'api-version': "2024-10-01"} # control plane API version rather than dataplane API for this call
296+
deploy_headers = {'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json'}
297+
298+
deploy_data = {
299+
"sku": {"name": "standard", "capacity": 1},
300+
"properties": {
301+
"model": {
302+
"format": "OpenAI",
303+
"name": <"fine_tuned_model">, #retrieve this value from the previous call, it will look like gpt-4.1-2025-04-14.ft-b044a9d3cf9c4228b5d393567f693b83
304+
"version": "1"
305+
}
306+
}
307+
}
308+
deploy_data = json.dumps(deploy_data)
309+
310+
request_url = f'https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.CognitiveServices/accounts/{resource_name}/deployments/{model_deployment_name}'
311+
312+
print('Creating a new deployment...')
313+
314+
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+
281324
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).
282325

283326
## Continuous fine-tuning
284327

285328
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.
286329

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`
288331

289332
```python
290333
from openai import AzureOpenAI
@@ -298,7 +341,7 @@ client = AzureOpenAI(
298341
response = client.fine_tuning.jobs.create(
299342
training_file=training_file_id,
300343
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.
344+
model="gpt-4.1-2025-04-14.ft-5fd1918ee65d4cd38a5dcf6835066ed7"
302345
)
303346

304347
job_id = response.id

articles/ai-services/openai/includes/fine-tuning-rest.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,14 @@ ms.author: mbullwin
1818
- Fine-tuning access requires **Cognitive Services OpenAI Contributor**.
1919
- 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).
2020

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.
2223
2324
### Supported models
2425

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-
3626
Consult the [models page](../concepts/models.md#fine-tuning-models) to check which regions currently support fine-tuning.
3727

28+
Or you can fine tune a previously fine-tuned model, formatted as base-model.ft-{jobid}.
3829

3930

4031
## 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-
138129
-H "Content-Type: application/json" \
139130
-H "api-key: $AZURE_OPENAI_API_KEY" \
140131
-d '{
141-
"model": "gpt-35-turbo-0125",
132+
"model": "gpt-4.1-2025-04-14",
142133
"training_file": "<TRAINING_FILE_ID>",
143134
"validation_file": "<VALIDATION_FILE_ID>",
144135
"seed": 105
@@ -229,20 +220,47 @@ If you're deploying for further validation, consider deploying for [testing](../
229220

230221
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).
231222

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+
232250

233251
## Continuous fine-tuning
234252

235253
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.
236254

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`
238256

239257
```bash
240258
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2023-12-01-preview \
241259
-H "Content-Type: application/json" \
242260
-H "api-key: $AZURE_OPENAI_API_KEY" \
243261
-d '{
244-
"model": "gpt-35-turbo-0125.ft-5fd1918ee65d4cd38a5dcf6835066ed7",
245-
"training_file": "<TRAINING_FILE_ID>",
262+
"model": "gpt-4.1-2025-04-14.ft-5fd1918ee65d4cd38a5dcf6835066ed7",
263+
"training_file": "<TRAINING_FILE_ID>",
246264
"validation_file": "<VALIDATION_FILE_ID>",
247265
"suffix": "<additional text used to help identify fine-tuned models>"
248266
}'

0 commit comments

Comments
 (0)