MLOps 部署策略中的自動化

Fully Automated MLOps

Arturo Opsetmoen Amador

Senior Consultant - Machine Learning

模型部署-預測服務

MLOps 參考架構圖片,突出顯示元件:預測服務。

Fully Automated MLOps

預測服務-模式總覽

預測可透過下列模式提供:

  • 批次
  • 串流
  • 即時
  • 邊緣端
Fully Automated MLOps

預測服務-批次提供

$$

  • 大量預測

$$

  • 依排程定期執行

$$

  • 事件觸發

$$

$$

$$

批次處理示意圖。所有輸入送入批次處理引擎,處理完成後一次輸出全部結果。

Fully Automated MLOps

預測服務-串流提供

$$

  • 連續到達的資料

$$

  • 連續輸出的預測

$$

$$

串流處理示意圖。元素持續送入串流處理引擎,處理後持續輸出至輸出串流。

Fully Automated MLOps

預測服務-即時

$$

  • 單筆紀錄

$$

  • 即時預測

$$

$$

realtime_interaction.png

Fully Automated MLOps

預測服務-邊緣端

$$

  • 行動裝置

$$

  • IoT 裝置

$$

  • 降低延遲

$$

在行動平板上執行的 IoT 應用程式畫面。

Fully Automated MLOps

部署策略

$$

ML 提供類型決定我們如何部署與更新預測服務

模型部署策略包含:

  • 影子部署
  • 金絲雀部署
  • A/B 測試
  • 藍綠部署
Fully Automated MLOps

A/B 測試

已部署預測服務中的 A/B 測試示意圖。預測請求送到負載平衡器,再分配到模型 A 與 B。系統持續監控兩者效能。

Fully Automated MLOps

A/B 測試

A/B 測試部署示意圖。經過足夠時間的效能監控後,模型 B 表現較佳。系統將所有請求轉向此最佳模型。

Fully Automated MLOps

影子部署

影子部署示意圖。預測請求送到負載平衡器,再同時分派至正式與影子模型。僅正式模型回傳預測。系統持續監控兩者效能。

Fully Automated MLOps

藍綠部署

藍綠部署示意圖。模型在藍色環境上線提供服務。

Fully Automated MLOps

藍綠部署

更新後的模型部署到藍色環境的複本,即綠色環境。流量切換模組開始自動將請求由藍色導向綠色環境。

Fully Automated MLOps

藍綠部署

藍綠部署示意圖。所有流量逐步且自動從藍色環境切換至綠色環境。

Fully Automated MLOps

藍綠部署

完成全量切換後,可移除藍色環境。帶有更新模型的綠色環境成為新的正式環境。

Fully Automated MLOps

部署與更新預測服務

$$

模型類型決定部署策略

表格:部署策略在 4 個面向的特性:不停機、條件導向、回滾時間、額外成本。

Fully Automated MLOps

一起來練習吧!

Fully Automated MLOps

Preparing Video For Download...