Mercari ML Platform
View Slide
自己紹介● Hirofumi Nakagawa(hnakagawa)● 2017年7月入社● 所属はSRE● デバイスドライバ開発からフロントエンド開発までやる何でも屋● NOT MLエンジニア
KubernetesCLI Image builderClusterPipeline EngineDashboardMetricsRunnerComponentMercari ML ComponentML platform architecture
KubernetesCLI Image builderClusterPipeline EngineDashboardMetricsRunnerComponentMercari ML Component
Container imageを自動でbuild。利用者がDockerfileを書く必要は極力無いようにしてあるClusterPipeline EngineCLI/ImagebuilderMetricsClusterリソースを管理し、container化されたDataPipelineを実行するPrometheus使用している。ML modelに関するmetricsを取得
前処理や分類器をContainer Pipelineで実行できるようにコンポーネント化したものRunnerML ComponentMercari MLComponentTraining/Serving環境でcluster環境とlocal環境の差を埋めるデータ・ソースやitem分類等、社内利用に特化したコンポーネント
Container Based Pipeline
DataSourceImageText PreprocessingImagePVPicture PreprocessingImagePVPVEstimatorImage全ての出力はPVに保存されキャッシュとしても利用できる
Model Training & Serving Workflow
CITraining ClusterJob ・・・ModelRepositoryJobJobServing ClusterRESTAPITFServingFaiss ・・・全てのModelがversion管理 & image化されている
Serving Architecture
Mercari APIFlaskSKModelSKModelSKModelTensorFlowServingTFModelTFModelTFModelVirtualServiceBasic serving API architecture
Streaming serving API architectureFlaskSKModelSKModelSKModelTensorFlowServingTFModelTFModelTFModelVirtualServiceProxy
A/B Test Architecture
ModelServiceA VirtualServiceModelServiceB Mercari API90%10%Model API is activated by Istio
Common Problems of Model Serving
Huge model file vs container image• 巨大なMLモデルファイルをimageに含めるか否か• 含めないのであれば何処に配置するのか• ポータビリティとロード時間のトレードオフ
Effective memory usage• 数GB程度のメモリを使用するのは普通• プロセス毎にモデルをロードする必要がある環境は辛い• Copy on Write(CoW)を利かす工夫が必要
In Progress
モデル評価とReTrainingの自動化モデル生成の自動化本番環境への自動DeployArchitecture searchやHyper parameter optimizationによって簡単なモデル生成を自動化・簡素化生成されたモデルを本番環境へ自動Deployし、最も良いモデルが自動選択される高度な自動化運用中のモデルの評価/可視化、Re-Trainingを高度化・自動化する
ML ContinuousDeploymentDeployMonitoringEvaluationHyperparameteroptimizationRe-Trainingリリース後も精度監視・Hyper parameterチューニング・Re-training・Deployを自動で行う
AutoFlowFeature ExtractionComponentsConcatenationComponentsClassificationComponentsModel BuilderComponentRepository
In Future
EdgeDeviceDemocratizationof AIFurtherAutomationFuture Plans
Edge Device• TensorFlow LiteやCore ML等Edgeサイドでpredictionを行える環境が整ってきた• EdgeでのpredictionはUX上大きなメリットがあると考えている• 調査・研究を進めているので今後に乞うご期待?
Democratization of AI• 多くのモデルが求められている• MLエンジニア以外もモデルを作れるようにする• DataPlatformと合せて環境を整備する必要
Further Automation• 近い将来、数千〜のモデル運用を行う必要がある• さらなる高度な自動化が不可欠