Declara've Systems for Large Scale Machine Learning - - PowerPoint PPT Presentation

declara ve systems for large scale machine learning
SMART_READER_LITE
LIVE PREVIEW

Declara've Systems for Large Scale Machine Learning - - PowerPoint PPT Presentation

Declara've Systems for Large Scale Machine Learning Markus Weimer, Tyson Condie, Raghu Ramakrishnan Cloud and Informa'on Services Laboratory MicrosoA


slide-1
SLIDE 1

Declara've ¡Systems ¡for ¡ ¡ Large ¡Scale ¡Machine ¡Learning ¡

Markus ¡Weimer, ¡Tyson ¡Condie, ¡Raghu ¡Ramakrishnan ¡ ¡ Cloud ¡and ¡Informa'on ¡Services ¡Laboratory ¡ MicrosoA ¡

slide-2
SLIDE 2

Joint ¡work ¡with ¡… ¡

6/5/12 2

Yingyi ¡Bu, ¡Vinayak ¡Borkar, ¡Michael ¡J. ¡Carey ¡ University ¡of ¡California, ¡Irvine ¡ Joshua ¡Rosen, ¡Neoklis ¡Polyzo's ¡ University ¡of ¡California, ¡Santa ¡Cruz ¡

slide-3
SLIDE 3

Example: ¡Spam ¡Filter ¡

6/5/12 3

Inbox ¡ Spam ¡ Spam ¡ Filter ¡ User ¡ Interface ¡ Logged ¡ Event ¡

slide-4
SLIDE 4

Machine ¡Learning ¡Workflow ¡

  • Step ¡I: ¡Example ¡Forma;on ¡

– Feature ¡Extrac'on ¡ – Label ¡Extrac'on ¡

  • Step ¡II: ¡Modeling ¡
  • Step ¡III: ¡Deployment ¡(or ¡just ¡Evalua;on) ¡

6/5/12 4

Example ¡ Forma'on ¡ Modeling ¡ Evalua'on ¡

slide-5
SLIDE 5

Example ¡Forma'on ¡

6/5/12 5

EMail ¡ Click ¡Log ¡ Bag ¡of ¡ Words ¡ ID ¡ Label ¡ ID ¡ Bag ¡of ¡ Words ¡ Label ¡ ID ¡ Feature Extraction Label Extraction Data ¡Parallel ¡ Func'ons ¡ Large ¡Scale ¡Join ¡ Large ¡Scale ¡Join ¡

slide-6
SLIDE 6

Modeling ¡

  • Many ¡Algorithms ¡are ¡inherently ¡sequen;al ¡

– Apply ¡model ¡to ¡data ¡à ¡Look ¡at ¡Errors ¡à ¡Update ¡ Model ¡

  • Common ¡solu;ons ¡

– Subsampling ¡ – Train ¡on ¡par''ons, ¡merge ¡results ¡ – Rephrasing ¡of ¡algorithms ¡in ¡MapReduce ¡

6/5/12 6

slide-7
SLIDE 7

MapReduce ¡for ¡Modeling ¡

  • Learning ¡algorithm ¡

access ¡the ¡data ¡only ¡ through ¡sta;s;cal ¡ querys ¡

  • A ¡sta's'cal ¡query ¡

returns ¡an ¡es'mate ¡of ¡ the ¡expecta'on ¡of ¡a ¡ func'on ¡f(x,y) ¡applied ¡ to ¡the ¡data. ¡

6/5/12 7

slide-8
SLIDE 8

MapReduce ¡for ¡Modeling ¡

  • Rephrase ¡query ¡in ¡

summa'on ¡form. ¡ ¡

  • Map: ¡Calculate ¡func'on ¡

es'mates ¡over ¡data ¡ par''ons ¡

  • Reduce: ¡Aggregate ¡the ¡

func'on ¡es'mates. ¡

6/5/12 8

slide-9
SLIDE 9

Example ¡Methods ¡

  • Convex ¡Op'miza'on ¡

– (Logis'c) ¡Regression ¡ – Support ¡Vector ¡ machines ¡ – … ¡

  • K-­‑Means ¡Clustering ¡
  • Naïve ¡Bayes ¡
  • Neural ¡Networks ¡
  • … ¡

6/5/12 9

slide-10
SLIDE 10

Regularization Data Parallel Sum

Example: ¡Batch ¡Gradient ¡Descent ¡ (BGD) ¡

6/5/12 10

wt +1 = 1.0 −ηλ

( )* wt −η

∂wl y, wt,x

( )

(x,y)

' ( ) * + ,

Until Convergence:

wt: Current Model x: Data y: Label l: loss function (e.g. squared error) ∂: Gradient operator

slide-11
SLIDE 11

Example: ¡Gradient ¡Computa'on ¡

6/5/12 11

Par''on ¡I ¡ Par''on ¡II ¡ Par''on ¡III ¡ Gradient ¡I ¡ Gradient ¡II ¡ Gradient ¡III ¡ Gradient ¡ Sum ¡

Map ¡ Reduce ¡

slide-12
SLIDE 12

Modeling ¡on ¡Hadoop ¡MapReduce? ¡

  • Machine ¡learning ¡algorithms ¡are ¡itera;ve ¡

– Each ¡itera'on ¡contains ¡mul'ple ¡Sta's'cal ¡Queries ¡

  • Overhead ¡per ¡MapReduce ¡Job ¡

– Each ¡sta's'cal ¡query ¡is ¡a ¡job ¡ – A ¡job ¡entails ¡Scheduling, ¡Data ¡reading, ¡State ¡ transfer, ¡… ¡ – Especially ¡bad ¡on ¡shared ¡clusters ¡

6/5/12 12

slide-13
SLIDE 13

More ¡than ¡Map ¡Reduce ¡

  • Complete ¡Job ¡DAGs ¡

– Beyond ¡the ¡fixed ¡map-­‑ groupby-­‑reduce ¡ – Arbitrary ¡length ¡and ¡ complexity ¡

  • More ¡Operators ¡

– Join, ¡Filter, ¡Project, ¡… ¡

  • Examples ¡ ¡

– Dryad ¡(MicrosoA ¡Research) ¡ – Hyracks ¡(UC ¡Irvine) ¡ – Stratosphere ¡(TU ¡Berlin) ¡

6/5/12 13

slide-14
SLIDE 14

More ¡than ¡Map ¡Reduce ¡

  • Complete ¡Job ¡DAGs ¡

– Beyond ¡the ¡fixed ¡map-­‑ groupby-­‑reduce ¡ – Arbitrary ¡length ¡and ¡ complexity ¡

  • More ¡Operators ¡

– Join, ¡Filter, ¡Project, ¡… ¡

  • Examples ¡ ¡

– Dryad ¡(MicrosoA ¡Research) ¡ – Hyracks ¡(UC ¡Irvine) ¡ – Stratosphere ¡(TU ¡Berlin) ¡

6/5/12 14

Machine Learning is Cyclic!

slide-15
SLIDE 15

Applied ¡Large ¡Scale ¡ML ¡requires ¡… ¡

  • A ¡Rela;onal ¡Algebra ¡

– Join, ¡Filter, ¡Map, ¡ ¡… ¡ – For ¡feature ¡and ¡label ¡extrac'on ¡

  • Itera;ve ¡computa;on ¡

– Loops ¡over ¡data ¡ – Incremental ¡model ¡updates ¡

  • Scalability ¡/ ¡High ¡Performance ¡

– Jobs ¡must ¡execute ¡successfully ¡irrespec've ¡of ¡ the ¡data ¡set ¡size ¡/ ¡run'me ¡cluster ¡configura'on ¡ – More ¡favorable ¡cluster ¡setups ¡must ¡be ¡used ¡for ¡ speed-­‑ups ¡(e.g. ¡cache ¡data ¡in ¡memory) ¡

6/5/12 15

?

Spark Giraph (Pregel) One- Offs

slide-16
SLIDE 16

Take-­‑away ¡

  • Usability ¡is ¡bad ¡

– Developing ¡a ¡single ¡model ¡takes ¡months ¡ – Requires ¡many ¡tools ¡and ¡technologies ¡

  • Pick ¡your ¡poison ¡on ¡a ¡way ¡to ¡a ¡subpar ¡solu'on ¡

– Subsampling ¡hurts ¡model ¡fidelity ¡ – Training ¡on ¡MapReduce ¡oAen ¡too ¡slow ¡

6/5/12 16

slide-17
SLIDE 17

Goals ¡

  • Integrate ¡modeling ¡and ¡ETL ¡workflows ¡

– All ¡Pig ¡operators ¡ – Itera'on ¡is ¡a ¡first ¡class ¡ci'zen ¡ – Unify ¡MPI, ¡Pregel, ¡MapReduce, ¡… ¡on ¡a ¡single ¡run'me ¡

  • Improve ¡produc;vity ¡

– Free ¡the ¡Programmer ¡from ¡run'me ¡details ¡(like ¡ MapReduce) ¡ – Facilitate ¡easier ¡job ¡composi'on ¡ – IDE ¡support ¡ – UDFs ¡as ¡first ¡class ¡ci'zens ¡(unlike ¡Pig) ¡

6/5/12 17

slide-18
SLIDE 18

Vision ¡

User ¡ Program ¡ Logical ¡ Plan ¡ Physical ¡ Plan ¡ Execu'on ¡ Engine ¡

6/5/12 18

slide-19
SLIDE 19

Vision ¡

User ¡ Program ¡ Logical ¡ Plan ¡ Physical ¡ Plan ¡ Execu'on ¡ Engine ¡ ScalOps ¡ Algebricks ¡ Physical ¡ Plan ¡ Hyracks ¡

6/5/12 19

Loop ¡ Aware ¡on ¡ all ¡Levels ¡

slide-20
SLIDE 20

ScalOps ¡– ¡The ¡Language ¡

ScalOps ¡ Algebricks ¡ Physical ¡ Plan ¡ Hyracks ¡

6/5/12 20

slide-21
SLIDE 21

ScalOps ¡– ¡Overview ¡

  • Embedded ¡Domain ¡Specific ¡Language ¡in ¡Scala ¡
  • All ¡Pig ¡Operators ¡(Filter, ¡Join, ¡GroupBy, ¡…) ¡
  • Itera'on ¡support ¡
  • Rich ¡UDF ¡support ¡

– Inline ¡Scala ¡func'on ¡calls ¡/ ¡literals ¡ – Everything ¡callable ¡from ¡a ¡JVM ¡can ¡be ¡a ¡UDF ¡

  • Support ¡in ¡major ¡IDEs ¡

6/5/12 21

slide-22
SLIDE 22

Regularization Data Parallel Sum

Example: ¡Batch ¡Gradient ¡Descent ¡ (BGD) ¡

6/5/12 22

wt +1 = 1.0 −ηλ

( )* wt −η

∂wl y, wt,x

( )

(x,y)

' ( ) * + ,

Until Convergence:

wt: Current Model x: Data y: Label l: loss function (e.g. squared error) ∂: Gradient operator

slide-23
SLIDE 23

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

BGD ¡in ¡ScalOps ¡

6/5/12 23

Training ¡data; ¡Table ¡is ¡

  • ur ¡main ¡collec'on ¡type ¡

Computes ¡a ¡gradient ¡ Computes ¡the ¡loss ¡ Ini'alizer ¡ Loop ¡Condi'on ¡ Loop ¡Body ¡ Na've ¡UDFs ¡

slide-24
SLIDE 24

Spark!? ¡

  • Scala ¡DSL ¡and ¡run'me ¡for ¡data ¡analy'cs ¡

– Op'mized ¡for ¡in-­‑memory ¡computa'ons ¡ – Targets ¡machine ¡learning ¡algorithms ¡

  • Logis'c ¡Regression ¡in ¡Spark ¡

¡

6/5/12 24

val points = spark.textFile(...). map(parsePoint). partitionBy(HashPartitioner(NODES)). cache() var w = Vector.random(D) // current separating plane for (i <- 1 to ITERATIONS) { val gradient = points.map(p => (1 / (1 + exp(-p.y*(w dot p.x))) - 1) * p.y * p.x ). reduce(_ + _) w -= gradient }

val points = spark.textFile(...). map(parsePoint). partitionBy(HashPartitioner(NODES)). cache() Physical ¡Layer ¡

slide-25
SLIDE 25

Parse ¡Tree ¡Extrac'on ¡Example ¡

6/5/12 25

table.filter(_>7).map(x=>x^2)

… ¡ _>7 Map ¡ Filter ¡ x => x^2

slide-26
SLIDE 26

Automa'c ¡Op'miza'ons ¡

6/5/12 26

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

slide-27
SLIDE 27

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

Automa'c ¡Op'miza'ons ¡

6/5/12 27

Merge ¡into ¡one ¡ MapReduce ¡ Step ¡

slide-28
SLIDE 28

Automa'c ¡Op'miza'ons ¡

6/5/12 28

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

slide-29
SLIDE 29

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

Automa'c ¡Op'miza'ons ¡

6/5/12 29

Merge ¡into ¡one ¡ Operator ¡

slide-30
SLIDE 30

Automa'c ¡Op'miza'ons ¡

6/5/12 30

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

slide-31
SLIDE 31

Automa'c ¡Op'miza'ons ¡

6/5/12 31

def ¡train(xy:Table[Example], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_grad:(Example, ¡Vector) ¡=> ¡Vector, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡compute_loss:(Example, ¡Vector) ¡=> ¡Double) ¡= ¡{ ¡ ¡ ¡ ¡ ¡class ¡Env(w:VectorType, ¡lastError:DoubleType, ¡delta:DoubleType) ¡extends ¡Environment ¡ ¡ ¡ ¡ ¡val ¡initialValue ¡= ¡new ¡Env(VectorType.zeros(1000), ¡Double.MaxValue, ¡Double.MaxValue) ¡ ¡ ¡ ¡ ¡loop(initialValue, ¡(env: ¡Env) ¡=> ¡env.delta ¡< ¡eps) ¡{ ¡env ¡=> ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡gradient ¡= ¡xy.map(x=>compute_grad(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡val ¡loss ¡ ¡ ¡ ¡ ¡= ¡xy.map(x=>compute_loss(x,env.w)).reduce(_+_) ¡ ¡ ¡ ¡ ¡ ¡ ¡env.w ¡ ¡ ¡ ¡ ¡ ¡ ¡-­‑= ¡gradient ¡ ¡ ¡ ¡ ¡ ¡ ¡env.delta ¡ ¡ ¡ ¡= ¡env.lastLoss ¡-­‑ ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env.lastLoss ¡= ¡loss ¡ ¡ ¡ ¡ ¡ ¡ ¡env ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡} ¡ } ¡ ¡ ¡ ¡

Cache ¡xy ¡in ¡main ¡ memory, ¡if ¡possible ¡

slide-32
SLIDE 32

Result: ¡Logical ¡Plan ¡

6/5/12 32

MapReduce

Map() Reduce()

Sequential

Update() Aggregate Statistics (Model, Performance) Model

Loop

Continue()

Training Data

slide-33
SLIDE 33

Physical ¡Op'mizer ¡

ScalOps ¡ Algebricks ¡ Physical ¡ Plan ¡ Hyracks ¡

6/5/12 33

slide-34
SLIDE 34

Itera've ¡Map-­‑Reduce-­‑Update ¡ (Physically) ¡

6/5/12 34

Data Loading

HDFS

Iterative Computation

Sequential (update) HDFS

HDFS

Iteration Barrier Driver (loop)

model model

Cached Records

CR CR (map) CR CR CR (map) (map) (map) Aggregation tree (reduce)

How many? Fan-In?

slide-35
SLIDE 35

Other ¡“Op'miza'ons” ¡

  • Caching, ¡“Rocking” ¡
  • Data-­‑Local ¡Scheduling ¡
  • Itera'on-­‑Aware ¡Scheduling ¡
  • Avoid ¡(de-­‑)serializa'on ¡
  • Minimize ¡#network ¡connec'ons ¡
  • Pipelining ¡
  • … ¡

6/5/12 35

slide-36
SLIDE 36

Op'mal ¡Aggrega'on ¡Tree ¡Fan-­‑In ¡

6/5/12 36

+ … + … … + … … … Fan-In

slide-37
SLIDE 37

Tree ¡Fan-­‑In ¡

6/5/12 37

+ + + + + + +

slide-38
SLIDE 38

Tree ¡Fan-­‑In: ¡Blocking ¡

6/5/12 38

+ + + + + + +

h = logf(N) = ln(N) ln(f)

slide-39
SLIDE 39

Tree ¡Fan-­‑In: ¡Time ¡per ¡level ¡

6/5/12 39

+ + + + + + +

t = fA h = logf(N) = ln(N) ln(f)

slide-40
SLIDE 40

6/5/12 40

+ + + + + + +

T = h ∗ t = f ln(f) ln(N)A Minimized for f=e

Overall ¡Aggrega'on ¡Time ¡ Minimiza'on ¡

slide-41
SLIDE 41

Op'mal ¡Par''oning: ¡Time ¡per ¡Itera'on ¡

6/5/12 41

T = TA(N) + TM(N) = Ae ln(N) + RD + RP N − MD

Aggregation time Map time Time for not loading from Disk Processing Time

Symbol ¡ Meaning ¡ R ¡ # ¡Records ¡ M ¡ Cache ¡capacity ¡per ¡CPU ¡ P ¡ Map ¡'me ¡per ¡record ¡ D ¡ Load ¡'me ¡per ¡record ¡ A ¡ Aggrega'on ¡'me ¡per ¡record ¡

Load Time

slide-42
SLIDE 42

Op'mal ¡Choices ¡(Summary) ¡

  • Minimal ¡Wall ¡Clock ¡Time ¡

– Balance ¡aggrega'on ¡& ¡map ¡'me ¡ – Almost ¡always: ¡Use ¡as ¡many ¡machines ¡as ¡you ¡can ¡

  • Minimal ¡Cost ¡('me ¡x ¡#machines) ¡

– If ¡your ¡data ¡fits ¡into ¡distributed ¡RAM: ¡do ¡that ¡ – Else: ¡It’s ¡complicated ¡

6/5/12 42

slide-43
SLIDE 43

Time ¡Op'mal ¡Par''oning ¡

6/5/12 43

Symbol ¡ Meaning ¡ R ¡ # ¡Records ¡ M ¡ Cache ¡capacity ¡per ¡CPU ¡ P ¡ Map ¡'me ¡per ¡record ¡ D ¡ Load ¡'me ¡per ¡record ¡ A ¡ Aggrega'on ¡'me ¡per ¡record ¡ Let R ≤ MN. The time-minimal number of machines for an Iterative Map- Reduce-Update operator is ˆ N1 = RP Ae Let R > MN. The time-minimal number of machines for an Iterative Map- Reduce-Update operator is ˆ N1 = RD + RP Ae Most ¡oAen: ¡Use ¡as ¡ many ¡machines ¡as ¡ you ¡have ¡

slide-44
SLIDE 44

Cost ¡Op'mal ¡Par''oning ¡

6/5/12 44

Symbol ¡ Meaning ¡ R ¡ # ¡Records ¡ M ¡ Cache ¡capacity ¡per ¡CPU ¡ P ¡ Map ¡'me ¡per ¡record ¡ D ¡ Load ¡'me ¡per ¡record ¡ A ¡ Aggrega'on ¡'me ¡per ¡record ¡ Let R ≤ MN. The cost-minimal number of machines for an Iterative Map- Reduce-Update operator is ˆ N1 = R M Let R > MN. The cost-minimal number of machines for an Iterative Map- Reduce-Update operator is ˆ N1 = e

MD Ae

The ¡solu'on ¡ heavily ¡depends ¡on ¡ your ¡job ¡

slide-45
SLIDE 45

Evalua'on ¡

ScalOps ¡ Algebricks ¡ Physical ¡ Plan ¡ Hyracks ¡

6/5/12 45

slide-46
SLIDE 46

Evalua'on ¡Methodology ¡

  • Metrics ¡

– Itera'on ¡'me ¡ – Cost: ¡itera'on ¡'me ¡x ¡number ¡of ¡machines ¡

  • Speed-­‑up ¡

– Fix ¡the ¡data ¡size ¡and ¡scale ¡up ¡# ¡of ¡machines ¡ – Goal: ¡iden'fy ¡cost ¡op'mal ¡# ¡of ¡machines ¡

  • Scale-­‑up ¡

– Start ¡with ¡cost ¡op'mal ¡configura'on ¡ – Propor'onally ¡increase ¡data ¡size ¡and ¡# ¡of ¡machines ¡

6/5/12 46

slide-47
SLIDE 47

6/5/12 47

slide-48
SLIDE 48

News ¡Recommenda'on ¡

  • Task ¡ ¡

– Predict ¡news ¡click-­‑through ¡rate ¡ – Linear ¡Model ¡

  • Data ¡

– 120GB ¡in ¡libsvm ¡text ¡format ¡

  • Hardware ¡

– 150 ¡Machines ¡in ¡5 ¡Rack, ¡1Gbps ¡Ethernet ¡ – Each ¡machine: ¡8 ¡Cores, ¡4 ¡Disks, ¡16GB ¡RAM ¡

6/5/12 48

slide-49
SLIDE 49

Spark ¡vs. ¡Hyracks ¡Speedup ¡

6/5/12 49

50 100 150 200 Iteration time (seconds) 5 10 15 20 25 30 40 50 60 Number of machines Spark 200 400 600 800 1,000 1,200 Cost (machine-seconds) 50 100 150 200 Iteration time (seconds) 5 10 15 20 25 30 40 50 60 Number of machines Hyracks 200 400 600 800 1,000 1,200 Cost (machine-seconds) Iteration time (seconds); Cost (machine-seconds)

slide-50
SLIDE 50

Spark ¡vs. ¡Hyracks ¡Scale-­‑up ¡

6/5/12 50 80 160 240 320 400 480 20 40 60 80 Dataset Size (GB) Iteration time (seconds) 80 160 240 320 400 480 2,000 4,000 6,000 8,000 10,000 12,000 14,000 16,000 Dataset Size (GB) Cost (machine-seconds) Spark C30; Hyracks C30; Hyracks C10

slide-51
SLIDE 51

6/5/12 51

slide-52
SLIDE 52

Personalized ¡Adver'sement ¡

  • Task ¡ ¡

– Predict ¡ad ¡click-­‑through ¡rate ¡ – Linear ¡Model, ¡learned ¡with ¡BGD ¡

  • Data ¡

– 500GB ¡in ¡VW ¡text ¡format ¡

  • Hardware ¡

– 30 ¡Machines ¡in ¡one ¡Rack ¡1Gbps ¡Ethernet ¡ – Each ¡machine: ¡8 ¡Cores, ¡4 ¡Disks, ¡16GB ¡RAM ¡

6/5/12 52

slide-53
SLIDE 53

Grounding ¡Experiment ¡

124.41 ¡ 127.42 ¡ 114.54 ¡ 60 ¡ 70 ¡ 80 ¡ 90 ¡ 100 ¡ 110 ¡ 120 ¡ 130 ¡ 140 ¡ Itera;on ¡;me ¡(s) ¡ VW ¡ Hyracks ¡(VW) ¡ Hyracks ¡(Op'mized) ¡

6/5/12 53

slide-54
SLIDE 54

50 100 150 Iteration time (seconds) 5 6 10 15 20 30 Machines 3,000 4,000 5,000 6,000 Iteration cost (machine seconds)

Results: ¡Op'mizer ¡Evalua'on ¡

6/5/12 54

Optimizer: Cheapest Optimizer: Fastest

slide-55
SLIDE 55

Experiments ¡in ¡the ¡Pregel ¡Model ¡

  • Task ¡

– Compute ¡PageRank ¡

  • Data ¡

– Yahoo! ¡Webmap ¡as ¡available ¡on ¡Webscope ¡ – 1.4B ¡nodes, ¡8GB ¡on ¡disk ¡

  • Cluster ¡

– 150 ¡Machines ¡in ¡5 ¡Rack, ¡1Gbps ¡Ethernet ¡ – Each ¡machine: ¡8 ¡Cores, ¡4 ¡Disks, ¡16GB ¡RAM ¡

6/5/12 55

slide-56
SLIDE 56

Related ¡Work ¡

  • Three ¡OSS ¡systems ¡can ¡run ¡the ¡task ¡

– Hadoop ¡ – Hyracks ¡ – GraphLab ¡2 ¡(different ¡computa'on ¡model) ¡

  • Several ¡systems ¡failed ¡despite ¡3.2TB ¡RAM ¡

– Giraph/Golden ¡Orb ¡(by ¡transi've ¡closure) ¡ – Spark ¡(despite ¡Matei’s ¡help) ¡ – Mahout ¡

6/5/12 56

slide-57
SLIDE 57

Hyracks ¡vs. ¡Hadoop ¡Pagerank ¡Speedup ¡

6/5/12 57 31 60 88 117 146 500 1,000 1,500 2,000 Number of machines Iteration time (seconds) Hadoop 20,000 40,000 60,000 Cost (machine-seconds) 31 60 88 117 146 50 100 150 200 Number of machines Iteration time (seconds) Hyracks 2,000 4,000 6,000 Cost (machine-seconds) Iteration time (seconds); Cost (machine-seconds)

slide-58
SLIDE 58

Conclusion ¡

User ¡ Program ¡ Logical ¡ Plan ¡ Physical ¡ Plan ¡ Execu'on ¡ Engine ¡ ScalOps ¡ Algebricks ¡ Physical ¡ Plan ¡ Hyracks ¡

6/5/12 58

Loop ¡ Aware ¡on ¡ all ¡Levels ¡

slide-59
SLIDE 59

Benefits ¡

  • Unifies ¡both ¡ETL ¡and ¡Itera've ¡Computa'on ¡in ¡

a ¡single ¡framework ¡

– Simplifies ¡Job ¡Composi'on ¡

  • Op'mizable ¡Execu'on ¡Plans ¡

– Impera've ¡for ¡compute ¡clouds ¡ – Supports ¡different ¡op'miza'on ¡goals ¡

6/5/12 59

slide-60
SLIDE 60

Future ¡Work ¡

  • Build ¡& ¡package ¡it ¡for ¡consump;on ¡
  • Op;mizer ¡for ¡recursive ¡data ¡flows ¡

– Example: ¡Auto-­‑detect ¡the ¡need ¡for ¡caching ¡

  • Expose ¡run;me ¡policies ¡to ¡the ¡DSL ¡layer ¡

– Example: ¡Make ¡fault ¡tolerance ¡op'onal ¡

  • Support ¡Asynchronous ¡Computa;on ¡

– Important ¡for ¡Graphical ¡Models ¡

6/5/12 60

slide-61
SLIDE 61

Coordinates ¡

  • Hyracks ¡

– http://code.google.com/p/hyracks/ ¡ – http://asterix.ics.uci.edu/ ¡

  • Markus ¡Weimer ¡

– mweimer@microsoft.com ¡ – @markusweimer ¡ – http://cs.markusweimer.com ¡

6/5/12 61