Share
Embed
Databricks における 『MLOps』
MLOpsをDatabricks上でどう実現するかについて、網羅的に説明します。
Databricks Japan PRO
April 17, 2024
Transcript
50 slides
-
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
Databricks におけるMLOps 1 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
DatabricksにおけるMLOps • [Blog] Simplifying Production MLOps with Lakehouse AI • [eBook] Big Book of MLOps 2 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
3 アジェンダ • イントロダクション ◦ MLOpsとは何でなぜ注意が必要か? ◦ 人とプロセス ◦ ガイドの原則 ◦ development、staging、productionのセマンティクス ◦ MLデプロイメントパターン • 新機能 ◦ Unity Catalog ◦ モデルサービング ◦ レイクハウスモニタリング • 設計上の意思決定 • リファレンスアーキテクチャ • リソース -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
4 DatabricksにおけるMLOps • イントロダクション ◦ MLOpsとは何でなぜ注意が必要か? ◦ 人とプロセス ◦ ガイドの原則 ◦ development、staging、productionのセマンティクス ◦ MLデプロイメントパターン • 新機能 ◦ Unity Catalog ◦ モデルサービング ◦ レイクハウスモニタリング • 設計上の意思決定 • リファレンスアーキテクチャ • リソース -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
MLOpsとは、MLシステムのパフォーマンス、安定性、長期的な効率性を改善するための MLOpsとは? 5 データ、コード、モデルの管理に対する 一連のプロセスと自動化処理です MLOps = DataOps + DevOps + ModelOps -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
6 データインテリジェンスプラットフォーム ModelOps DataOps DevOps データ中心のMLプラットフォーム -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
7 データインテリジェンスプラットフォーム ModelOps DataOps DevOps データ中心のMLプラットフォーム Unity Catalog Workflows Model Serving Lakehouse Monitoring -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
なぜMLOpsに注意が必要なのか? MLOpsはあなたのリスクの軽減に役立ちます 8 • 技術的なリスク - 精度の低いモデル、壊れやすいインフラ • コンプライアンスのリスク - 規制や企業ポリシーの違反 MLOpsは自動化を通じて長期的な効率性を改善します • モデルのプロダクションへのデリバリーを整流化 • プロダクションでエラーが発生する前に捕捉 • 遅くて手動のプロセスを回避 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
9 人とプロセス → データパイプラインを構築 → ビジネス問題を翻訳。モデルのトレーニングと チューニング → プロダクションにMLモデルをデプロイ → データガバナンスとコンプライアンスに責任を持つ → MLソリューションのビジネス価値に責任を持つ -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
10 人とプロセス データ準備 探索的データ分 析 特徴量エンジニ アリング モデル トレーニング モデル評価 デプロイメント モニタリング -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
ガイドの原則 常にビジネスゴールを念頭に 11 モジュール化してMLOpsを実装 プロセスは自動化をガイドすべき 機械学習に対するデータ中心アプローチを採用 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
MLワークフローのアセット: dev、staging、prodのセマンティクス 12 アセットはそれぞれのフェーズで: -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
Dev vs. staging vs. prod 14 信頼性、品質、テストのレ ベル: アクセスのオープン性: Low High Open Locked-down -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
多くの場合、モデルとコードのライフサイクルは非同期的になります • 週次の不正検知モデル • モデルの更新。コードの変更なし。 • コンピュータビジョンモデル、大規模言語モデルのファインチューン • モデルの更新なし。コードの変更。 モデル vs. コードのライフサイクル 15 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
19 コードデプロイのプロセス dev staging prod トレーニングコードの開発 補助的なコードの開発 → コードをプロモート ✔ データのサブセットでモデルトレーニングコードをテスト ✔ 補助的なコードのテスト → コードをプロモート ✔ プロダクションデータでモデルをトレーニング ✔ モデルをテスト → モデルをデプロイ → 補助的なコードをデプロイ -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
21 DatabricksにおけるMLOps • イントロダクション ◦ MLOpsとは何でなぜ注意が必要か? ◦ 人とプロセス ◦ ガイドの原則 ◦ development、staging、productionのセマンティクス ◦ MLデプロイメントパターン • 新機能 ◦ Unity Catalog ◦ モデルサービング ◦ レイクハウスモニタリング • 設計上の意思決定 • リファレンスアーキテクチャ • リソース -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
22 Unity Catalog データとAIアセットに対する単一のガバナンスソリューション: ◦ 中央管理のアクセス制御 ◦ 監査 ◦ リネージ ◦ 検索 データとAIに対する統合ガバナンス MLOps - What’s new? ボリューム (生データ) Delta テーブル 特徴量 モデル 推論 テーブル メトリック テーブル -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
23 Unity Catalog Unity Catalogでの特徴量エンジニアリングによって: • 主キー(およびタイムスタンプキー)が割り当てられたUnity CatalogのすべてのDelta テーブルを、モデルのトレーニングとサービングのためのソースとして利用可能 • 特徴量テーブルはワークスペース横断で容易に共有でき、レイクハウスの他のアセットとのリネー ジが記録される Unity Catalogでの特徴量エンジニアリング MLOps - What’s new? ボリューム (生データ) Delta テーブル 特徴量 モデル 推論 テーブル メトリック テーブル -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
24 Unity Catalog Unity Catalogでのモデル管理によって • Unity Catalogですべてのモデルライフサイクルを管理可能 • Databricksワークスペース横断でモデルを共有可能 • データとモデルの両方に対するリネージを追跡可能 Unity Catalogでのモデル管理 MLOps - What’s new? ボリューム (生データ) Delta テーブル 特徴量 モデル 推論 テーブル メトリック テーブル -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
25 モデルサービング リアルタイムのMLモデルデプロイメント • モデルサービングは、リアルタイムのMLモデ ルデプロイメントをシンプルにするためのプロ ダクションレディ、サーバレスのソリューション を提供します。 • アプリケーションやウェブサイトと モデルの予測結果を連携するためのAPIとし てモデルをデプロイします。 • モデルサービングは: ◦ 運用コストを削減します。 ◦ MLライフサイクルを円滑にします。 ◦ データサイエンスチームは、 プロダクションレベルのリアル タイムMLを自身のソリューションに組み 込むためのコアタスクに フォーカスできます。 MLOps - What’s new? -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
26 モデルサービング MLOpsのメリット MLOps - What’s new? デプロイメントを自動化し エラーを削減する自動 特徴量/ベクトル検索 モニタリング 統合ガバナンス レイクハウスネイティブ CPUやGPUに任意のモデルを デプロイ。自動化された コンテナ構築とインフラ管理はメ ンテナンスコストを削減し、デプ ロイメントを スピードアップ シンプルなデプロイメント 非常に低いレーテンシーで 高可用性かつスケーラブルな サービング (オーバーヘッドレー テンシーのp50は <10ms)か つ、大ボリュームのクエリーに対 応 (QPS >25k) サーバレス -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
27 モデルサービング オンラインでの評価 MLOps - What’s new? サービングエンドポイントへの複数モデ ルのサービングを通じたA/B テストやカナリアデプロイメントのような オンライン評価戦略を サポート -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
28 モデルサービング 推論テーブル モデルのモニタリングとデバッグのための推論テーブル: • それぞれのリクエストとレスポンスはUnity Catalogの推論テーブルに記録されます ◦ お使いのモデルの次のイテレーションで再トレーニングのデータセットとして活用 ◦ プロダクションのデータとモデルに対する品質モニタリングの作成 ◦ 疑わしい推論の診断とデバッグの実行 ◦ 再度ラベリングすべきラベルミスのあるデータセットの作成 MLOps - What’s new? ボリューム (生データ) Delta テーブル 特徴量 モデル 推論 テーブル メトリック テーブル -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
データとAIアセットの両方が高品質、正確、信頼できるこ とを保証するためのデータ中心のモニタ リングソリューション。 • UCテーブルでデータをインクリメンタルに処理 • UCテーブルに格納されるプロファイル メトリクスを計算 • UCテーブルに格納されるドリフト メトリクスの計算 • SQLエクスプレッションとしてのカスタム メトリクスをサポート • メトリクスの時間変化を可視化する自動 生成のDBSQLダッシュボード レイクハウスモニタリング MLOps - What’s new? レイクハウスネイティブ -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
31 DatabricksにおけるMLOps • イントロダクション ◦ MLOpsとは何でなぜ注意が必要か? ◦ 人とプロセス ◦ ガイドの原則 ◦ development、staging、productionのセマンティクス ◦ MLデプロイメントパターン • 新機能 ◦ Unity Catalog ◦ モデルサービング ◦ レイクハウスモニタリング • 設計上の意思決定 • リファレンスアーキテクチャ • リソース -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
32 Unity Catalog Concepts MLOps design decisions -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
33 Unity Catalog コンセプト MLOps design decisions カタログ: • データとAIアセットのコンテナとして 機能 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
34 Unity Catalog コンセプト MLOps design decisions カタログ: • データとAIアセットのコンテナとして 機能 スキーマ: • 関連するテーブル、ビュー、モデルを グルーピングするカタログ内の論理的 構成体 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
35 Unity Catalog コンセプト MLOps design decisions カタログ: • データとAIアセットのコンテナとして 機能 スキーマ: • 関連するテーブル、ビュー、モデルを グルーピングするカタログ内の論理的 構成体 データテーブル: • <catalog>.<schema>.<table>の 形式で提供される3レベルの名前を 用いて参照 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
36 Unity Catalog コンセプト MLOps design decisions カタログ: • データとAIアセットのコンテナとして 機能 スキーマ: • 関連するテーブル、ビュー、モデルを グルーピングするカタログ内の論理的 構成体 データテーブル: • <catalog>.<schema>.<table>の 形式で提供される3レベルの名前を 用いて参照 ボリューム: • クラウドオブジェクトストレージロケーションの 論理的ボリューム。テーブル 以外のデータセットにガバナンスを追加。 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
37 Unity Catalog Concepts MLOps design decisions カタログ: • データとAIアセットのコンテナとして 機能 スキーマ: • 関連するテーブル、ビュー、モデルを グルーピングするカタログ内の論理的 構成体 データテーブル: • <catalog>.<schema>.<table>の 形式で提供される3レベルの名前を 用いて参照 ボリューム: • クラウドオブジェクトストレージロケーションの論 理的ボリューム。テーブル 以外のデータセットにガバナンスを追加。 関数: • SQLとPythonのUDF -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
38 Unity Catalog コンセプト MLOps design decisions 登録モデル: • Unity Catalogに登録されたMLflow モデル。 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
39 Unity Catalog コンセプト MLOps design decisions 登録モデル: • Unity Catalogに登録されたMLflow モデル。 モデルバージョン: • 登録モデルのバージョン。同じモデル名で モデルが登録されるとバージョン番号が増 加。 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
40 Unity Catalog Concepts MLOps design decisions 登録モデル: • Unity Catalogに登録されたMLflow モデル。 モデルバージョン: • 登録モデルのバージョン。同じモデル名で モデルが登録されるとバージョン番号が増 加。 モデルのエイリアス: • 登録モデルの特定のバージョンに対する変 更可能な名前付きリファレンス。 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
41 Unity Catalog 推奨の構成 - カタログレベル dev bronze silver gold fraud_detection > Tables: offline_location_features fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance staging bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance prod bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance MLOps design decisions -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
42 Unity Catalog 推奨の構成 - スキーマレベル dev bronze silver gold fraud_detection > Tables: offline_location_features fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance staging bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance prod bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance MLOps design decisions -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
43 Unity Catalog 推奨の構成 - スキーマレベル dev bronze silver gold fraud_detection > Tables: offline_location_features fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance staging bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance prod bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance MLOps design decisions -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
44 Unity Catalog 推奨構成 dev bronze silver gold fraud_detection > Tables: offline_location_features fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance staging bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance prod bronze silver gold fraud_detection > Tables: fraud_clf_inference fraud_clf_metrics > Volumes: > Models: fraud_clf > Functions: compute_distance MLOps design decisions サンプルの prodカタログ -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
45 DatabricksにおけるMLOps • イントロダクション ◦ MLOpsとは何でなぜ注意が必要か? ◦ 人とプロセス ◦ ガイドの原則 ◦ development、staging、productionのセマンティクス ◦ MLデプロイメントパターン • 新機能 ◦ Unity Catalog ◦ モデルサービング ◦ レイクハウスモニタリング • 設計上の意思決定 • リファレンスアーキテクチャ • リソース -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
50 Implementing MLOps on Databricks • Databricks MLOps Stack ◦ Customizable stack for starting new ML projects on Databricks ◦ Follows deploy code paradigm ◦ Cloud: Azure, AWS ◦ CI/CD: GitHub, Azure DevOps ◦ Databricks Infrastructure: Databricks asset bundles -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
51 DatabricksにおけるMLOps • イントロダクション ◦ MLOpsとは何でなぜ注意が必要か? ◦ 人とプロセス ◦ ガイドの原則 ◦ development、staging、productionのセマンティクス ◦ MLデプロイメントパターン • 新機能 ◦ Unity Catalog ◦ モデルサービング ◦ レイクハウスモニタリング • 設計上の意思決定 • リファレンスアーキテクチャ • リソース -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
MLOps Resources • Read the updated Big Book of MLOps. Throughout the eBook, we provide links to resources for details and for learning more about specific topics. • Catch up on the Data+AI Summit 2023 talks on MLOps, including: ◦ Wednesday keynote on Lakehouse IQ, MosaicML, and Lakehouse AI, as well as JetBlue’s personal story ◦ Databricks vision and product updates ▪ LLMOps: Everything You Need to Know to Manage LLMs, which overviews the Databricks vision for developing LLM-powered applications ▪ Deep Dive into the Latest Lakehouse AI Capabilities ▪ Advancements in Open Source LLM Tooling, Including MLflow ◦ Key Insights From Running LLMs in Production From MLOps.Community • Read and watch about success stories: ◦ CareSource on their MLOps platform for improving healthcare ◦ Walgreens Boots Alliance on the details of their MLOps architecture ◦ Gucci on their end-to-end MLOps architecture ◦ Ahold Delhaize on their move to Serverless Model Serving ◦ The Trade Desk on scaling NLP for 100 million web pages per day 52 -
©2023 Databricks Inc. — All rights reserved Confidential and Proprietary
Resources: Big Book MLOps eBook Big Book of MLOps (Release: 10/19) Models in Unity Catalog Deep Dive deck Part 2: LLMOps deck (go/llmops/deck) 53