Challenges for Machine Learning
Systems toward ContinuousImprovement
IBIS 2019 機械学習工学セッション @ Nagoya
2019.11.22
Arm Treasure Data
Aki Ariga

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Sculley, 2015] より翻訳をして引用

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

https://sites.google.com/view/sig-mlse/wg●●●

試行錯誤から本番適用にもっていくにあたり、継続的に改善を続けていく上で適切な機械学習システムを作るため- 論文になりづらいLesson Learntを収集し- アーキテクチャパターンを体系化したい(鷲崎先生の取り組み [Washizaki 2019]以外、まだ十分に整備されていない)

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

●Project process, organization structure/management●

Machine Learning systems for distributed training●

Hardware acceleration e.g. GPU, TPU, FPGA, etc...

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

Typical steps for a Machine Learning project
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

ビジネス課題を類似の課題を、論文を中心にサーベイ方法を考える
システム設計
学習データ（特徴量+ラベル）の設計
実データの収集と前処理をする
探索的データ分析とアルゴリズムの選定
学習・パラメータチューニング
システムに組み込む
予測精度・ビジネス指標をモニタリング

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

実験ループ:
5〜8を繰り返し
本番ループ:
8〜10を繰り返し(4に戻ることも)

1.
2.
3.
4.
5.
6.

を書く
コードを書くPull Request/CIでの
コードレビュー、マージ
コード/バイナリのビルド、デプロイをと共にモニタリング

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

ビジネス課題を類似の課題を、論文を中心にサーベイ
機械学習をしない方法を考える
システム設計学習
実データの収集と前処理
探索的データ分析とアルゴリズムの選定
学習・パラメータチューニング
システムに組み込むをモニタリング

1.
を書く
2. コードを書く
3. Pull Request/CIでの●に振る舞いが決まる
4. コードレビュー、マージ仕様を網羅してができる
5. ● コード/バイナリのビルド、デプロイ
6. ● エラーは一意に定義でき、コードのをとロジックをすることができ共にモニタリングる

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

1. ビジネス課題を
2. 類似の課題を、論文を中心にサーベイ
入力に対してにに振る
3. ● 機械学習をしない方法を考える
舞いが決まる4. システム設計
仕様を網羅できず、
5. ● 学習
しかできない6. 実データの収集と前処理エラーかどうかの検出が難しく、モ
7. ● 探索的データ分析とアルゴリズムの選定
デル更新などしかでき
8. 学習・パラメータチューニング
ない9. システムに組み込む
10.
をモニタリング●“Data deﬁnes everything”●“Change Anything Changes Everything” [Sculley, 2015]●

データが振る舞いを決めるため、確率的にエラーを抑えることしかできない●

確率的な挙動をするため、変更の影響範囲を事前に予見できない

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Batch] より翻訳をして引用●○した音声認識システム
リリース後、に → 予測性能が劣化●

工場の画像検査システムで、一ヶ月以上現場の画像で学習○が変化 → 予測性能が劣化●

ウェブサイトのランキングシステム○により検索語のトレンドが変遷 → 性能が劣化

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Ziobaite, 2010]より引用

Production models should be
retrained continuously to avoid
concept drift

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

モデルを本番に学習・デプロイし続けるには、チームをまたいだ協力が必要[CD4ML]より引用
Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

🤔
●○

●
○
○: ”Infrastructure as Code” made Ops of Devwhich improves: Isolate DS/Researcher’s code from production system
which aims to improveresearcher’s code by Dev is■ Those Dev can be DS/researcher and get high salary!

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Ariga] より
Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

EDA
Preprocessing

Deploy/Serving
Training

Audit[Ariga] より
Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Marsden, 2019]より翻訳して引用●○

9ヶ月前に学習したモデルが全く同じ環境で、同じデータで再学習でき、ほぼ同じ(数%以内の差)の精度を得られるべきである○

本番で稼働しているどのモデルも、作成時のパラメータと学習データ、更に生データまでトレースできるべきである○

他の同僚の作ったモデルを本人に聞くことなく改善でき、非同期で改善とコードやデータのマージができるべきである○

手動での作業0でモデルはデプロイできるべき。
統計的にモニタリングできるべき

●

●

●

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

1.
2.
3.
4.
5.
6.
7.
8.
9.

Data/Model management
Experiment Tracking
Reproducible experiment
Pipeline management
ML framework abstraction
Model Serving/Deployment
Testing and quality check
Explaining model/data
Monitoring/Observability

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

1. Data/Model management

Reproducible / Accountable
Collaborative / Continuous

EDA

How do you manage 10000+ models
in production?
●●●AuditPhase○ EDA, Training, Audit
Related concepts○ Data/Model Versioning,Data/Model Lineage,
Metadata management,Feature store
OSS○ ModelDB, pachyderm, DVC,
ML Metadata, Feast
Example of Data Lineage. [Uber] より引用

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

TrainingReproducible / Accountable
Collaborative / Continuous

2. Experiment tracking

Training

Audit

What parameter/condition did you choosewith the production model?
●●Phase○ Training, Audit
Related concepts○ Parameter management, Artifactmanagement●OSS○

kubeﬂow pipelines, MLﬂow
tracking, polyaxon, comet.ml

Model tracking example[MLFlow tracking]より引用

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

3. Reproducible experiments

Reproducible / Accountable
Collaborative / Continuous

EDA

Is you notebook can reproducible inyour peer’s environment?
●●●AuditPhase○ EDA, Training, Audit
Related concepts○ Reproducible notebook,○ Dependency management
OSS○ Jupyter notebook, Polynote,Docker
https://twitter.com/keigohtr/status/1197321232800071680
もちろん、実装によるが...

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

Training

4. Pipeline management
How do you manage consistentend-to-end ML pipeline?
●●●

Reproducible / Accountable
Collaborative / Continuous

Preprocessing

Training

Deploy/Serving

Audit

Phase
○ Preprocessing, Training,Deploy/Serving, Audit
Related concepts○ Pipeline versioning, Workﬂow,CIOSS○ kubeﬂow, Argo, ArgoCD,
MLFlow Projects, Tensorﬂow
Transform, [General workﬂowengines]

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Kubeﬂow pipeline] より引用

5. ML framework abstraction

Reproducible / Accountable
Collaborative / Continuous

Preprocessing

How can Dev make DS’s code deployable
without understanding the code?
●●●Phase○ Preprocessing, Training, Deploy
Related concepts○ Deploy with function/decorator,
Conﬁguration based training,AutoML
OSS & Known frameworks○ TensorFlow Transform,
Metaﬂow○ (FBLeaner Flow, Overton,Bighead, Boson, Metaﬂow)

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

Training

Deploy/Serving

Metaﬂow enables to deploy ﬁrst models within a week for mostof projects [Metaﬂow]

Overton: A Data System for Monitoring and Improving
Machine-Learned Products [Overton]“domain engineers should not beforced to write traditional deep learningmodeling code”“Engineers are Comfortable with
Automatic Hyperparameter Tuning”
Apple implemented ML system with weaksupervision and slicing.
Engineers are required to1)
2)

create/select schema and input payload.
Add slices or labeling functions, or synthetic
examplesCopyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

6. Testing and quality check

Reproducible / Accountable
Collaborative / Continuous

Training

Deploy/Serving

What metrics should we track forquality?
●●●Phase○ Training, Deploy
Related concepts○ Data validation, Component
integration validation, Modelquality check, Adversarial
example detection
OSS○ TensorFlow Data Validation,Deequ

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[TFDV] Understand data from stats

Data validation: Testing toward train-serve skew
[Baylor, 2017]より引用

教師あり学習の予測モデルは、学習データの分布に近いという仮定
学習データの仮定をvalidationすれば良い●Check with schema○ Categorical variable○ Numerical value range○ Similarity ofdistribution

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

7. Explaining model/data

Reproducible / Accountable
Collaborative / Continuous

Training

Audit

Can you convince your boss why weshould choose this model?
●●●Phase○ Training, Audit
Related concepts○ Model explainability,Bias/fairness and ethics
check
OSS
○ TensorFlow Model Analysis,
Facets, LIME, ELI5, SHAP,
Manifold

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

Manifold can compare two sliced population with multiple
models/features [Manifold]“Explain what’s happening and why. There is still
significant fear, uncertainty and doubt (FUD) about AI. I haveseen that providing a basic education — along the lines of
the AI for Everyone curriculum — eases these conversations.
Other tactics including explainability, visualization,rigorous testing, and auditing also help build trust in an AI
system and convince our customers (and ourselves!) that itreally works.”[Batch 2] より引用。下線部は筆者強調

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

8. Model Serving/Deployment

Reproducible / Accountable
Collaborative / Continuous

Deploy/Serving

How rapidly can you deploy a model to production?
●●●Phase○ Deploy/Serving
Related concepts○ Rollout (Canary rollouts, A/B testing, Shadowing)○ Model serialization/export
OSS○ TF Serving, Seldon, KFServing, MLFlow Model registry, Clipper○ PMML, PFA, ONNX, Menoh

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

“Time is money” - impact of serving latency+30% latency reduces 0.5% CVR atBooking.com
Techniques to reduce latency:
●
●
●
●
●
●

Model Redundancy
In-house developed Linear PredictionengineSparse models
Precomputation and caching
Bulking
Minimum Feature Transformation

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

[Bernardi 2019]9. Monitoring/Observability

Reproducible / Accountable
Collaborative / Continuous

Deploy/Serving

How do you notice production
model/data is corrupt?
●●●Phase○ Deploy/Serving
Related concepts○ Data Validation, Outlier
detection, Concept drift
detection, Delayed feedback
OSS○ [General Monitoring tools],[General Workﬂow engine],
TFDV

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

“Smooth bimodal distributions with one clear
stable point are signs of a model that successfully
distinguishes two classes” [Bernardi 2019]

Challenges

Phase

Reprod Accou Collab Contin
ucible ntable orative uous

Data/Model management

EDA/Training/Audit

✅

✅

✅

Experiment Tracking

Training/Audit✅

✅

✅

Reproducible experiment

EDA/Training/Audit

✅

✅

✅

Pipeline management

Preprocessing/Training/Serving/Deploy/Audit✅

✅

✅

ML framework abstraction

Preprocessing/Training/Deploy✅

✅

✅

Testing and quality check

Training/Deploy✅

✅

Explaining model/data

Training/Audit✅

Model Serving/Deployment

Serving/Deploy

Monitoring/Observability

Serving/Deploy

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

✅

✅
✅

✅

✅

●
●

●

Introduced the importance of Continuous Improvement for machine learningsystem
Introduced 9 Challenges for ML systems in production
Let’s join MLSE slack and collect/share knowledge on GitHub Wiki!
https://github.com/chezou/ml_in_production/wiki○

Planning for the Workshop for Machine Learning system in production

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

●●●

https://github.com/EthicalML/awesome-production-machine-learning
https://hackernoon.com/why-is-devops-for-machine-learning-so-different-384z32f1
https://martinfowler.com/articles/cd4ml.html

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

●
●
●
●

●
●
●
●
●
●
●
●
●
●
●
●

[Sculley, 2015] Sculley, David, et al. "Hidden technical debt in machine learning systems." Advances in neural information processing systems.
2015.
[Washizaki 2019] Washizaki, Hironori, et al. "Studying Software Engineering Patterns for Designing Machine Learning Systems." arXiv
preprint arXiv:1910.04736 (2019).
[Batch] The Batch Nov. 6, 2019https://info.deeplearning.ai/the-batch-deepmind-masters-starcraft-2-ai-attacks-on-amazon-a-career-in-robot-management-banks-embrace-b
ots-1[Batch 2] The Batch Nov. 20, 2019https://info.deeplearning.ai/the-batch-artificial-noses-surveillance-on-wheels-unwelcome-researchers-privacy-problems-beyondbounding-boxes[Kubeﬂow pipeline] https://www.kubeflow.org/docs/pipelines/overview/pipelines-overview/[TFDV] https://www.tensorflow.org/tfx/data_validation/get_started[Zliobaite, 2010] Žliobaitė, Indrė. "Learning under concept drift: an overview." arXiv preprint arXiv:1010.4784 (2010).
[Marsden, 2019] Marsden, Luke. "The Future of MLOps"
https://docs.google.com/presentation/d/17RWqPH8nIpwG-jID_UeZBCaQKoz4LVk1MLULrZdyNCs/edit#slide=id.p[Baylor, 2017] D. Baylor et al., “TFX: A tensorﬂow-based production-scale machine learning platform,” in Proceedings of the 23rd acm
sigkdd international conference on knowledge discovery and data mining, 2017, pp. 1387–1395[CD4ML] D. Sato, et al. “Continuous Delivery for Machine Learning” , https://martinfowler.com/articles/cd4ml.html[Uber] “Databook: Turning big data into knowledge with metadata at uber.” https://eng.uber.com/databook/[Manifold] “Manifold: A Model-Agnostic Visual Debugging Tool for Machine Learning at Uber” https://eng.uber.com/manifold/[Overton] Ré, Christopher & Niu, Feng & Gudipati, Pallavi & Srisuwananukorn, Charles. (2019). Overton: A Data System for Monitoring andImproving Machine-Learned Products.
[Bernardi 2019] Bernardi, Lucas, et al. "150 Successful Machine Learning Models: 6 Lessons Learned at Booking. com." Proceedings ofthe 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2019.
[Metaﬂow] Julie Pitt, et al. “A Human-Friendly Approach to MLOps”, MLOps NYC19, https://youtu.be/fOSZuONmLbA[Ariga] “MLOpsの歩き方”, n月刊ラムダノート vol.1 no.1, 2019

Copyright 1995-2019 Arm Limited (or its aﬃliates). All rights reserved.

Thank You!
Danke!
Merci!
谢谢!
ありがとう!
Gracias!
Kiitos!
Conﬁdential © Arm 20192017