Spark AI Summit Europe 2019 talk: Asynchronous Hyperparameter Search with Spark on Hopsworks and Maggy. How can you do directed search efficiently with Spark? The answer is Maggy - asynchronous directed search on PySpark.
2. Jim Dowling, Logical Clocks AB and KTH
Moritz Meister, Logical Clocks AB
Asynchronous Hyperparameter
Optimization with Apache Spark
#UnifiedDataAnalytics #SparkAISummit
@jim_dowling
@morimeister
3. The Bitter Lesson (of AI)*
“Methods that scale with computation
are the future of AI”**
3
** https://www.youtube.com/watch?v=EeMCEQa85tw
Rich Sutton
(Father of Reinforcement Learning)
* http://www.incompleteideas.net/IncIdeas/BitterLesson.html
“The two (general purpose) methods that seem to scale
... are search and learning.”*
4. Spark scales with
available compute
=>
Spark is the answer!
This talk is about why bulk-
synchronous parallel compute
(Spark) does not scale efficiently
for search and how we made
Spark efficient for directed
search (task-based
asynchronous parallel compute).
4
5. Inner and Outer Loop of Deep Learning
Inner Loop
Outer Loop
Training Data
worker1 worker2 workerN
…
∆
1
∆
2
∆
N
Synchronization
Metric
Search
Method
HParams
http://tiny.cc/51yjdz
6. Inner and Outer Loop of Deep Learning
Inner Loop
Outer Loop
Training Data
worker1 worker2 workerN
…
∆
1
∆
2
∆
N
Synchronization
Metric
Search
Method
HParams
http://tiny.cc/51yjdz
LEARNINGSEARCH
8. Hopsworks Technical Milestones
8
World’s first Hadoop
platform to support
GPUs-as-a-Resource
World’s fastest
HDFS Published at
USENIX FAST with
Oracle and Spotify
World’s First
Open Source Feature
Store for Machine
Learning
World’s First
Distributed Filesystem to
store small files in
metadata on NVMe disks
Winner of IEEE
Scale Challenge
2017
with HopsFS - 1.2m
ops/sec
2017
World’s most scalable
POSIX-like Hierarchical
Filesystem with
Multi Data Center Availability
with 1.6m ops/sec on GCP
2018 2019
First non-Google ML
Platform with
TensorFlow Extended
(TFX) support through
Beam/Flink
World’s first
Unified
Hyperparam and
Ablation Study
Framework
9. The Complexity of Deep
Learning
9
Data validation
Distributed
Training
Model
Serving
A/B
Testing
Monitoring
Pipeline
Management
HyperParameter
Tuning
Feature Engineering
Data
Collection
Hardware
Management
Data Model Prediction
φ(x)
Hopsworks
Feature Store
Hopsworks
REST API
[Adapted from Schulley et al “Technical Debt of ML” ]
16. Hopsworks Engine: ML Pipelines
17
Data
Pipelines
Ingest & Prep
Feature
Store
Machine Learning Experiments
Data Parallel
Training
Model
Serving
Ablation
Studies
Hyperparameter
Optimization
Bottleneck, due to
• iterative nature
• human interaction
Horizontal Scalability at all Stages
17. Iterative Model Development
• Trial and Error is slow
• Iterative approach is greedy
• Search spaces are usually large
• Sensitivity and interaction of
hyperparameters
18
Set Hyper-
parameters
Train Model
Evaluate
Performance
19. Parallel Black Box Optimization
20
Which algorithm to use for search? How to monitor progress?
Fault Tolerance?How to aggregate results?
Learning
Black Box
Metric
Meta-level
learning &
optimization Parallel
WorkersQueue
Trial
Trial
Search space
This should be managed with platform support!
20. Maggy
A flexible framework for
running different black-box
optimization algorithms
on Hopsworks:
ASHA, Bayesian
Optimization, Random
Search, Grid Search and
more to come…
21
24. 25
Synchronous Successive Halving
Kevin G. Jamieson et al. “Non-stochastic Best Arm Identification and Hyperparameter Optimization” (2015).
Animation: https://blog.ml.cmu.edu/2018/12/12/massively-parallel-hyperparameter-optimization/
25. 26
Asynchronous Successive Halving
Liam Li et al. “Massively Parallel Hyperparameter Tuning” (2018).
Animation: https://blog.ml.cmu.edu/2018/12/12/massively-parallel-hyperparameter-optimization/
26. Challenge
How can we fit this into the bulk synchronous execution model of Spark?
Mismatch: Spark Tasks and Stages vs. Trials
27
Databricks’ approach: Project Hydrogen (barrier execution mode) & SparkTrials in Hyperopt
32. Ablation
34
PClassname survivesex sexname survive
Replacing the Maggy Optimizer with
an Ablator:
• Feature Ablation using
the Feature Store
• Leave-One-Layer-Out Ablation
• Leave-One-Component-Out
(LOCO)
35. Conclusion
● Avoid iterative Hyperparameter Optimization
● Black box optimization is hard
● State-of-the-art algorithms can be deployed asynchronously
● Maggy: platform support for automated hyperparameter
optimization and ablation studies
● Save resources with asynchronism
● Early stopping for sensible models
37
36. What next?
38
• More algorithms
• Comparability of experiments
• Implicit Provenance
• Support for PyTorch
37. Thank you!
Box 1263, Isafjordsgatan 22
Kista, Stockholm
https://www.logicalclocks.com
Register for a free account at
www.hops.site
Twitter
@logicalclocks
@hopsworks
GitHub
https://github.com/hopshadoop/maggy
https://maggy.readthedocs.io/en/latest/
https://github.com/logicalclocks/hopsworks
38. Acknowledgements and References
Thanks to the entire Logical Clocks Team ☺
Contributions from colleagues:
Robin Andersson @robzor92
Sina Sheikholeslami @cutlash
Kim Hammar @KimHammar1
Alex Ormenisan @alex_ormenisan
• Maggy
https://github.com/logicalclocks/maggy or https://maggy.readthedocs.io/en/latest/
• Feature Store: the missing data layer in ML pipelines?
https://www.logicalclocks.com/feature-store/
• Hopsworks white paper.
https://www.logicalclocks.com/whitepapers/hopsworks
• ePipe: Near Real-Time Polyglot Persistence of HopsFS Metadata, CCGrid, 2019
39. DON’T FORGET TO RATE
AND REVIEW THE SESSIONS
SEARCH SPARK + AI SUMMIT