Deep learning on a mixed cluster with deeplearning4j and spark

34
Deep learning on a mixed cluster with Deeplearning4j and Spark Barcelona Spark meetup, Dec 9, 2016 (right after NIPS) [email protected] @huitseeker

Transcript of Deep learning on a mixed cluster with deeplearning4j and spark

Page 1: Deep learning on a mixed cluster with deeplearning4j and spark

Deep learning on a mixedcluster with Deeplearning4j

and SparkBarcelona Spark meetup, Dec 9, 2016

(right after NIPS)[email protected] @huitseeker

Page 2: Deep learning on a mixed cluster with deeplearning4j and spark

AgendaIntro

Why Deep Learning on aCluster

Big Data Architecture

Deeplearning4j

Spark challenges

Page 3: Deep learning on a mixed cluster with deeplearning4j and spark

Introduction : Deep Learningin the trenches today

Page 4: Deep learning on a mixed cluster with deeplearning4j and spark

The bad thing about doing atalk right after NIPS

you guys are scary.

Page 5: Deep learning on a mixed cluster with deeplearning4j and spark

The good thing about doing atalk right after NIPS

You guys don't need to be told SkyNet is a fantasy (for now).

Page 6: Deep learning on a mixed cluster with deeplearning4j and spark

Paying algorithmsAnomaly detection in many forms (bad guys / predictivemaintenance / market rally)

Fraud detection

Network intrusion

Fintech secutiries churn prediction

Video object detection (security)

Page 7: Deep learning on a mixed cluster with deeplearning4j and spark

Models that are beingneglected in benchmarks and

implementation efforts

LSTMs

Autoencoders

Page 8: Deep learning on a mixed cluster with deeplearning4j and spark

How to deal with this in theSpark world ?

experiment with trained model application: Tensorframes,

what are the deep learning frameworks that let you train?

Page 9: Deep learning on a mixed cluster with deeplearning4j and spark

Why Deep Learning on acluster ?

Page 10: Deep learning on a mixed cluster with deeplearning4j and spark

Practically ... let's look at benchmarks

Page 11: Deep learning on a mixed cluster with deeplearning4j and spark

Practically ... let's look at benchmarks

Page 12: Deep learning on a mixed cluster with deeplearning4j and spark

Practically ... let's look at benchmarks

Page 13: Deep learning on a mixed cluster with deeplearning4j and spark

Practically ... let's look at benchmarks

Page 14: Deep learning on a mixed cluster with deeplearning4j and spark

Training, but how ?

New Amazon GPU instances

Page 15: Deep learning on a mixed cluster with deeplearning4j and spark

Training, but how ?

Page 16: Deep learning on a mixed cluster with deeplearning4j and spark

Training, but how ?

Page 17: Deep learning on a mixed cluster with deeplearning4j and spark

Cluster training in theenterprise

it's really about multi-tenancy & economies of scale

a big bunch of machines shared among everybody sharesbetter

if only because you can reuse it for other workloads

Minor reasons

enterprises may not haveGPUs

Page 18: Deep learning on a mixed cluster with deeplearning4j and spark

Distributing training

basically distributing SGD (R)

challenge is AllReduce Communication

Sparse updates, asynccommunications

Page 19: Deep learning on a mixed cluster with deeplearning4j and spark

Distributing training : goodengineering matters

Page 20: Deep learning on a mixed cluster with deeplearning4j and spark

Cluster training in your(experimentor) case ?

it's a fun problem : AllReduce

Ultimately solved for people with a large amount of images

that solution is not open-source (but at Facebook, Google,Amazon, Microsoft¹, Baidu)

¹: 1-bit SGD is under non-commercial license in CNTK 2.0

Page 21: Deep learning on a mixed cluster with deeplearning4j and spark

Big Data architecture

Page 22: Deep learning on a mixed cluster with deeplearning4j and spark

With a parameter server

Page 23: Deep learning on a mixed cluster with deeplearning4j and spark

With SparkSpark does the initial ETL

Spark ingests the �nal result

In the middle : parameterserver.

Page 24: Deep learning on a mixed cluster with deeplearning4j and spark

Spark cluster modesMesos GPU support merged

devices cgroups !

YARN GPU support throughtags

Spark Standalone : ?

Page 25: Deep learning on a mixed cluster with deeplearning4j and spark

Deeplearning4j

Page 26: Deep learning on a mixed cluster with deeplearning4j and spark

Deeplearning4jthe �rst commercial-grade, open-source, distributed deep-learning library written for Java and Scala

Skymind its commercial support arm

Page 27: Deep learning on a mixed cluster with deeplearning4j and spark

Scienti�c computing on the JVMlibnd4j : Vectorization, 32-bit addressing, linalg (BLAS!)

JavaCPP: generates JNI bindings to your CPP libs

ND4J : numpy for the JVM, native superfast arrays

Datavec : one-stop interface to an NDArray

DeepLearning4J: orchestration, backprop, layer de�nition

ScalNet: gateway drug, inspired from (and closely following)Keras

RL4J : Reinforcement learning for the JVM

Page 28: Deep learning on a mixed cluster with deeplearning4j and spark

With SparkJavaSparkContent sc = ...; JavaRDD<DataSet> trainingData = ...; MultiLayerConfiguration networkConfig = ...; //Create the TrainingMaster instance int examplesPerDataSetObject = 1; TrainingMaster trainingMaster = new ParameterAveragingTrainingMaster.Builder(examplesPerDataSetObject) .(other configuration options) .build(); //Create the SparkDl4jMultiLayer instance SparkDl4jMultiLayer sparkNetwork = new SparkDl4jMultiLayer(sc, networkConfig, trainingMaster); //Fit the network using the training data: sparkNetwork.fit(trainingData);

Page 29: Deep learning on a mixed cluster with deeplearning4j and spark

Spark Challenges

Page 30: Deep learning on a mixed cluster with deeplearning4j and spark

Even if you don't care about Deeplearning

(from Kazuaki Ishizaki @ IBM Japan)

SPARK-6442 : better linear algebra thanbreeze

ND4J will have sparse representations soon

Page 31: Deep learning on a mixed cluster with deeplearning4j and spark

Even if you don't care about Deeplearning II

Meta-RDDs

Page 32: Deep learning on a mixed cluster with deeplearning4j and spark

Killing the bottlenecksSpark has already changed its networking backend once.

better support for parameters servers and their faulttolerance.

Page 33: Deep learning on a mixed cluster with deeplearning4j and spark

A Last Word (from Andrew Y. Ng)get involved !

don't just read papers, reproduce researchresults

AlsoWe're happy to mentor contributions, and there's a book !

Page 34: Deep learning on a mixed cluster with deeplearning4j and spark

Questions ?