共用方式為


微調 Azure AI Studio 中的 Meta Llama 模型

重要

本文所述的部分功能可能僅適用於預覽版。 此預覽版本沒有服務等級協定,不建議將其用於生產工作負載。 可能不支援特定功能,或可能已經限制功能。 如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款

Azure AI Studio 服務可讓您使用名為「微調」的程序,為個人資料集量身打造大型語言模型。

微調為特定工作和應用程式啟用自訂和最佳化,以提供重要的價值。 這會導致改善效能、成本效益、降低延遲,以及量身打造的輸出。

在本文中,您會了解如何在 Azure AI Studio 中微調 Llama 模型。

Mmeta Llama 系列的大型語言模型 (LLM) 是一組預先定型並微調的生成式文字模型,其規模為 70 億到 700 億個參數。 該模型系列也包括專門針對對話使用案例進行最佳化的微調版本,並具備稱為 Llama-2-chat 的人類反饋強化學習 (RLHF)。

模型

目前不支援微調 Llama 3 模型。

必要條件

目前不支援微調 Llama 3 模型。

訂用帳戶提供者註冊

確認訂用帳戶已向 Microsoft.Network 資源提供者註冊。

  1. 登入 Azure 入口網站

  2. 從左側功能表中選取 [訂用帳戶]

  3. 選取您要使用的訂用帳戶。

  4. 從左側功能表中選取 [設定> 資源提供者]。

  5. 確認 Microsoft.Network 位於資源提供者清單中。 否則,請加以新增。

    Azure 入口網站中訂用帳戶資源提供者的螢幕擷取畫面。

資料準備

準備您的定型和驗證資料以微調模型。 您的定型資料和驗證資料集包含您想要執行模型之方式的輸入和輸出範例。

請確定所有定型範例都遵循預期的推斷格式。 若要有效地微調模型,請確定平衡且多樣化的資料集。

這涉及維護資料平衡,包括各種案例,並定期精簡定型資料以符合真實世界的期望,最終導致更精確且平衡的模型回應。

不同的模型類型需要不同格式的定型資料。

您使用的定型和驗證資料必須格式化為 JSON Lines (JSONL) 文件。 針對 Llama-3-80B-chat,微調資料集必須採用聊天完成 API 使用的交談格式。

範例檔案格式

    {"messages": [{"role": "system", "content": "You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox."}, {"role": "user", "content": "Is Xbox better than PlayStation?"}, {"role": "assistant", "content": "I apologize, but I cannot provide personal opinions. My primary job is to assist you with any issues related to your Xbox device. Do you have any Xbox-related issues that need addressing?"}]}
    {"messages": [{"role": "system", "content": "You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox."}, {"role": "user", "content": "Can I play PC games on my Xbox?"}, {"role": "assistant", "content": "While Xbox consoles don't natively support PC games, they can play an array of Xbox games, many of which are also available on PC. Can I assist you with finding games compatible with your Xbox device?"}]}
    {"messages": [{"role": "system", "content": "You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox."}, {"role": "user", "content": "I'm having trouble connecting my Xbox to the Wi-Fi."}, {"role": "assistant", "content": "No worries, let's go through the network settings on your Xbox. Can you please tell me what happens when you try to connect it to the Wi-Fi?"}]}

支援的檔案類型為 JSON Lines。 檔案會上傳至預設資料存放區,並在您的專案中提供。

微調 Meta Llama 模型

目前不支援微調 Llama 3 模型。

清除微調模型

您可以從 Azure AI Studio 或模型詳細資料頁面中的微調模型清單中刪除微調模型。 從 [微調] 頁面選取要刪除的已微調模型,然後選取 [刪除] 按鈕以刪除已微調模型。

注意

如果自訂模型具有現有部署,則無法刪除自訂模型。 您必須先刪除模型部署,才能刪除自訂模型。

成本和配額

Meta Llama 模型的成本和配額考慮已微調為服務

Meta Llama 模型微調為服務,由 Meta 透過 Azure Marketplace 提供,並與 Azure AI Studio 整合以供使用。 您可以在部署或微調模型時找到 Azure Marketplace 價格。

每次專案訂閱來自 Azure Marketplace 的指定供應項目時,都會建立新的資源,以便追蹤與其使用量相關聯的成本。 會使用相同的資源來追蹤與推斷和微調相關聯的成本;不過,可以使用多個計量獨立追蹤每個情節。

如需如何追蹤成本的詳細資訊,請參閱監視透過 Azure Marketplace 提供的模型成本 (部分機器翻譯)。

內容篩選

將模型部署為隨用隨付計費的服務時,其會受到 Azure AI 內容安全所保護。 部署至即時端點時,您可以選擇退出此功能。 啟用 Azure AI 內容安全後,提示和完成都會通過旨在偵測及防止有害內容輸出的一組分類模型。 內容篩選系統會偵測並針對輸入提示和輸出完成中的特定類別的潛在有害內容採取動作。 深入了解 Azure AI 內容安全 (部分機器翻譯)。

下一步