Skip to content

Commit 8ff7ad3

Browse files
authored
Merge pull request #1500 from ssalgadodev/patch-25
Update deploy-models-phi-3.md
2 parents 36824f4 + a17e9af commit 8ff7ad3

File tree

3 files changed

+63
-21
lines changed

3 files changed

+63
-21
lines changed

articles/ai-studio/how-to/deploy-models-phi-3.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,10 @@ Phi-3 family models deployed to managed compute are billed based on core hours o
14761476
14771477
It is a good practice to start with a low number of instances and scale up as needed. You can monitor the cost of the compute instance in the Azure portal.
14781478
1479+
## Sample notebook
1480+
1481+
You can use this [sample notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/jobs/finetuning/standalone/chat-completion/chat_completion_with_model_as_service.ipynb) to create a standalone fine-tuning job to enhance a model's ability to summarize dialogues between two people using the Samsum dataset. The training data utilized is the ultrachat_200k dataset, which is divided into four splits suitable for supervised fine-tuning (sft) and generation ranking (gen). The notebook employs the available Azure AI models for the chat-completion task (If you would like to use a different model than what's used in the notebook, you can replace the model name). The notebook includes setting up prerequisites, selecting a model to fine-tune, creating training and validation datasets, configuring and submitting the fine-tuning job, and finally, creating a serverless deployment using the fine-tuned model for sample inference.
1482+
14791483
## Related content
14801484
14811485

articles/ai-studio/how-to/fine-tune-model-llama.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ Each time a project subscribes to a given offer from the Azure Marketplace, a ne
269269

270270
For more information on how to track costs, see [monitor costs for models offered throughout the Azure Marketplace](./costs-plan-manage.md#monitor-costs-for-models-offered-through-the-azure-marketplace).
271271

272+
## Sample notebook
273+
274+
You can use this [sample notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/jobs/finetuning/standalone/chat-completion/chat_completion_with_model_as_service.ipynb) to create a standalone fine-tuning job to enhance a model's ability to summarize dialogues between two people using the Samsum dataset. The training data utilized is the ultrachat_200k dataset, which is divided into four splits suitable for supervised fine-tuning (sft) and generation ranking (gen). The notebook employs the available Azure AI models for the chat-completion task (If you would like to use a different model than what's used in the notebook, you can replace the model name). The notebook includes setting up prerequisites, selecting a model to fine-tune, creating training and validation datasets, configuring and submitting the fine-tuning job, and finally, creating a serverless deployment using the fine-tuned model for sample inference.
275+
272276
## Content filtering
273277

274278
Models deployed as a service with pay-as-you-go billing are protected by Azure AI Content Safety. When deployed to real-time endpoints, you can opt out of this capability. With Azure AI content safety enabled, both the prompt and completion pass through an ensemble of classification models aimed at detecting and preventing the output of harmful content. The content filtering (preview) system detects and takes action on specific categories of potentially harmful content in both input prompts and output completions. Learn more about [Azure AI Content Safety](../concepts/content-filtering.md).

articles/ai-studio/how-to/fine-tune-phi-3.md

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,46 +21,39 @@ The Phi-3 family of SLMs is a collection of instruction-tuned generative text mo
2121

2222
[!INCLUDE [models-preview](../includes/models-preview.md)]
2323

24-
## [Phi-3-mini](#tab/phi-3-mini)
24+
# [Phi-3-mini](#tab/phi-3-mini)
2525

2626
Phi-3 Mini is a 3.8B parameters, lightweight, state-of-the-art open model built upon datasets used for Phi-2 - synthetic data and filtered websites - with a focus on high-quality, reasoning dense data. The model belongs to the Phi-3 model family, and the Mini version comes in two variants 4K and 128K which is the context length (in tokens) it can support.
2727

28-
- [Phi-3-mini-4k-Instruct](https://ai.azure.com/explore/models/Phi-3-mini-4k-instruct/version/4/registry/azureml)
29-
- [Phi-3-mini-128k-Instruct](https://ai.azure.com/explore/models/Phi-3-mini-128k-instruct/version/4/registry/azureml)
28+
- [Phi-3-mini-4k-Instruct](https://ai.azure.com/explore/models/Phi-3-mini-4k-instruct/version/4/registry/azureml) (preview)
29+
- [Phi-3-mini-128k-Instruct](https://ai.azure.com/explore/models/Phi-3-mini-128k-instruct/version/4/registry/azureml) (preview)
3030

3131
The model underwent a rigorous enhancement process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures. When assessed against benchmarks testing common sense, language understanding, math, code, long context and logical reasoning, Phi-3 Mini-4K-Instruct and Phi-3 Mini-128K-Instruct showcased a robust and state-of-the-art performance among models with less than 13 billion parameters.
3232

3333

34-
## [Phi-3-medium](#tab/phi-3-medium)
34+
# [Phi-3-medium](#tab/phi-3-medium)
3535
Phi-3 Medium is a 14B parameters, lightweight, state-of-the-art open model. Phi-3-Medium was trained with Phi-3 datasets that include both synthetic data and the filtered, publicly available websites data, with a focus on high quality and reasoning-dense properties.
3636

3737
The model belongs to the Phi-3 model family, and the Medium version comes in two variants, 4K and 128K, which denote the context length (in tokens) that each model variant can support.
3838

39-
- Phi-3-medium-4k-Instruct
40-
- Phi-3-medium-128k-Instruct
39+
- Phi-3-medium-4k-Instruct (preview)
40+
- Phi-3-medium-128k-Instruct (preview)
4141

4242
The model underwent a rigorous enhancement process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures. When assessed against benchmarks that test common sense, language understanding, math, code, long context and logical reasoning, Phi-3-Medium-4k-Instruct and Phi-3-Medium-128k-Instruct showcased a robust and state-of-the-art performance among models with less than 13 billion parameters.
4343

44-
---
45-
46-
47-
## [Phi-3-mini](#tab/phi-3-mini)
4844

49-
The following models are available in Azure AI Studio for Phi 3 when fine-tuning as a service with pay-as-you-go:
45+
# [Phi-3.5](#tab/phi-3-5)
5046

51-
- `Phi-3-mini-4k-instruct` (preview)
52-
- `Phi-3-mini-128k-instruct` (preview)
5347

54-
Fine-tuning of Phi-3 models is currently supported in projects located in East US 2.
48+
Phi-3.5-mini-Instruct is a 3.8B parameter model enhances multi-lingual support, reasoning capability, and offers an extended context length of 128K tokens
5549

56-
## [Phi-3-medium](#tab/phi-3-medium)
50+
Phi-3.5-MoE-Instruct. Featuring 16 experts and 6.6B active parameters, this model delivers high performance, reduced latency, multi-lingual support, and robust safety measures, surpassing the capabilities of larger models while maintaining the efficacy of the Phi models.
5751

58-
The following models are available in Azure AI Studio for Phi 3 when fine-tuning as a service with pay-as-you-go:
52+
- Phi-3.5-mini-Instruct (preview)
53+
- Phi-3.5-MoE-Instruct (preview)
5954

60-
- `Phi-3-medium-4k-instruct` (preview)
61-
- `Phi-3-medium-128k-instruct` (preview)
55+
The models underwent a rigorous enhancement process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures. When assessed against benchmarks that test common sense, language understanding, math, code, long context and logical reasoning, Phi-3.5-mini-Instruct and Phi-3.5-MoE-Instruct showcased a robust and state-of-the-art performance among models with less than 13 billion parameters.
6256

63-
Fine-tuning of Phi-3 models is currently supported in projects located in East US 2.
6457

6558
---
6659

@@ -163,7 +156,45 @@ To fine-tune a Phi-3 model:
163156
1. If this is your first time fine-tuning the model in the project, you have to subscribe your project for the particular offering (for example, Phi-3-medium-128k-instruct) from Azure AI Studio. This step requires that your account has the Azure subscription permissions and resource group permissions listed in the prerequisites. Each project has its own subscription to the particular Azure AI Studio offering, which allows you to control and monitor spending. Select **Subscribe and fine-tune**.
164157

165158
> [!NOTE]
166-
> Subscribing a project to a particular Azure AI Studio offering (in this case, Phi-3-mini-128k-instruct) requires that your account has **Contributor** or **Owner** access at the subscription level where the project is created. Alternatively, your user account can be assigned a custom role that has the Azure subscription permissions and resource group permissions listed in the [prerequisites](#prerequisites).
159+
> Subscribing a project to a particular Azure AI Studio offering (in this case, Phi-3-medium-128k-instruct) requires that your account has **Contributor** or **Owner** access at the subscription level where the project is created. Alternatively, your user account can be assigned a custom role that has the Azure subscription permissions and resource group permissions listed in the [prerequisites](#prerequisites).
160+
161+
1. Once you sign up the project for the particular Azure AI Studio offering, subsequent fine-tuning of the _same_ offering in the _same_ project don't require subscribing again. Therefore, you don't need to have the subscription-level permissions for subsequent fine-tune jobs. If this scenario applies to you, select **Continue to fine-tune**.
162+
163+
1. Enter a name for your fine-tuned model and the optional tags and description.
164+
1. Select training data to fine-tune your model. See [data preparation](#data-preparation) for more information.
165+
166+
> [!NOTE]
167+
> If you have your training/validation files in a credential less datastore, you will need to allow workspace managed identity access to your datastore in order to proceed with MaaS finetuning with a credential less storage. On the "Datastore" page, after clicking "Update authentication" > Select the following option:
168+
169+
![Use workspace managed identity for data preview and profiling in Azure Machine Learning Studio.](../media/how-to/fine-tune/phi-3/credentials.png)
170+
171+
Make sure all your training examples follow the expected format for inference. To fine-tune models effectively, ensure a balanced and diverse dataset. This involves maintaining data balance, including various scenarios, and periodically refining training data to align with real-world expectations, ultimately leading to more accurate and balanced model responses.
172+
- The batch size to use for training. When set to -1, batch_size is calculated as 0.2% of examples in training set and the max is 256.
173+
- The fine-tuning learning rate is the original learning rate used for pretraining multiplied by this multiplier. We recommend experimenting with values between 0.5 and 2. Empirically, we've found that larger learning rates often perform better with larger batch sizes. Must be between 0.0 and 5.0.
174+
- Number of training epochs. An epoch refers to one full cycle through the data set.
175+
176+
1. Task parameters are an optional step and an advanced option- Tuning hyperparameter is essential for optimizing large language models (LLMs) in real-world applications. It allows for improved performance and efficient resource usage. Users can choose to keep the default settings or advanced users can customize parameters like epochs or learning rate.
177+
178+
1. Review your selections and proceed to train your model.
179+
180+
Once your model is fine-tuned, you can deploy the model and can use it in your own application, in the playground, or in prompt flow. For more information, see [How to deploy Phi-3 family of large language models with Azure AI Studio](./deploy-models-phi-3.md).
181+
182+
183+
# [Phi-3.5](#tab/phi-3-5)
184+
185+
To fine-tune a Phi-3.5 model:
186+
187+
1. Sign in to [Azure AI Studio](https://ai.azure.com).
188+
1. Choose the model you want to fine-tune from the Azure AI Studio [model catalog](https://ai.azure.com/explore/models).
189+
190+
1. On the model's **Details** page, select **fine-tune**.
191+
192+
1. Select the project in which you want to fine-tune your models. To use the pay-as-you-go model fine-tune offering, your workspace must belong to the **East US 2** region.
193+
1. On the fine-tune wizard, select the link to **Azure AI Studio Terms** to learn more about the terms of use. You can also select the **Azure AI Studio offer details** tab to learn about pricing for the selected model.
194+
1. If this is your first time fine-tuning the model in the project, you have to subscribe your project for the particular offering (for example, Phi-3.5-mini-instruct) from Azure AI Studio. This step requires that your account has the Azure subscription permissions and resource group permissions listed in the prerequisites. Each project has its own subscription to the particular Azure AI Studio offering, which allows you to control and monitor spending. Select **Subscribe and fine-tune**.
195+
196+
> [!NOTE]
197+
> Subscribing a project to a particular Azure AI Studio offering (in this case, Phi-3.5-mini-instruct) requires that your account has **Contributor** or **Owner** access at the subscription level where the project is created. Alternatively, your user account can be assigned a custom role that has the Azure subscription permissions and resource group permissions listed in the [prerequisites](#prerequisites).
167198
168199
1. Once you sign up the project for the particular Azure AI Studio offering, subsequent fine-tuning of the _same_ offering in the _same_ project don't require subscribing again. Therefore, you don't need to have the subscription-level permissions for subsequent fine-tune jobs. If this scenario applies to you, select **Continue to fine-tune**.
169200

@@ -197,10 +228,13 @@ You can delete a fine-tuned model from the fine-tuning model list in [Azure AI S
197228
198229
## Cost and quotas
199230

200-
### Cost and quota considerations for Phi-3 models fine-tuned as a service
231+
### Cost and quota considerations for Phi models fine-tuned as a service
201232

202233
Phi models fine-tuned as a service are offered by Microsoft and integrated with Azure AI Studio for use. You can find the pricing when [deploying](./deploy-models-phi-3.md) or fine-tuning the models under the Pricing and terms tab on deployment wizard.
203234

235+
## Sample notebook
236+
237+
You can use this [sample notebook](https://github.com/Azure/azureml-examples/blob/main/sdk/python/jobs/finetuning/standalone/chat-completion/chat_completion_with_model_as_service.ipynb) to create a standalone fine-tuning job to enhance a model's ability to summarize dialogues between two people using the Samsum dataset. The training data utilized is the ultrachat_200k dataset, which is divided into four splits suitable for supervised fine-tuning (sft) and generation ranking (gen). The notebook employs the available Azure AI models for the chat-completion task (If you would like to use a different model than what's used in the notebook, you can replace the model name). The notebook includes setting up prerequisites, selecting a model to fine-tune, creating training and validation datasets, configuring and submitting the fine-tuning job, and finally, creating a serverless deployment using the fine-tuned model for sample inference.
204238

205239
## Content filtering
206240

0 commit comments

Comments
 (0)