$30 off During Our Annual Pro Sale. View Details »

速習 Machine Learning Lens

速習 Machine Learning Lens

JAWS-UG AI/ML #15 https://jawsug-ai.connpass.com/event/263957/ の登壇資料です
AWS の提供する機械学習のベストプラクティス集である Machine Learning Lens について概要と感想を述べています https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/machine-learning-lens.html

Asei Sugiyama

January 17, 2023
Tweet

More Decks by Asei Sugiyama

Other Decks in Technology

Transcript

  1. 速習 Machine Learaning Lens
    Asei Sugiyama

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  10. 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

    View Slide

  11. 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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  16. 参考: ロール一覧 (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

    View Slide

  17. 参考: ロール一覧 (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

    View Slide

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

    View Slide

  19. 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

    View Slide

  20. 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

    View Slide

  21. 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

    View Slide

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

    View Slide

  23. 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

    View Slide

  24. 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

    View Slide

  25. Model development: 概

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

    View Slide

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

    View Slide

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

    View Slide

  28. 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

    View Slide

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

    View Slide

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

    CT を前提とし、データの品
    質、モデルの品質、データ
    のドリフトを監視

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide