Slide 1

Slide 1 text

速習 Machine Learaning Lens Asei Sugiyama

Slide 2

Slide 2 text

自己紹介 杉山 阿聖 (@K_Ryuichirou) Software Engineer @ Citadel AI Advisor @ Money Forward Organizer @ MLSE 機械学習オペレーション WG 機械学習図鑑 共著

Slide 3

Slide 3 text

TOC What is the Machine Learning Lens? <- Quick introduction of Machine Learning Lens 感想 & まとめ

Slide 4

Slide 4 text

What is the Machine Learning Lens? AWS Well-Architected Framework Pillars AWS Well-Architected Lens

Slide 5

Slide 5 text

AWS Well-Architected Framework AWS の提供するアーキテクチャ のベストプラクティス集 クラウド上でワークロードを設 計および実行するための主要な 概念、設計原則、アーキテクチ ャのベストプラクティスについ て説明しています AWS Well-Architected – 安全で効率的なクラウドアプリケーション https://aws.amazon.com/jp/architecture/well-architected/

Slide 6

Slide 6 text

Pillars オペレーショナルエクセレ ンスの柱 セキュリティの柱 信頼性の柱 パフォーマンス効率の柱 コスト最適化の柱 持続可能性の柱 AWS Well-Architected – 安全で効率的なクラウドアプリケーション https://aws.amazon.com/jp/architecture/well-architected/

Slide 7

Slide 7 text

AWS Well-Architected Lens 特定領域に AWS Well- Architected Framework を適用 したもの AWS Well-Architected が提供 するガイダンスを、機械学習 (ML)、データ分析、(中略) など の特定の業界およびテクノロジ ー領域にも広げます。 AWS Well-Architected – 安全で効率的なクラウドアプリケーション https://aws.amazon.com/jp/architecture/well-architected/

Slide 8

Slide 8 text

Motivation 機械学習基盤を構築した際に TFX (Google) を参考にした Amazon の考える機械学習システム についての設計思想を知りたいと思 っていた Machine Learning Lens は特定のプ ラットフォームに依存しないドキュ メントであるため確認した TFX: A TensorFlow-Based Production-Scale Machine Learning Platform https://research.google/pubs/pub46484/

Slide 9

Slide 9 text

TOC What is the Machine Learning Lens? Quick introduction of Machine Learning Lens <- 感想 & まとめ

Slide 10

Slide 10 text

Quick introduction of Machine Learning Lens Structure of the Machine Learning Lens Business goal ML problem framing ML lifecycle architecture diagram Data processing Model development Deployment Monitoring

Slide 11

Slide 11 text

Structure of the Machine Learning Lens 機械学習システムのライフサイクル を6つのフェーズに整理 それぞれのフェーズにおけるベスト プラクティスを AWS Well- Architected Framework の観点から 述べる Well-Architected machine learning lifecycle - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/well- architected-machine-learning-lifecycle.html

Slide 12

Slide 12 text

Business goal: 概要 機械学習の適用先について検討 PoC を行いビジネスインパクトの検証を行う プロダクトマネジメント的な側面が強い

Slide 13

Slide 13 text

Business goal: Picked up pillars MLOE-01: Develop right skills with accountability and empowerment 機械学習に特化したものではなく通常の Agile について述べている 機械学習で組織づくりについて言及しているドキュメントは珍しい Two-pizza rule を機械学習の専門家を含めて実現することはチャレンジ に見える

Slide 14

Slide 14 text

ML problem framing: 概要 ビジネス的な課題を機械学習の課題に落とし込むフェーズ 最適化する指標、計測するアウトカムなどを定量的に定義 機械学習とルールベースとの費用対効果の比較を実施

Slide 15

Slide 15 text

ML problem framing: Picked up pillars (1/2) MLOE-02: Establish ML roles and responsibilities 機械学習プラットフォームの運用に必要なロール一覧 非常に多岐にわたる クロスファンクショナルチームが互いにコラボレーションして運用する ことを想定

Slide 16

Slide 16 text

参考: ロール一覧 (1/2) Business analyst Domain expert Data architect Data engineer AI/ML architect Data scientist Data analyst MLOE-02: Establish ML roles and responsibilities - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning- lens/mloe-02.html

Slide 17

Slide 17 text

参考: ロール一覧 (2/2) ML engineer MLOps engineer IT auditor Model risk manager Cloud and security engineer Software engineer MLOE-02: Establish ML roles and responsibilities - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning- lens/mloe-02.html

Slide 18

Slide 18 text

ML problem framing: Picked up pillars (2/2) MLREL-03: Adopt a machine learning microservice strategy 機械学習の実装にマイクロサービスのパターンを用いることを推奨 Machine Learning Lens をよく表したプラクティス

Slide 19

Slide 19 text

ML lifecycle architecture diagram Machine Learning Lens におけるもっとも重要なページ ML lifecycle with data processing sub-phases included ML lifecycle with detailed phases and expanded components Lineage tracker

Slide 20

Slide 20 text

ML lifecycle with data processing sub-phases included Machine Learning Lens の Data Processing 以降のプロセスを細分化 ML lifecycle architecture diagram - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/ml-lifecycle- architecture-diagram.html

Slide 21

Slide 21 text

ML lifecycle with detailed phases and expanded components ML lifecycle architecture diagram - Machine https://docs.aws.amazon.com/wellarchitecte learning-lens/ml-lifecycle-architecture-diagr

Slide 22

Slide 22 text

Lineage tracker: コードとデータと生成物のバージョン管理 ML lifecycle architecture diagram - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/ml-lifecycle- architecture-diagram.html

Slide 23

Slide 23 text

Data processing: 概要 機械学習で用いるデータを 用意するフェーズ データの収集と準備 準備はさらに前処理と特徴 量エンジニアリングに分か れる データの探索的な分析のた めに可視化を行う ML lifecycle phase - Data processing - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning- lens/ml-lifecycle-phase-data-processing.html

Slide 24

Slide 24 text

Data processing: Picked up pillars MLOE-08: Document data processing データ処理パイプラインのバージョン管理やドキュメントについて ドキュメントに含めるべき内容についての例 データソースと収集時刻 データ収集プロセス データ収集に用いたスクリプト データ構造 加えた変更や行った処理 MLOE-08: Document data processing - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/mloe-08.html

Slide 25

Slide 25 text

Model development: 概 要 機械学習モデルの訓練、評 価を行う 手動ではなく自動化した継 続的訓練 Feature Store を前提として いるのは特徴的 Model training, tuning - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning- lens/model-training-tuning.html

Slide 26

Slide 26 text

Model development: Picked up pillars (1/2) MLSEC-10: Protect against data poisoning threats 訓練データへの悪意あるデータの混入に備えるというプラクティス たとえば、購入した高評価レビューや、意図的な低評価レビューを念頭 に置いたものと思われる セキュリティの手法や異常検知アルゴリズムが対策としてあげられてい る

Slide 27

Slide 27 text

Model development: Picked up pillars (1/2) MLPER-06: Optimize training and inference instance types 訓練・推論時で最適なインスタンスを選択するというプラクティス GPU は訓練に向き、CPU は大抵の推論をカバーするとされている 実際はさらに多くの選択肢があるため要検証

Slide 28

Slide 28 text

Deployment: 概要 訓練済みのモデルを本番環 境にデプロイする 本番環境でのテスト (カナリ アリリース、A/B テスト) を 実施 要件を踏まえてバッチ処理 やオンライン処理を考慮 ML lifecycle phase - Deployment - Machine Learning Lens https://docs.aws.amazon.com/wellarchitected/latest/machine-learning- lens/ml-lifecycle-phase-deployment.html

Slide 29

Slide 29 text

Deployment: Picked up pillars MLSEC-11: Protect against adversarial and malicious activities 悪意のある入力がなされないように保護するプラクティス 機械学習アルゴリズムのロバスト性を確認 同じような入力が繰り返されていないか監視 切り戻しができるようリニエージを管理

Slide 30

Slide 30 text

Monitoring: 概要 本番環境にデプロイしたモ デルをモニタニングする 本番環境のデータと学習デ ータを比較しドリフトを監 視 CT を前提とし、データの品 質、モデルの品質、データ のドリフトを監視

Slide 31

Slide 31 text

Monitoring: Picked up pillars (1/2) MLPER-13: Evaluate data drift ドリフトを検知するようデータを監視 ドリフト発生時には再学習を実施 MLPER-14: Monitor, detect, and handle model performance degradation モデルのパフォーマンスを計測 モデルの性能劣化時にはアラートを出す

Slide 32

Slide 32 text

Monitoring: Picked up pillars (2/2) MLPER-17: Include human-in-the-loop monitoring Human-in-the-loop をモデルのモニタリングに利用する 人手でつけたラベルとモデルの出力を比較することで、モデルの性能を モニタリングする

Slide 33

Slide 33 text

TOC What is the Machine Learning Lens? Quick introduction of Machine Learning Lens 感想 & まとめ <-

Slide 34

Slide 34 text

感想 (1/2) "Adopt a machine learning microservice strategy" という内容 全部を最初からやるのは非現実的 (とくに企画段階と監視に関する運用 設計) なので、自組織の状況に合わせてカスタマイズが必要

Slide 35

Slide 35 text

感想 (2/2) 機械学習の企画段階における検証に 重きをおいたり、運用において Human-in-the-loop にふれるのは印 象的 機械学習の企画段階について触れる のなら、Fly wheel との関連について 触れてほしかった

Slide 36

Slide 36 text

まとめ Machine Learning Lens は AWS の考える機械学習システムのベストプ ラクティスを記述したもの 機械学習システムの6つのフェーズについて、5つの観点からベストプラ クティスを述べている まずは ML lifecycle architecture diagram を理解するのが良さそう 全部を最初からやるのは非現実的 (とくに監視に関する運用設計) なの で、自組織の状況に合わせてカスタマイズが必要