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-studio/how-to/deploy-models-phi-4.md
+96-28Lines changed: 96 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Learn how to use Phi-4 family chat models with Azure AI Foundry.
5
5
ms.service: azure-ai-foundry
6
6
manager: scottpolly
7
7
ms.topic: how-to
8
-
ms.date: 01/09/2025
8
+
ms.date: 02/25/2025
9
9
ms.reviewer: v-vkonjarla
10
10
reviewer: VindyaKonjarla
11
11
ms.author: mopeakande
@@ -27,18 +27,35 @@ The Phi-4 family of small language models (SLMs) is a collection of instruction-
27
27
28
28
## Phi-4 family chat models
29
29
30
+
The Phi-4 family chat models include the following models:
31
+
32
+
# [Phi-4-mini-instruct](#tab/phi-4-mini-instruct)
33
+
34
+
Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4 model family and supports 128K token context length. The model underwent an enhancement process, incorporating both supervised fine-tuning and direct preference optimization to support precise instruction adherence and robust safety measures.
35
+
36
+
The Phi-4-mini-instruct model comes in the following variant with a 128K token length.
Phi-4 is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.
31
47
32
48
Phi-4 underwent a rigorous enhancement and alignment process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures.
49
+
The Phi-4 model comes in the following variant with a 16K token length.
33
50
34
-
The Phi-4 models come in the following variants with a 16K tokens length.
35
51
36
-
37
-
You can learn more about the models in their respective model card:
52
+
The following models are available:
38
53
39
54
*[Phi-4](https://aka.ms/azureai/landing/Phi-4)
40
55
41
56
57
+
---
58
+
42
59
## Prerequisites
43
60
44
61
To use Phi-4 family chat models with Azure AI Foundry, you need the following prerequisites:
> Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
179
+
> Phi-4-mini-instruct and Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
163
180
164
181
The response is as follows, where you can see the model's usage statistics:
Response: As of now, it's estimated that there are about 7,000 languages spoken around the world. However, this number can vary as some languages become extinct and new ones develop. It's also important to note that the number of speakers can greatly vary between languages, with some having millions of speakers and others only a few hundred.
178
-
Model: Phi-4
195
+
Model: Phi-4-mini-instruct
179
196
Usage:
180
197
Prompt tokens: 19
181
198
Total tokens: 91
@@ -322,18 +339,35 @@ except HttpResponseError as ex:
322
339
323
340
## Phi-4 family chat models
324
341
342
+
The Phi-4 family chat models include the following models:
343
+
344
+
# [Phi-4-mini-instruct](#tab/phi-4-mini-instruct)
345
+
346
+
Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4 model family and supports 128K token context length. The model underwent an enhancement process, incorporating both supervised fine-tuning and direct preference optimization to support precise instruction adherence and robust safety measures.
347
+
348
+
The Phi-4-mini-instruct model comes in the following variant with a 128K token length.
Phi-4 is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.
326
359
327
360
Phi-4 underwent a rigorous enhancement and alignment process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures.
361
+
The Phi-4 model comes in the following variant with a 16K token length.
328
362
329
-
The Phi-4 models come in the following variants with a 16K tokens length.
330
363
331
-
332
-
You can learn more about the models in their respective model card:
364
+
The following models are available:
333
365
334
366
*[Phi-4](https://aka.ms/azureai/landing/Phi-4)
335
367
336
368
369
+
---
370
+
337
371
## Prerequisites
338
372
339
373
To use Phi-4 family chat models with Azure AI Foundry, you need the following prerequisites:
@@ -454,7 +488,7 @@ var response = await client.path("/chat/completions").post({
454
488
```
455
489
456
490
> [!NOTE]
457
-
> Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
491
+
> Phi-4-mini-instruct and Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
458
492
459
493
The response is as follows, where you can see the model's usage statistics:
Response: As of now, it's estimated that there are about 7,000 languages spoken around the world. However, this number can vary as some languages become extinct and new ones develop. It's also important to note that the number of speakers can greatly vary between languages, with some having millions of speakers and others only a few hundred.
477
-
Model: Phi-4
511
+
Model: Phi-4-mini-instruct
478
512
Usage:
479
513
Prompt tokens: 19
480
514
Total tokens: 91
@@ -640,18 +674,35 @@ catch (error) {
640
674
641
675
## Phi-4 family chat models
642
676
677
+
The Phi-4 family chat models include the following models:
678
+
679
+
# [Phi-4-mini-instruct](#tab/phi-4-mini-instruct)
680
+
681
+
Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4 model family and supports 128K token context length. The model underwent an enhancement process, incorporating both supervised fine-tuning and direct preference optimization to support precise instruction adherence and robust safety measures.
682
+
683
+
The Phi-4-mini-instruct model comes in the following variant with a 128K token length.
Phi-4 is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.
644
694
645
695
Phi-4 underwent a rigorous enhancement and alignment process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures.
696
+
The Phi-4 model comes in the following variant with a 16K token length.
646
697
647
-
The Phi-4 models come in the following variants with a 16K tokens length.
648
698
649
-
650
-
You can learn more about the models in their respective model card:
699
+
The following models are available:
651
700
652
701
* [Phi-4](https://aka.ms/azureai/landing/Phi-4)
653
702
654
703
704
+
---
705
+
655
706
## Prerequisites
656
707
657
708
To use Phi-4 family chat models with Azure AI Foundry, you need the following prerequisites:
> Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
840
+
> Phi-4-mini-instruct and Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
790
841
791
842
The response is as follows, where you can see the model's usage statistics:
Response: As of now, it's estimated that there are about 7,000 languages spoken around the world. However, this number can vary as some languages become extinct and new ones develop. It's also important to note that the number of speakers can greatly vary between languages, with some having millions of speakers and others only a few hundred.
The Phi-4 family chat models include the following models:
1025
+
1026
+
# [Phi-4-mini-instruct](#tab/phi-4-mini-instruct)
1027
+
1028
+
Phi-4-mini-instruct is a lightweight open model built upon synthetic data and filtered publicly available websites -with a focus on high-quality, reasoning dense data. The model belongs to the Phi-4 model family and supports 128K token context length. The model underwent an enhancement process, incorporating both supervised fine-tuning and direct preference optimization to support precise instruction adherence and robust safety measures.
1029
+
1030
+
The Phi-4-mini-instruct model comes in the following variant with a 128K token length.
Phi-4 is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&Adatasets. The goal ofthis approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning.
974
1041
975
1042
Phi-4 underwent a rigorous enhancement and alignment process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures.
1043
+
The Phi-4 model comes in the following variant with a 16K token length.
976
1044
977
-
The Phi-4 models come in the following variants with a 16K tokens length.
978
1045
979
-
980
-
You can learn more about the models in their respective model card:
1046
+
The following models are available:
981
1047
982
1048
* [Phi-4](https://aka.ms/azureai/landing/Phi-4)
983
1049
984
1050
1051
+
---
1052
+
985
1053
## Prerequisites
986
1054
987
1055
To use Phi-4 family chat models with Azure AI Foundry, you need the following prerequisites:
@@ -1045,7 +1113,7 @@ The response is as follows:
1045
1113
1046
1114
```json
1047
1115
{
1048
-
"model_name": "Phi-4",
1116
+
"model_name": "Phi-4-mini-instruct",
1049
1117
"model_type": "chat-completions",
1050
1118
"model_provider_name": "Microsoft"
1051
1119
}
@@ -1071,7 +1139,7 @@ The following example shows how you can create a basic chat completions request
1071
1139
```
1072
1140
1073
1141
> [!NOTE]
1074
-
> Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
1142
+
> Phi-4-mini-instruct and Phi-4 don't support system messages (`role="system"`). When you use the Azure AI model inference API, system messages are translated to user messages, which is the closest capability available. This translation is offered for convenience, but it's important for you to verify that the model is following the instructions in the system message with the right level of confidence.
1075
1143
1076
1144
The response is as follows, where you can see the model's usage statistics:
1077
1145
@@ -1081,7 +1149,7 @@ The response is as follows, where you can see the model's usage statistics:
1081
1149
"id": "0a1234b5de6789f01gh2i345j6789klm",
1082
1150
"object": "chat.completion",
1083
1151
"created": 1718726686,
1084
-
"model": "Phi-4",
1152
+
"model": "Phi-4-mini-instruct",
1085
1153
"choices": [
1086
1154
{
1087
1155
"index": 0,
@@ -1138,7 +1206,7 @@ You can visualize how streaming generates content:
1138
1206
"id": "23b54589eba14564ad8a2e6978775a39",
1139
1207
"object": "chat.completion.chunk",
1140
1208
"created": 1718726371,
1141
-
"model": "Phi-4",
1209
+
"model": "Phi-4-mini-instruct",
1142
1210
"choices": [
1143
1211
{
1144
1212
"index": 0,
@@ -1161,7 +1229,7 @@ The last message in the stream has `finish_reason` set, indicating the reason fo
1161
1229
"id": "23b54589eba14564ad8a2e6978775a39",
1162
1230
"object": "chat.completion.chunk",
1163
1231
"created": 1718726371,
1164
-
"model": "Phi-4",
1232
+
"model": "Phi-4-mini-instruct",
1165
1233
"choices": [
1166
1234
{
1167
1235
"index": 0,
@@ -1212,7 +1280,7 @@ Explore other parameters that you can specify in the inference client. For a ful
| Model | Offer Availability Region | Hub/Project Region for Deployment | Hub/Project Region for Fine tuning |
63
63
|---------|---------|---------|---------|
64
-
Phi-4 | Not applicable | East US <br> East US 2 <br> North Central US <br> South Central US <br> Sweden Central <br> West US <br> West US 3 | Not available |
64
+
Phi-4 <br> Phi-4-mini-instruct | Not applicable | East US <br> East US 2 <br> North Central US <br> South Central US <br> Sweden Central <br> West US <br> West US 3 | Not available |
65
65
Phi-3.5-vision-Instruct | Not applicable | East US <br> East US 2 <br> North Central US <br> South Central US <br> Sweden Central <br> West US <br> West US 3 | Not available |
66
66
Phi-3.5-MoE-Instruct | Not applicable | East US <br> East US 2 <br> North Central US <br> South Central US <br> Sweden Central <br> West US <br> West US 3 | East US 2 |
67
67
Phi-3.5-Mini-Instruct | Not applicable | East US <br> East US 2 <br> North Central US <br> South Central US <br> Sweden Central <br> West US <br> West US 3 | East US 2 | East US 2 |
0 commit comments