What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon...

36
What Every Technologist Should Know About AI and Deep Learning Alex McDonald Standards & Industry Associations, NetApp Inc.

Transcript of What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon...

Page 1: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

What Every Technologist Should Know About AI and Deep Learning

Alex McDonald

Standards & Industry Associations, NetApp Inc.

Page 2: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

The information is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied, on future functionality and timeline. The development, release, and timing of any features or functionality described for NetApp’s products remains at the sole discretion of NetApp. NetApp's strategy and possible future developments, products and or platforms directions and functionality are all subject to change without notice. NetApp has no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein.

2

Page 3: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Why is AI & Deep Learning Important?

§ AI and Deep Learning is disrupting every industry

§ For decades, AI was all about improving algorithms

§ Now the focus is on putting AI to practical use § Critical to leverage well-engineered systems

§ This talk will§ Take you on a broad coherent tour of Deep Learning systems§ Help you appreciate the role well-engineered systems play in AI disruption§ Take you a step closer to being a unicorn

§ Systems + AI - something highly desirable, difficult to obtain

NetApp INSIGHT © 2019 NetApp, Inc. All rights reserved. NetApp Confidential – Limited Use Only3

Page 4: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Agenda

§ AI Primer

§ AI Stacks Overview

§ Deep Learning Process§ Training§ Inference

§ Deep Learning Systems§ Hardware§ Software

§ Datasets and Data flow

§ Future of Systems

4

Page 5: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

BackgroundAI or ML or DL

ML – program that learns with experience (i.e., data)

DL – ML using >1 hidden layers of neural network

AI – program that imitates human intelligence

NetApp INSIGHT © 2019 NetApp, Inc. All rights reserved. NetApp Confidential – Limited Use Only5

Page 6: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning 101

§ Neuron: computational unit

§ DL Model == type & structureMore layers => better capture the features in dataset, better performance at task (normally)Parameters/Weights

Basic concepts and terminology

6

Layer

Neuron Parameter/Weights

Page 7: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning 101

§ Neuron: computational unit

§ DL Model == type & structureMore layers => better capture the features in dataset, better performance at task (normally)Parameters/Weights

§ Training: build a model from datasetEpoch: a pass over entire datasetBatch: a chunk of dataPreprocessing/preparation: ready data to train

Basic concepts and terminology

7

Back propagation

Repeat

Forward propagation

“mountain”

data

Page 8: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning 101

§ Neuron: computational unit

§ DL Model == type & structureMore layers => better capture the features in dataset, better performance at task (normally)Parameters/Weights

§ Training: build a model from datasetEpoch: a pass over entire datasetBatch size: a chunk of dataPreprocessing/preparation: ready data to train

§ Inference: using a trained model

Basic concepts and terminology

8

Forward propagation

“mountain”

New data

Page 9: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning 101

§ State-of-the-Art DL is large scale 100s of layersMillions of parameters100s of GBs to TBs of dataHours/days to train

Basic concepts and terminology

9

Forward propagation

“mountain”

data

Page 10: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

AI Stack OverviewAI Stack LayersAI PaaS, End-to-end solutions

10

Page 11: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

AI Stack

GPUs, TPUs, FPGAs

§ Optimized hardware to provide tremendous speed-up for training, sometimes inference

§ More easily available on cloud for rent

Layers

Modern Compute11

Page 12: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

AI Stack

Tensorflow, PyTorch, Caffe2, MxNet, CNTK, Keras, Gluon

§ Library that implements algorithms, provides execution engine and programming APIs

§ Used to train and build sophisticated models, and to do predictions based on the trained model for new data

Layers

Software

Modern Compute12

Page 13: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

AI Stack Layers

Platform

Laptop, Cloud compute instances, H2O Deep Water, Spark DL pipelines

§ Hardware accelerated platforms, supporting common software frameworks, to run the training and/or inference of deep neural networks

§ Typically optimized for a preferred software framework

§ Can be hosted on-prem or cloud

§ Also offered as fully-managed service (PaaS) by cloud vendors like Amazon SageMaker, Google Cloud ML, Azure ML

Software

Modern Compute13

Page 14: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

AI Stack

Amazon Rekognition, Lex & Polly; Google Cloud API; Microsoft Cognitive Services;

§ Allows query based service access to generalizable state of art AI models for common tasks § Ex: send an image and get object tags as result, send mp3

and get converted text as result and so on

§ No dataset, no training of model required by user

§ Per-call cost model

§ Integrated with cloud storage and/or bundled into end-to-end solutions and AI consultancy offerings like IBM Services Watson AI, ML & Cognitive consulting, Amazon's ML Solutions Lab, Google's Advanced Solutions Lab

Layers

API-based service

Platform

Software

Modern Compute14

Page 15: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning ProcessTrainingInference

Page 16: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

DL Process and Data LifecycleDL lifecycle is very unlike traditional systems software development

Gather Data

Data Analysis, Transformation,

Validation

Model TrainingModel Evaluation, Validation, Tuning

Model Serving, Monitoring

§ Gathering and curating quality datasets and making them accessible across org

§ Diverse tools and flexible infrastructure needed

§ Evaluation criteria is critical but hard § Comparing algorithms is not straightforward

§ Tracking artifacts like dataset transformations, tuning history, model versions, validation results more important than code

§ Debugging, interpretability and fairness is limited

§ Tension/friction: Data security and privacy; IT

NetApp INSIGHT © 2019 NetApp, Inc. All rights reserved. NetApp Confidential – Limited Use Only16

Page 17: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning TrainingTraining: build a model from a dataset

§ Is memory and compute bound§ Big datasets, complex math operations

§ Is highly parallelized/distributed – across cores, across machines§ Partition data, or model, or both§ Scale Up before Scale Out§ Communication to computation ratio§ Speed vs Accuracy tradeoff§ Federated learning

§ Leans on enhancements to data quality§ Augmentation, randomness§ Transformations§ Efficiently fit in memory

Forward propagation

Back propagation

Repeat

“mountain”

17

Page 18: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning TrainingTraining: build a model from a dataset

§ Supervision - rely on labeled data§ Transfer learning: a pre-trained model, train few layers§ Learning label

§ Involves a lot of hyperparameter tuning§ Example: #layers, #neurons, batch size …§ Multi-model training on same data set§ Trial and error search - easier to automate

§ Rise of AutoML§ Learn how to model given data – no modeling/tuning

expertise required§ Example: AmoebaNet beat ResNet Image

Classification

Forward propagation

Back propagation

Repeat

“mountain”

18

Page 19: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning InferenceInference*: use a trained model on new data

§ Is computationally simpler § single forward pass

§ Typically a containerized RPC/Web server § with pre-installed DL software + NN model

§ Multiple inputs are batched for better throughput§ But much smaller than training batch§ Low latency

* aka Model Serving, Deployment, Prediction

Forward propagation

“mountain”

19

Page 20: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning InferenceInference*: use a trained model on new data

§ DL models can be huge § may need hardware acceleration

§ On-device/Edge inference is gaining traction § Reason: latency & privacy § special model optimizations – pruning§ hardware on-device

§ Portability and interoperability of model is important § Train any way, deploy anywhere§ Example: ONNX is a step towards standardizing

* aka Model Serving, Deployment, Prediction

Forward propagation

“mountain”

20

Page 21: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Deep Learning SystemsHardware AccelerationSoftware Frameworks

Page 22: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

§ CPUs are still used for ML training

§ CPUs are common for inference § including certain DL inference

§ Struggle to handle DL training

§ Data preprocessing are suited for CPUs

§ Hybrid hardware of CPUs with other accelerators is common

Role of CPU in AI

22

Accelerators like GPU

GPU/

Image source: https://www.oreilly.com. Courtesy Daniel Whitenack.

Page 23: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

§ De facto hardware for AI training § Also for large scale inference

§ GPU vs CPU : many more cores, parallelization

§ Modern GPU architectures used for AI§ High speed interconnect between CPU/GPUs

(NVLink)§ Bypass CPU for communication (GPUDirect)§ Efficient message passing (Collective-All-Reduce)

§ Available in cloud (EC2 P* instances) and on-premise (DGX)

Hardware Acceleration for DLGPU (Graphic Processing Unit)

23

Without GPUDirect With GPUDirect

Image source: https://www.nvidia.com

Page 24: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

§ ASIC designed to speed up DL operations, like Google’s TPU (Tensor Processing Unit)§ High performance§ Less flexible§ Economical only at large scale

§ Special optimizations in hardware§ For example: reduced precision, matmul operator

§ Design for inference is different from that for training§ For example: in 1st generation TPUs fp-units were

replaced by int8-units

Hardware Acceleration for DLASIC (Application Specific Integrated Circuit)

Image source: http://learningsys.org/nips17/assets/slides/dean-nips17.pdf

24

Page 25: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Hardware Acceleration for DL

§ Designed to be reconfigurable§ Flexibility to change as neural networks and new algorithms evolve

§ Offer much higher Performance/Watt than GPUs

§ Cost effective and excel at inference

§ Reprogramming an FPGA is not easy § Low level language

§ Available on cloud (EC2 F1 instances)

FPGA (Field Programmable Gated Arrays)

25

Page 26: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

§ Primarily limited to inference-only

§ Special SoC design with reduced die space

§ Energy efficiency and memory efficiency is more critical

§ Special optimization to support specific tasks-only§ For example: speech-only, vision-only

§ Examples: Apple’s Neural Engine, Huawei’s NPU

Hardware Acceleration for On-device AI

26

Page 27: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Software Frameworks

Frontend- Abstracts the mathematical and algorithm implementation details of Neural Networks- Provides a high level building blocks API to define neural network models over multiple backends- A high level language library

Backend- Hides hardware-specific programming APIs from user - Optimizes and parallelizes the training and inference process to work efficiently on the hardware- Makes it easier to preprocess and prepare data for training- Supports multi-GPU, multi-node execution

27

Page 28: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Dataset & Data FlowUsing Tensorflow as reference

Page 29: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Dataset Transformation – ImageNet Example

§ Raw data is converted into packed binary format for training called TFRecord (One time step)§ 1.2 M image files are converted into 1024 TFRecords with each TFRecord 100s of MB in size

Rawdata vs TFRecords

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

1 6 24 76 128

180

232

284

336

388

440

492

544

596

648

700

752

804

856

908

960

1,01

25,

120

FREQ

UEN

CY

SIZE (IN KB)

0

20

40

60

80

100

120

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

156

158

161

FREQ

UEN

CY

SIZE (IN MB)

29

Raw ImageNet Data TFRecord ImageNet Data

Page 30: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

TensorFlow Data Pipeline

1. IO: Read data from persistent storage

2. Prepare: Use CPU cores to parse and preprocess data§ Preprocessing includes Shuffling, data

transformations, batching etc.

3. Train: Load the transformed data onto the accelerator devices (GPUs, TPUs) and execute the DL model

Read IO Prepare Train

Storage

Network CPU/RAM

GPU

PCIe/NVLink GPU

PCIe/NVLink

TFRecords

Host

30

Page 31: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

§ Without pipelining

Compute Pipelining

§ With Pipelining (using prefetch API)

31

Image source: https://www.tensorflow.org/guide/

Page 32: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Parallelize IO and Prepare Phase

§ Parallelize prepare§ Parallelize IO

NetApp INSIGHT © 2019 NetApp, Inc. All rights reserved. NetApp Confidential – Limited Use Only32

Image source: https://www.tensorflow.org/guide/

Page 33: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Future of SystemsAI for systems

Page 34: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Future of Systems

§ Detect, predict, alert -- assist the experts

§ Simplify deployment and operational complexity of software§ Scheduling§ Resource management§ Configuration tuning

§ Automatically adapt design tradeoffs within software § Replace heuristics – e.g. read/write ratios§ Replace data structures – e.g. index lookup

AI Applied to Systems

34 NetApp INSIGHT © 2019 NetApp, Inc. All rights reserved. NetApp Confidential – Limited Use Only

Page 35: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Key Takeaways

§ Current state of Deep Learning systems

§ Critical role well-engineered systems & solutions play to make AI practical

§ Impact on future of systems: applied AI in systems software design

35 NetApp INSIGHT © 2019 NetApp, Inc. All rights reserved. NetApp Confidential – Limited Use Only

Page 36: What Every Technologist Should Know About AI and Deep Learning - Alex McDonald... · be relied upon in making purchasing decisions. NetApp makes no warranties, expressed or implied,

Research Directions in AISystems related

Academic:§ Using DL to replace heuristics-based

decision within systems software, or even data structures

§ Systems and platforms for DL§ Practical engineering optimizations to

improve DL process/lifecycle/performance§ Workload and benchmarking§ Other areas like security, privacy, power etc.

Industry:§ Google Brain: hardware, AutoML§ FAIR: vision, video, AR§ Apple: speech & vision on-device

36