Distributed Machine Learning with a Serverless Architecture
Hao Wang1, Di Niu2, Baochun Li1
1University of Toronto, 2University of Alberta
INFOCOM’19, Paris, FR
Distributed Machine Learning with a Serverless Architecture Hao Wang - - PowerPoint PPT Presentation
INFOCOM19, Paris, FR Distributed Machine Learning with a Serverless Architecture Hao Wang 1 , Di Niu 2 , Baochun Li 1 1 University of Toronto, 2 University of Alberta What is machine learning? Deep Learning Machine Learning Numerical
Hao Wang1, Di Niu2, Baochun Li1
1University of Toronto, 2University of Alberta
INFOCOM’19, Paris, FR
5
Gradients Numerical optimization
Objective Data
6
Model Design Model Tuning Training & Evaluation
Datasets … Convergence Loss rate …
Resource Reservation
Objective Budget
7
IaaS PaaS Pricing Per hour Per hour Maintanance By users By providers Examples AWS EC2, Google Cloud Compute … Azure ML Studio, Google Cloud ML Engine …
8
…
9
IaaS PaaS Serverless Pricing Per hour Per hour Per call Maintanance By users By providers By providers Examples AWS EC2 Azure ML Studio AWS Lambda
Stateless function
10
Pro:
Con:
11
Input Samples
θ(xi))xi j
13
Input Samples
θ j = θ j + a b
k=i i+b−1
θ(xk ))x j k
14
Li, Mu, et al. Scaling distributed machine learning with the parameter server. OSDI'14
θ j = θ j + a b
k=i i+b−1
θ(xk ))x j k
θ j = θ j + a b
k=i i+b−1
θ(xk ))x j k
θ j = θ j + a b
k=i i+b−1
θ(xk ))x j k
Input Samples
KV Storage
16
Function Function Function
Input Samples KV Storage
17
Func. Func. Func.
20 functions 8-core EC2 150 functions X functions Loss value 0.010 0.015 Time (s) 100 200 300 Cost ($) 0.005 0.010 0.015 0.020 0.025 0.030
Slowest, no cheap Fastest, expensive Fast, cheap
X functions:
Cloud
User- Defined Model API Libs
DRL Agent Function Manager Local Client Scheduler
resource scheme
Step 1
function status
Step 3
action states code package
Stateless Functions
Synchronous training Asynchronous training
… epoch t epoch t+1 time Fetching input Computing Updating parameters mini-batch …
ft,i ft,i+1 ft+1,i
Slowest, no cheap Fastest, expensive Fast, cheap
Environment Agent
Stateless Functions
Policy parameters Features
θ
Action
at
Reward
rt
State
st−1
Policy
π(at|st−1, θ)
st = (t, ℓt, Pt, PF
t , PC t , PU t , ut, wt, bt)
Approximating with Gaussian distribution
at = (nt, mt) nt, mt ∈ ℤ+
π(a|s, θ) = 1 σ(s, θ) 2π exp( − (a − μ(s, θ)2 2σ(s, θ)2 )
nt × mt choices ~ 138,000 actions on AWS
Policy
π(at|st−1, θ)
<latexit sha1_base64="FYbupf5GD4w9OLOvMRG1RFwmhU=">ACG3icbVDLSsNAFJ3UV62vqEs3wSJU0JIUQZcFNy4r2Ac0IUymk3bo5MHMjVBi/sONv+LGhSKuBf+jZM2BW09MHDmnHu59x4v5kyCaX5rpZXVtfWN8mZla3tnd0/fP+jIKBGEtknEI9HzsKSchbQNDjtxYLiwO0642vc797T4VkUXgHk5g6AR6GzGcEg5JcvWHrGYHGEaen+LMhYf5R2ZuCudWdjYXbBhRwNmpq1fNujmFsUysglRgZarf9qDiCQBDYFwLGXfMmNwUiyAEU6zip1IGmMyxkPaVzTEAZVOr0tM06UMjD8SKgXgjFVf3ekOJByEniqMt9TLnq5+J/XT8C/clIWxgnQkMwG+Qk3IDLyoIwBE5QAnyiCiWBqV4OMsMAEVJwVFYK1ePIy6Tqlm3bi+qzUYRxkdoWNUQxa6RE10g1qojQh6RM/oFb1pT9qL9q59zEpLWtFziP5A+/oBmwSiUQ=</latexit><latexit sha1_base64="FYbupf5GD4w9OLOvMRG1RFwmhU=">ACG3icbVDLSsNAFJ3UV62vqEs3wSJU0JIUQZcFNy4r2Ac0IUymk3bo5MHMjVBi/sONv+LGhSKuBf+jZM2BW09MHDmnHu59x4v5kyCaX5rpZXVtfWN8mZla3tnd0/fP+jIKBGEtknEI9HzsKSchbQNDjtxYLiwO0642vc797T4VkUXgHk5g6AR6GzGcEg5JcvWHrGYHGEaen+LMhYf5R2ZuCudWdjYXbBhRwNmpq1fNujmFsUysglRgZarf9qDiCQBDYFwLGXfMmNwUiyAEU6zip1IGmMyxkPaVzT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qMt9TLnq5+J/XT8C/clIWxgnQkMwG+Qk3IDLyoIwBE5QAnyiCiWBqV4OMsMAEVJwVFYK1ePIy6Tqlm3bi+qzUYRxkdoWNUQxa6RE10g1qojQh6RM/oFb1pT9qL9q59zEpLWtFziP5A+/oBmwSiUQ=</latexit>At each epoch ,
rt = − βPt, t = 1,…, T − 1
At the final epoch ,
T
regularizer a constant as the final reward/penalty reach the expected loss value,
Policy gradient:
max
T
∑
t=1
γtrt, γ ∈ (0,1]
Maximize cumulative discounted reward:
∇θ𝔽π[
T
∑
t=1
γtrt] = 𝔽π[∇θln π(a|s, θ)qπ(s, a)]
policy function expected reward with and a s discount factor
Environment Agent
Stateless Functions
Policy parameters Features
θ
Action
at
Reward
rt
State
st−1
Policy
π(at|st−1, θ)
Cloud
User- Defined Model API Libs
DRL Agent Function Manager Local Client Scheduler
resource scheme
Step 1
function status
Step 3 Step 5
action
Step 4
states code package
Stateless Functions
Step 2
GS-300 GS-200 GS-100 GS-50 Total rewards −100 100 Number of functions 1000 2000 GS Siren 10.03% 12.87% 36% Time (s) 2000 3000 4000 5000 Budget ($) 100 200 300
Siren-300 Siren-200 Siren-100 Number of functions 500 1000 Epoch of ML training 100 200 300 Siren-300 Total rewards −200 −100 100 Iteration 100 200 300
m4.large m4.xlarge m4.2xlarge Siren Cost($) 0.02 0.04 0.06 0.08 Time (s) 50 100 150 200 250 Number of EC2 instances 2 4 6 8 Siren
# of functions Memory # of functions 500 1000 Memory (MB) 200 400 600 800 Training epoch of LeNet 2 4 6 8 Total rewards −100 100 Iteration 100 200 300
EC2 Siren Time (s) 100 200 300 400 Cost ($) 0.02 0.04 0.06 0.08
50 100 LeNet 1000 2000 CNN 1000 2000 3000 Linear Classfication m4.2xlarge Siren Time (s)