Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MLSE論文読み会: A Case for Serverless Machine Learning

MLSE論文読み会: A Case for Serverless Machine Learning

NeurIPS 2018, System for ML で発表されたA Case for Serverless Machine Learningについての解説。論文は http://learningsys.org/nips18/assets/papers/101CameraReadySubmissioncirrus_nips_final2.pdf

Masaki Samejima

February 08, 2019
Tweet

More Decks by Masaki Samejima

Other Decks in Technology

Transcript

  1. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Masaki Samejima, Amazon Web Services Japan 2019.2.8 堣唒㷕统䊨㷕灇瑔⠓ (MLSE) NeurIPS 2018 Systems for ML 锷俑铣׬⠓ A Case for Serverless Machine Learning
  2. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 锷俑嚊銲 J. Carreira, et al., A Case for Serverless Machine Learning • 堣唒㷕统ؒٝآص،כ؟٦غ׾盖椚׃׋ֻזְ • ؟٦غ׾盖椚ׇ׆ח؝٦س׌ֽ׾㹋遤ׅ׷؟٦غ٦ٖأח״׏ג 堣唒㷕统׾㹋植ׅ׷鑐׫ • ؟٦غ٦ٖأד⚛⴨Ⳣ椚ׅ׷PyWrenٓ؎ـٓٔ׾ⵃ欽׃גծ堣唒 㷕统׾㹋遤٥嗚鏾
  3. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 堣唒㷕统ٙ٦ؙؿٗ٦ֶֽ׷铬겗 ر٦ةך⵸Ⳣ椚 Ⰻر٦ة垥彊⻉זו 铣׫鴥׫䚍腉ָꅾ銲 㷕统 غحثך铣׫鴥׫ 鎘皾䚍腉ָꅾ銲 ع؎ػ٦ػًٓ٦ة 锃侭 醱侧ظ٦سדך㹋遤
  4. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. ؟٦غ٦ٖأך،فٗ٦ث Fig. 2 ؟٦غٖأ؟٦ؽأךأ؛٦ٕկ ず儗㹋遤侧׾㟓װׅה简䕎חծ ػؿؓ٦وٝأָ♳ָ׷կ
  5. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. ؟٦غ٦ٖأךⵖꣲ (1/2) • Small local memory and storage. • ⢽ִלծAWS Lambdaכ3GBךRAM • TensorflowװSpark׾⹛ַֿׅהכדֹזְ • Low Network bandwidth and no P2P communication. • 侧⼧MB/s 玎䏝ך䌒㚖 • 醱侧鎘皾ظ٦س꟦ך鸐⥋ָر٦ةإٝةך圓䧭♳鹼ְ〳腉䚍
  6. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. ؟٦غ٦ٖأךⵖꣲ (2/2) • Short-lived and unpredictable launch times. • Lack of Fast Shared Storage.
  7. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. ؟٦غ٦ٖأ橆㞮ך崞欽倯岀 Python API 堣唒㷕统ؒٝ آص،ָ䪔ְ װְׅAPI Client-side backend Worker Runtime • أزٖ٦آַ׵ך غحث《׶⳿׃ • 堣唒㷕统ٓ؎ـٓٔ ⴓ侔ر٦ةأز، • ر٦ةךⰟ剣 • ػًٓ٦ة؟٦غ ؟٦غ٦ٖأךⵖꣲ׾⯘剪ׅ׷׋׭ח䗳銲ז堣腉 Workerך饯⹛٥ 鹌遤朐屣盖椚 ! ! ! 堣唒㷕统 ؒٝآص،
  8. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Python API ח״׷㹋鄲⢽: ⵸Ⳣ椚 s3_input = "criteo_dataset” s3_output = "criteo_norm” load_libsvm( path, s3_input) normalize( s3_input, s3_output, MIN_MAX_SCALING) LibSVM䕎䒭ךCriteoךر٦ة إحز׾铣׫鴥׿דأزٖ٦ آח،حفٗ٦س أزٖ٦آךر٦ة׾ MIN_MAX_SCALINGד垥彊⻉ ׃ծأزٖ٦آחⴽせד⥂㶷
  9. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. params = { ’n_workers’: 5, ’n_ps’: 1 , ’worker_size’: 1024, ’dataset’: s3_output, ’epsilon’: 0.0001, ’timeout’: 20 * 60, ’model_size’: 2**19, } lr_task = LogisticRegression(params) result = lr_task.run() Python API ח״׷㹋鄲⢽: 㷕统 ر٦ةإحزךؿٕؓتװծ 㷕统ךػًٓ٦ة׾鏣㹀 Logistic 㔐䌓ךㄎן⳿׃ה㹋遤
  10. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. lrates = np.arange(0.1, 10, 0.1) minibatch_size = [100, 1000] gs = GridSearch( task=LRegression, param_base=basic_params, hyper_vars=["learning_rate", "minibach_size"], hyper_params=[lrates, minibatch_sizes]) results = gs.run() Python API ח״׷㹋鄲⢽: ع؎ػ٦ػًٓ٦ة锃侭 ع؎ػ٦ػًٓ٦ةך 䱱稊眔㔲 ع؎ػ٦ػًٓ٦ة锃侭 ך㹋遤 Grid Searchךⵃ欽
  11. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 鐰⣣㹋꿀 ر٦ةإحز Criteo CTR Prediction Dataset 嫰鯰䩛岀 https://www.kaggle.com/c/criteo-display-ad-challenge • Serverless ML (䲿周ⰻ㺁) + PyWren • ؟٦غ٦ٖأדٗآأذ؍ؙأ㔐䌓׾⚛⴨㹋遤 • 㷕统،ٕ؞ٔؤيכSGD • 10⚛⴨דAWS Lambda (3GB RAM) ׾㹋遤 • Bosen • VM♳דٗآأذ؍ؙأ㔐䌓׾⚛⴨㹋遤 • 㷕统،ٕ؞ٔؤيכSGD • 1אךVM (EC2, m5.2xlarge: 2CPUs, 8GB RAM) ד㹋遤
  12. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. PyWren PyWren lets you run your existing python code at massive scale via AWS Lambda http://pywren.io/ def my_function(b): x = np.random.normal(0, b, 1024) A = np.random.normal(0, b, (1024, 1024)) return np.dot(A, x) pwex = pywren.default_executor() res = pwex.map(my_function, np.linspace(0.1, 100, 1000)) • 0.1ַ׵100תדך1000⦐ך⦼׾׮החծmy_function (dot product)׾鎘皾 • PyWrenכmy_functionך鎘皾׾؟٦غ٦ٖأח䫎־ג⚛⴨Ⳣ椚ׅ׷ ⢽)
  13. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 㹋꿀穠卓 • ML ؟٦غ٦ٖأכծBosenח 㼎׃גծٗأָ♴ָ׏גֶ׵׆ծ ꬊ䌢ח鹼ְ • 鸞䏝ָ鹼ְ⾱㔓ה׃גכծredis ַ׵ך铣׫《׶ךؔ٦غ٦قحس ָ㣐ְֹ • Baseline (䊨㣗ז׃ךPyWren)ח 㼎׃גRedisךⵃ欽זו׾剑黝⻉ ׾遤ֲה何㊣ׅ׷⫘ぢח֮׷
  14. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. 㹋遤儗꟦ךⴓ匿 • أزٖ٦آַ׵ىصغح ث׾《׶⳿ׅהֿ׹כ鹼 ֻזְ • Redisַ׵ٌرٕ׾ٗ٦سծ ⺟ꂁ׾鷏⥋ׅ׷הֿ׹ָ 鹼ְ
  15. © 2019, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Discussion: ML ؟٦غ٦ٖأ׾㹋植ׅ׷׋׭חכ • 넝鸞זⰟ剣أزٖ٦آ • ➙㔐כRedis׾䱰欽׃׋ָծ劍䖉ׅ׷鸞䏝ָ⳿גְזְկ • MLח暴⻉׃׋ػًٓ٦ة׾Ⱏ剣ׅ׷أزٖ٦آָ䗳銲ַ׮׃׸ זְկ • GPU؟ه٦ز • Deep Learningח䗳銲זGPU׾؟ه٦ز׃גְזְկ