36
Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab [email protected] In Collaboration with Xinghao Pan, Stefanie Jegelka, Tamara Broderick, Michael I. Jordan

Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab [email protected] In Collaboration with Xinghao Pan,

Embed Size (px)

Citation preview

Page 1: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Concurrency Control forMachine Learning

Joseph E. GonzalezPost-doc, UC Berkeley [email protected]

In Collaboration withXinghao Pan, Stefanie Jegelka, Tamara Broderick, Michael

I. Jordan

Page 2: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters

Serial Machine Learning Algorithm

Page 3: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters

Parallel Machine Learning

Page 4: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters !!

Parallel Machine Learning

Concurrency:more machines = less time

Correctness:serial equivalence

Page 5: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters

Coordination-free

Page 6: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters

Concurrency Control

Page 7: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters

Serializability

Page 8: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Research Summary

Coordination Free (e.g., Hogwild):

Provably fast and correct under key assumptions.

Concurrency Control (e.g., Mutual Exclusion):

Provably correct and fast under key assumptions.

Research Focus

Page 9: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Optimistic Concurrency Controlto parallelize:

Non-Parametric Clustering

and

Sub-modular Maximization

Page 10: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Data

ModelParameters

Optimistic Concurrency Control

• Optimistic updates• Validation: detect conflict• Resolution: fix conflict

! !

Hsiang-Tsung Kung and John T Robinson.On optimistic methods for concurrency control.

ACM Transactions on Database Systems (TODS), 6(2):213–226, 1981.

Concurrency

Correctness

Page 11: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Example:

Serial DP-means Clustering

Sequential!

Brian Kulis and Michael I. Jordan.Revisiting k-means: New algorithms via Bayesian nonparametrics.

In Proceedings of 23rd International Conference on Machine Learning, 2012.

Page 12: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Validation

ResolutionFirst proposal wins

AssumptionNo new cluster created nearby

Example:

OCC DP-means Clustering

Page 13: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Optimistic Concurrency Control for DP-means

Theorem: OCC DP-means is serializable.

Corollary: OCC DP-means preserves theoretical properties of DP-means.

Theorem: Expected overhead of OCC DP-means, in terms of number of rejected proposals, does not depend on size of data set.

Corr

ectn

es

sC

on

cu

rre

ncy

Page 14: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Evaluation: Amazon EC2

1 2 3 4 5 6 7 80

500

1000

1500

2000

2500

3000

3500

Number of Machines

Ru

nti

me I

n S

econ

dP

er

Com

ple

te P

ass o

ver

Data

OCC DP-means Runtime Projected Linear Scaling

~140 million data points; 1, 2, 4, 8 machines

Page 15: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Optimistic Concurrency Controlto parallelize

Non-Parametric Clustering

Summary

Sub-modular Maximization

Next

Page 16: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Motivating ExampleBidding on Keywords:

Apple

iPhone

Android

Games

xBox

Samsung

Microwave

Appliances

Keywords“How big is Apple iPhone”

“iPhone vs Android”

“best Android and iPhone games”“Samsung sues Apple over iPhone”

“Samsung Microwaves”

“Appliance stores in SF”

“Playing games on a Samsung TV”

“xBox game of the year”

Common Queries

Page 17: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Motivating ExampleBidding on Keywords:

Apple

iPhone

Android

Games

xBox

Samsung

Microwave

Appliances

Keywords“How big is Apple iPhone”

“iPhone vs Android”

“best Android and iPhone games”“Samsung sues Apple over iPhone”

“Samsung Microwaves”

“Appliance stores in SF”

“Playing games on a Samsung TV”

“xBox game of the year”

Common QueriesA

B

C

D

E

F

G

H

Keywords Queries1

2

3

4

5

6

7

8

Page 18: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Motivating ExampleBidding on Keywords:

Keywords QueriesA

B

C

D

E

F

G

H

1

2

3

4

5

6

7

8

$2

$5

$1

$2

$5

$1

$4

$2

Cost

s

$2

$2

$4

$4

$3

$6

$5

$1

Valu

e

Page 19: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Purchase

Motivating ExampleBidding on Keywords:

Keywords QueriesA

C

D

E

F

G

H

5

6

7

8

$2

$5

$1

$2

$5

$1

$4

$2

Cost

s

$2

$2

$4

$4

$3

$6

$5

$1

Valu

e

B

1

2

3

4

Cover $5- Cost:

$12

Revenue:

$7Profit:

Page 20: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Purchase

Purchase

Motivating ExampleBidding on Keywords:

Keywords QueriesA

D

E

F

G

H

5

6

7

8

$2

$5

$1

$2

$5

$1

$4

$2

Cost

s

$2

$2

$4

$4

$3

$6

$5

$1

Valu

e

B

1

4

CoverC

2

3

$12$5- Cost:

Revenue:

$7Profit:

+1

$6

Submodularity =

Diminishing Returns

Page 21: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Purchase

Purchase

Purchase

Purchase

Motivating ExampleBidding on Keywords:

Keywords QueriesA

B

C

D

E

F

G

H

1

2

3

4

5

6

7

8

$2

$5

$1

$2

$5

$1

$4

$2

Cost

s

$2

$2

$4

$4

$3

$6

$5

$1

Valu

e

$20$10

- Cost:

Revenue:

$10

Profit:

Page 22: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Purchase

Purchase

Purchase

Purchase

Motivating ExampleBidding on Keywords:

Keywords QueriesA

B

C

D

E

F

G

H

1

2

3

4

5

6

7

8

$2

$5

$1

$2

$5

$1

$4

$2

Cost

s

$2

$2

$4

$4

$3

$6

$5

$1

Valu

e

$20$10

- Cost:

Revenue:

$10

Profit:

- 4

+6

$20

NP-Hard in General

Page 23: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Submodular Maximization

• NP-Hard in General

• Buchbinder et al. [FOCS’12] proposed the double-greedy randomized algorithm which is provably optimal.

Page 24: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

f( , X, Y ) =

Double Greedy Algorithm

Process keywords serially

Keywords QueriesA

B

C

D

E

F

1

2

3

4

5

6

Set X

Set YA

B

C

D

E

F

Add XRem.

Y

0 1

A

rand

A

Keywords to

purchase

Page 25: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

f( , X, Y ) =

Double Greedy Algorithm

Process keywords serially

Keywords QueriesA

B

C

D

E

F

1

2

3

4

5

6

Set X

Set YA

B

C

D

E

F

Add X Rem. Y

0 1

B

rand

A

Keywords to

purchase

Page 26: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

f( , X, Y ) =

Double Greedy Algorithm

Process keywords serially

Keywords QueriesA

B

C

D

E

F

1

2

3

4

5

6

Set X

Set YA

C

D

E

F

Add X Rem. Y

0 1

C

rand

A

C

Keywords to

purchase

Page 27: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Concurrency ControlDouble Greedy Algorithm

Process keywords in parallel

Keywords QueriesA

B

C

D

E

F

1

2

3

4

5

6

Set X

Set YA

C

D

E

F

B

Within each processor:

f( , Xbnd,Ybnd)=

Add XRem.

Y

0 1

A

Subset of true

X

Superset of true

Y

Uncertainty

Keywords to

purchase

Sets X and Y are sharedby all processors.

Page 28: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Concurrency ControlDouble Greedy Algorithm

Process keywords in parallel

Keywords QueriesA

B

C

D

E

F

1

2

3

4

5

6

Set X

Set YA

C

D

E

F

B

Within each processor:

f( , Xbnd,Ybnd)=

Add XRem.

Y

0 1

A

Subset of true

X

Superset of true

Y

Uncertainty

rand

A

Safe

rand

UnsafeMust Validate

Keywords to

purchase

Sets X and Y are sharedby all processors.

Page 29: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Concurrency ControlDouble Greedy Algorithm System

DesignImplemented in multicore (shared memory):

Model Server(Validator)

Set X

Set YA

C

D

E

F

A

Valid

atio

n Q

ueue

Published Bounds

(X,Y)

Bound

(X,Y)D

Trx. Add X

D

Bound

(X,Y)E

FailE

Thread 1

f( , Xbnd,Ybnd)=Add X

Rem. Y

0 1

D

Uncertainty

Thread 2

f( , Xbnd,Ybnd)=Add X Rem. Y

0 1

E

Uncertainty

Page 30: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Provable PropertiesTheorem: CC double greedy is serializable.

Corollary: CC double greedy preserves optimal approximation guarantee of ½OPT.

Lemma: CC has bounded overhead.

set cover with costs: 2τsparse max cut: 2cτ/n

Corr

ectn

es

sC

on

cu

rre

ncy

Page 31: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Provable Properties – coord free?

Theorem: CF double greedy is serializable.

Lemma: CF double greedy achieves approximation guarantee of ½OPT – ¼

Lemma: CC has bounded overhead.

set cover with costs: 2τsparse max cut: 2cτ/n

Corr

ectn

es

sC

on

cu

rre

ncy

depends on uncertainty regionsimilar order of CC overhead!

Page 32: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Provable Properties – coord free?

Theorem: CF double greedy is serializable.

Lemma: CF double greedy achieves approximation guarantee of ½OPT – ¼

CF: no coordination overhead.

Corr

ectn

es

sC

on

cu

rre

ncy

depends on uncertainty regionsimilar order of CC overhead!

Page 33: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Early Results

Page 34: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Runtime and Strong-Scaling

IT-2004: Italian Web-graph (41M Vertices, 1.1B Edges)UK-2005: UK Web-graph (39M, 921M Edges)

Arabic-2005: Arabic Web-graph (22M, 631M Edges)

Coordination Free

Concurrency Ctrl.

Page 35: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Coordination and Guarantees

IT-2004: Italian Web-graph (41M Vertices, 1.1B Edges)UK-2005: UK Web-graph (39M, 921M Edges)

Arabic-2005: Arabic Web-graph (22M, 631M Edges)

Increase in Coordination

Bad

Decrease in Objective

Page 36: Concurrency Control for Machine Learning Joseph E. Gonzalez Post-doc, UC Berkeley AMPLab jegonzal@eecs.berkeley.edu In Collaboration with Xinghao Pan,

Summary

• New primitives for robust parallel algorithm design– Exploit properties in ML algorithms

• Introduced parallel algorithms for: – DP-Means– Submodular Maximization

• Future Work: Integrate with Velox Model Server