SlideShare a Scribd company logo
Naveen Swamy
Distributed Deep Learning Inference
using Apache MXNet* and Apache Spark
Senior Software Engineer
Amazon AI
*
Outline
• Review of Deep Learning
• Apache MXNet Framework
• Distributed Inference using MXNet and Spark
Input layer
(Raw pixels)
Output
(object identity)
3rd hidden layer
(object parts)
2nd hidden layer
(corners & contours)
1st hidden layer
(edges)
• Originally inspired by our biological
neural systems.
• A System that learns important
features from experience.
• Layers of Neurons learning concepts.
• Deep learning != deep understanding
Deep Learning
Credit: Ian Goodfellow etal., Deep Learning Book
CAR PERSON DOG
Algorithmic Advances
(Faster Learning)
Abundance of Data
(Deeper Networks)
High Performance Compute
GPUs
(Faster Experiments)
Bigger and Better Models = Better AI Products
Why does Deep Learning matter?
Autonomous
Vehicles
Personal Assistants
Solve Intelligence ???
Health care
Deep Learning & AI, Limitations
Artificial Intelligence
DL Limitations:
• Requires lots of data and
compute power.
• Cannot detect Inherent bias in
data - Transparency.
• Uninterpretable Results.
Machine Learning
Deep
Learning
Deep Learning Training
forward
dog
dog
?
error
labels
data
backward
• Pass data through the network – forward pass
• Define an objective – Loss function
• Send the error back – backward pass
Model: Output of Training a neural network
X2 h2 w6 = 0.5
y = 1.0
y` = 0.9
loss = y
l = 0.1
y
X1 h1
w2 = 0.5
w1 = 0.5
w3 = 0.5
w5 = 0.4
w
4
=
0.5
0.1
0.1
backward pass
forward pass
Deep Learning Inference
• Real time Inference: Tasks that require immediate result.
• Batch Inference: Tasks where you need to run on a large data sets.
o Pre-computations are necessary - Recommender Systems.
o Backfilling with state-of-the art models.
o Testing new models on historic data.
model
forward
dog
Types of Learning
• Supervised Learning – Uses labeled training data learning to
associate input data to output.
Example: Image classification, Speech Recognition, Machine translation
• Unsupervised Learning - Learns patterns from Unlabeled data.
Example: Clustering, Association discovery.
• Active Learning – Semi-supervised, human in the middle..
• Reinforcement Learning – learn from environment, using rewards and
feedback.
Outline
• Apache MXNet Framework
• Distributed Inference using MXNet and Spark
Apache MXNet - Background
• Apache (incubating) open source project
• Framework for building and training
DNNs
• Created by academia (CMU and UW)
• Adopted by AWS as DNN framework of
choice, Nov 2016
http://mxnet.apache.org
Why MXNet
chik-fil-A waffle-fry freshness with Apache MXNet Computer Vision
Apache MXNet Customer Momentum
MXNet – NDArray & Symbol
• NDArray– Imperative Tensor Operations that work on both CPU and
GPUs.
• Symbol APIs – similar to NDArray but adopts declarative programming
for optimization.
Computation GraphSymbolic Program
MXNet - Module
High level APIs to work with Symbol
1) Create Graph
2) Bind
3) Pass data
Demo
Simple, Easy-to-
Understand Code
Flexible, Imperative
Structure
Dynamic Graphs
High Performance
§ Neural networks can be defined using simple, clear, concise code
§ Plug-and-play neural network building blocks – including predefined
layers, optimizers, and initializers
§ Eliminates rigidity of neural network model definition and brings
together the model with the training algorithm
§ Intuitive, easy-to-debug, familiar code
§ Neural networks can change in shape or size during the training process
to address advanced use cases where the size of data fed is variable
§ Important area of innovation in Natural Language Processing (NLP)
§ There is no sacrifice with respect to training speed
§ When it is time to move from prototyping to production, easily cache
neural networks for high performance and a reduced memory footprint
MXNet Gluon – Imperative & Fast
Credits: Cyrus Vahid
Outline
• Distributed Inference using MXNet and Spark
Distributed Inference
Challenges
• Similar to large scale data
processing systems
High Performance DL framework
Distributed Cluster
Resource Management
Job Management
Efficient Partition of Data
Deep Learning Setup
Apache Spark:
• Multiple Cluster Managers
• Works well with MXNet.
• Integrates with Hadoop & big data tools.
MXNet + Spark for Inference.
• ImageNet trained ResNet-18 classifier.
• For demo, CIFAR-10 test dataset with 10K Images.
• PySpark on Amazon EMR, MXNet is also available in Scala.
• Inference on CPUs, can be extended to use GPUs.
Distributed Inference Pipeline
download
S3 keys
on driver
create RDD
and
partition
fetch batch
of images
on executor
decode to
numpy array
run
prediction
collect
predictions
initialize model only once
mapPartitions
MXNet + Spark for Inference.
Onthedriver
Ontheexecutor
DeepLearning001&ApacheMXNetWithSparkForInference-ACNA2018
Summary
• Overview of Deep Learning
o How Deep Learning works and Why Deep Learning is a big deal.
o Phases of Deep Learning
o Types of Learning
• Apache MXNet – Efficient deep learning library
o NDArray/Symbol/Module
• Apache MXNet and Spark for distributed Inference.
What’s Next ?
• Released v1.3.0 with many new features and improvements –
Addition of Clojure support, User friendly APIs in Scala, Improved RNN support in Gluon, …
• Working on Java APIs for Inference.
• MXNet community is fast evolving, join hands to democratize
AI.
Resources/References
• https://github.com/apache/incubator-mxnet
• Blog- Distributed Inference using MXNet and Spark
• Distributed Inference code sample on GitHub
• Apache MXNet Gluon Tutorials
• Apache MXNet – Flexible and efficient deep learning.
• The Deep Learning Book
• MXNet – Using pre-trained models
• Amazon Elastic MapReduce
DeepLearning001&ApacheMXNetWithSparkForInference-ACNA2018
Thank You
wamy@amazon.com

More Related Content

PDF
Apache MXNet ODSC West 2018
PPTX
AI powered emotion recognition: From Inception to Production - Global AI Conf...
PPTX
MXNet Paris Workshop - Intro To MXNet
PDF
Apache MXNet EcoSystem - ACNA2018
PDF
Using Java to deploy Deep Learning models with MXNet
PPTX
AI powered emotion recognition: From Inception to Production - Global AI Conf...
PDF
Neural Networks, Spark MLlib, Deep Learning
PDF
Machine Learning Inference at the Edge
Apache MXNet ODSC West 2018
AI powered emotion recognition: From Inception to Production - Global AI Conf...
MXNet Paris Workshop - Intro To MXNet
Apache MXNet EcoSystem - ACNA2018
Using Java to deploy Deep Learning models with MXNet
AI powered emotion recognition: From Inception to Production - Global AI Conf...
Neural Networks, Spark MLlib, Deep Learning
Machine Learning Inference at the Edge

What's hot (19)

PPTX
Deep Learning in Java with Apache MXNet
PDF
AI 클라우드로 완전 정복하기 - 데이터 분석부터 딥러닝까지 (윤석찬, AWS테크에반젤리스트)
PPTX
Amazon Deep Learning
PDF
Deep Learning at the Edge
PDF
Introduction to Deep Learning with Will Constable
PPTX
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
PPTX
Distributed Model Training using MXNet with Horovod
PPTX
Georgia Tech cse6242 - Intro to Deep Learning and DL4J
PDF
아마존의 딥러닝 기술 활용 사례
PDF
Machine Learning on the Cloud with Apache MXNet
PPTX
Deep Learning: DL4J and DataVec
PPTX
Building Deep Learning Workflows with DL4J
PPTX
Emotion recognition in images: from idea to a model in production - Nordic DS...
PDF
Lessons Learned while Implementing a Sparse Logistic Regression Algorithm in ...
PPTX
Deep Learning Intro - Georgia Tech - CSE6242 - March 2015
PDF
Separating Hype from Reality in Deep Learning with Sameer Farooqui
PDF
Understanding computer vision with Deep Learning
PDF
아마존의 딥러닝 기술 활용 사례 - 윤석찬 (AWS 테크니컬 에반젤리스트)
PDF
Best Practices for Hyperparameter Tuning with MLflow
Deep Learning in Java with Apache MXNet
AI 클라우드로 완전 정복하기 - 데이터 분석부터 딥러닝까지 (윤석찬, AWS테크에반젤리스트)
Amazon Deep Learning
Deep Learning at the Edge
Introduction to Deep Learning with Will Constable
Tom Peters, Software Engineer, Ufora at MLconf ATL 2016
Distributed Model Training using MXNet with Horovod
Georgia Tech cse6242 - Intro to Deep Learning and DL4J
아마존의 딥러닝 기술 활용 사례
Machine Learning on the Cloud with Apache MXNet
Deep Learning: DL4J and DataVec
Building Deep Learning Workflows with DL4J
Emotion recognition in images: from idea to a model in production - Nordic DS...
Lessons Learned while Implementing a Sparse Logistic Regression Algorithm in ...
Deep Learning Intro - Georgia Tech - CSE6242 - March 2015
Separating Hype from Reality in Deep Learning with Sameer Farooqui
Understanding computer vision with Deep Learning
아마존의 딥러닝 기술 활용 사례 - 윤석찬 (AWS 테크니컬 에반젤리스트)
Best Practices for Hyperparameter Tuning with MLflow
Ad

Similar to DeepLearning001&ApacheMXNetWithSparkForInference-ACNA2018 (20)

PDF
Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
PDF
Distributed Inference with MXNet and Spark
PDF
Deep Dive into Apache MXNet on AWS
PDF
Scalable Deep Learning on AWS with Apache MXNet
PDF
Deep Learning for Developers (December 2017)
PPTX
Using MXNet to Train and Deploy your Deep Learning Model
PDF
Scalable Deep Learning on AWS using Apache MXNet (May 2017)
PPTX
Aran Khanna, Software Engineer, Amazon Web Services at MLconf ATL 2017
PPTX
Apache deep learning 101
PDF
Deep learning on HDP 2018 Prague
PDF
Apache Deep Learning 101 - DWS Berlin 2018
PDF
Apache MXNet AI
PDF
Deep Dive on Deep Learning (June 2018)
PDF
Deep Learning with Apache MXNet
PPTX
Deep Learning for Developers (expanded version, 12/2017)
PDF
Time series modeling workd AMLD 2018 Lausanne
PDF
Scalable Deep Learning on AWS using Apache MXNet (May 2017)
PPTX
Optimizing training on Apache MXNet (January 2018)
PDF
MCL 322 Optimizing Training on Apache MXNet
PDF
Machine Learning and Deep Learning with R
Distributed Inference on Large Datasets Using Apache MXNet and Apache Spark ...
Distributed Inference with MXNet and Spark
Deep Dive into Apache MXNet on AWS
Scalable Deep Learning on AWS with Apache MXNet
Deep Learning for Developers (December 2017)
Using MXNet to Train and Deploy your Deep Learning Model
Scalable Deep Learning on AWS using Apache MXNet (May 2017)
Aran Khanna, Software Engineer, Amazon Web Services at MLconf ATL 2017
Apache deep learning 101
Deep learning on HDP 2018 Prague
Apache Deep Learning 101 - DWS Berlin 2018
Apache MXNet AI
Deep Dive on Deep Learning (June 2018)
Deep Learning with Apache MXNet
Deep Learning for Developers (expanded version, 12/2017)
Time series modeling workd AMLD 2018 Lausanne
Scalable Deep Learning on AWS using Apache MXNet (May 2017)
Optimizing training on Apache MXNet (January 2018)
MCL 322 Optimizing Training on Apache MXNet
Machine Learning and Deep Learning with R
Ad

More from Apache MXNet (20)

PPTX
Recent Advances in Natural Language Processing
PPTX
Fine-tuning BERT for Question Answering
PPTX
Introduction to GluonNLP
PPTX
Introduction to object tracking with Deep Learning
PPTX
Introduction to GluonCV
PPTX
Introduction to Computer Vision
PPTX
Image Segmentation: Approaches and Challenges
PPTX
Introduction to Deep face detection and recognition
PPTX
Generative Adversarial Networks (GANs) using Apache MXNet
PPTX
Deep Learning With Apache MXNet On Video by Ben Taylor @ ziff.ai
PDF
ONNX and Edge Deployments
PDF
Multivariate Time Series
PDF
AI On the Edge: Model Compression
PDF
Building Content Recommendation Systems using MXNet Gluon
PDF
Game Playing RL Agent
PDF
Building Applications with Apache MXNet
PDF
Neural Machine Translation with Sockeye
PPTX
Debugging and Performance tricks for MXNet Gluon
PPTX
Visual Search Engine with MXNet Gluon
PDF
GluonNLP: A Deep Learning Toolkit for NLP Practitioners
Recent Advances in Natural Language Processing
Fine-tuning BERT for Question Answering
Introduction to GluonNLP
Introduction to object tracking with Deep Learning
Introduction to GluonCV
Introduction to Computer Vision
Image Segmentation: Approaches and Challenges
Introduction to Deep face detection and recognition
Generative Adversarial Networks (GANs) using Apache MXNet
Deep Learning With Apache MXNet On Video by Ben Taylor @ ziff.ai
ONNX and Edge Deployments
Multivariate Time Series
AI On the Edge: Model Compression
Building Content Recommendation Systems using MXNet Gluon
Game Playing RL Agent
Building Applications with Apache MXNet
Neural Machine Translation with Sockeye
Debugging and Performance tricks for MXNet Gluon
Visual Search Engine with MXNet Gluon
GluonNLP: A Deep Learning Toolkit for NLP Practitioners

Recently uploaded (20)

PPT
Reliability_Chapter_ presentation 1221.5784
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
Introduction to machine learning and Linear Models
PDF
Foundation of Data Science unit number two notes
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Computer network topology notes for revision
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPT
ISS -ESG Data flows What is ESG and HowHow
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
Reliability_Chapter_ presentation 1221.5784
Clinical guidelines as a resource for EBP(1).pdf
Introduction to machine learning and Linear Models
Foundation of Data Science unit number two notes
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
IB Computer Science - Internal Assessment.pptx
Computer network topology notes for revision
IBA_Chapter_11_Slides_Final_Accessible.pptx
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
ISS -ESG Data flows What is ESG and HowHow
Introduction-to-Cloud-ComputingFinal.pptx
Introduction to Knowledge Engineering Part 1
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
STUDY DESIGN details- Lt Col Maksud (21).pptx

DeepLearning001&ApacheMXNetWithSparkForInference-ACNA2018

  • 1. Naveen Swamy Distributed Deep Learning Inference using Apache MXNet* and Apache Spark Senior Software Engineer Amazon AI *
  • 2. Outline • Review of Deep Learning • Apache MXNet Framework • Distributed Inference using MXNet and Spark
  • 3. Input layer (Raw pixels) Output (object identity) 3rd hidden layer (object parts) 2nd hidden layer (corners & contours) 1st hidden layer (edges) • Originally inspired by our biological neural systems. • A System that learns important features from experience. • Layers of Neurons learning concepts. • Deep learning != deep understanding Deep Learning Credit: Ian Goodfellow etal., Deep Learning Book CAR PERSON DOG
  • 4. Algorithmic Advances (Faster Learning) Abundance of Data (Deeper Networks) High Performance Compute GPUs (Faster Experiments) Bigger and Better Models = Better AI Products
  • 5. Why does Deep Learning matter? Autonomous Vehicles Personal Assistants Solve Intelligence ??? Health care
  • 6. Deep Learning & AI, Limitations Artificial Intelligence DL Limitations: • Requires lots of data and compute power. • Cannot detect Inherent bias in data - Transparency. • Uninterpretable Results. Machine Learning Deep Learning
  • 7. Deep Learning Training forward dog dog ? error labels data backward • Pass data through the network – forward pass • Define an objective – Loss function • Send the error back – backward pass Model: Output of Training a neural network X2 h2 w6 = 0.5 y = 1.0 y` = 0.9 loss = y l = 0.1 y X1 h1 w2 = 0.5 w1 = 0.5 w3 = 0.5 w5 = 0.4 w 4 = 0.5 0.1 0.1 backward pass forward pass
  • 8. Deep Learning Inference • Real time Inference: Tasks that require immediate result. • Batch Inference: Tasks where you need to run on a large data sets. o Pre-computations are necessary - Recommender Systems. o Backfilling with state-of-the art models. o Testing new models on historic data. model forward dog
  • 9. Types of Learning • Supervised Learning – Uses labeled training data learning to associate input data to output. Example: Image classification, Speech Recognition, Machine translation • Unsupervised Learning - Learns patterns from Unlabeled data. Example: Clustering, Association discovery. • Active Learning – Semi-supervised, human in the middle.. • Reinforcement Learning – learn from environment, using rewards and feedback.
  • 10. Outline • Apache MXNet Framework • Distributed Inference using MXNet and Spark
  • 11. Apache MXNet - Background • Apache (incubating) open source project • Framework for building and training DNNs • Created by academia (CMU and UW) • Adopted by AWS as DNN framework of choice, Nov 2016 http://mxnet.apache.org
  • 13. chik-fil-A waffle-fry freshness with Apache MXNet Computer Vision
  • 15. MXNet – NDArray & Symbol • NDArray– Imperative Tensor Operations that work on both CPU and GPUs. • Symbol APIs – similar to NDArray but adopts declarative programming for optimization. Computation GraphSymbolic Program
  • 16. MXNet - Module High level APIs to work with Symbol 1) Create Graph 2) Bind 3) Pass data
  • 17. Demo
  • 18. Simple, Easy-to- Understand Code Flexible, Imperative Structure Dynamic Graphs High Performance § Neural networks can be defined using simple, clear, concise code § Plug-and-play neural network building blocks – including predefined layers, optimizers, and initializers § Eliminates rigidity of neural network model definition and brings together the model with the training algorithm § Intuitive, easy-to-debug, familiar code § Neural networks can change in shape or size during the training process to address advanced use cases where the size of data fed is variable § Important area of innovation in Natural Language Processing (NLP) § There is no sacrifice with respect to training speed § When it is time to move from prototyping to production, easily cache neural networks for high performance and a reduced memory footprint MXNet Gluon – Imperative & Fast Credits: Cyrus Vahid
  • 19. Outline • Distributed Inference using MXNet and Spark
  • 20. Distributed Inference Challenges • Similar to large scale data processing systems High Performance DL framework Distributed Cluster Resource Management Job Management Efficient Partition of Data Deep Learning Setup Apache Spark: • Multiple Cluster Managers • Works well with MXNet. • Integrates with Hadoop & big data tools.
  • 21. MXNet + Spark for Inference. • ImageNet trained ResNet-18 classifier. • For demo, CIFAR-10 test dataset with 10K Images. • PySpark on Amazon EMR, MXNet is also available in Scala. • Inference on CPUs, can be extended to use GPUs.
  • 22. Distributed Inference Pipeline download S3 keys on driver create RDD and partition fetch batch of images on executor decode to numpy array run prediction collect predictions initialize model only once mapPartitions
  • 23. MXNet + Spark for Inference. Onthedriver
  • 26. Summary • Overview of Deep Learning o How Deep Learning works and Why Deep Learning is a big deal. o Phases of Deep Learning o Types of Learning • Apache MXNet – Efficient deep learning library o NDArray/Symbol/Module • Apache MXNet and Spark for distributed Inference.
  • 27. What’s Next ? • Released v1.3.0 with many new features and improvements – Addition of Clojure support, User friendly APIs in Scala, Improved RNN support in Gluon, … • Working on Java APIs for Inference. • MXNet community is fast evolving, join hands to democratize AI.
  • 28. Resources/References • https://github.com/apache/incubator-mxnet • Blog- Distributed Inference using MXNet and Spark • Distributed Inference code sample on GitHub • Apache MXNet Gluon Tutorials • Apache MXNet – Flexible and efficient deep learning. • The Deep Learning Book • MXNet – Using pre-trained models • Amazon Elastic MapReduce