1
Continuous
Intelligence
Keeping your AI Application
in Production
Arif Wider
Emily Gorcenski
NDC Porto, April 23-24, 2020
7000+ technologists with 43 offices in 14 countries
Partner for technology driven business transformation
Barcelona - Madrid - London - Manchester - Berlin - Hamburg - Munich - Cologne
#1
in Agile and
Continuous Delivery
100+
books written
©ThoughtWorks 2020
©ThoughtWorks 2020
TECHNIQUES
Continuous delivery
for machine
learning (CD4ML)
models
#8
TRIAL
8
©ThoughtWorks 2020
TECHNIQUES
Continuous delivery
for machine
learning (CD4ML)
models
#8
TRIAL
8
©ThoughtWorks 2020
7
WHERE
IT ALL
STARTED
©ThoughtWorks 2020
8
Data Scientists
Developers
9
Data Scientists
Developers
prediction
model
Feedback,
requests
10
Data Scientists
Developers
prediction
model
Feedback,
requests
SOUNDS LIKE DEV/OPS?
11
Data Scientists
Developers
12
LET’S DO
CONTINUOUS
DELIVERY!
CONTINUOUS DELIVERY PIPELINES
13
Prediction Model Pipeline
Web Application Pipeline
NEW CHALLENGES
14
NEW CHALLENGES
15
→ How to version control training data?
→ Training data and prediction models don’t fit into Git :-(
→ Model re-training slows down the entire continuous delivery server!
→ Data scientists want to evaluate several solutions at the same time...
→ ...and they use analytics notebooks which are hard to version control!
→ How to unit test data science code that is tied to changing data?
→ How to prevent behaviour changes of the model to break the application?
WHAT ARE THE REASONS?
16
Continuous Delivery is the ability to get
changes of all types — including new features,
configuration changes, bug fixes and
experiments — into production, or into the
hands of users, safely and quickly in a
sustainable way.
Jez Humble & Dave Farley
MANY SOURCES OF CHANGE
18
ModelData Code
+ +
Schema
Sampling over Time
Volume
...
Research, Experiments
Training on New Data
Performance
...
New Features
Bug Fixes
Dependencies
...
Icons created by Noura Mbarki and I Putu Kharismayadi from Noun Project
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
19
Code is a broad concept. It can refer to
the source code of our services and
systems. It can represent our
infrastructure. It can refer to the code
used to access, transform, or prepare
data. It can refer to the code used to
train, validate, and assess models.
Code
HOW DOES CODE
CHANGE VERSION?
Bug fixes
New features
Dependencies
Operating systems
Scope change
Etc.
This axis is the best-understood axis of
version change for machine learning
systems.
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
20
Model
Model here refers to both the modeling
approach (e.g. random forest
classification) and the actual artifact
produced (e.g. a pkl file). A model is a
product of hyperparameters (not varied
during training) and parameters
(computed during training).
HOW DOES A MODEL
CHANGE VERSION?
Research — trying new approaches
Dependencies
New data
Performance improvements
Etc.
This axis is not as well-understood and
machine learning, as a field, is changing so
rapidly that many models can be expected
to be obsolete in short order.
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
21
Data
DATA IS MORE COMPLICATED
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
22
Data
DATA IS MORE COMPLICATED
Random Sample by Becris from the Noun Project, Puzzle by
shashank singh from the Noun Project
Sampling Schema
Data is an assessment of the state of the universe at a point in time. It has a measurement and a shape.
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
23
Sampling
Sampling refers to the values in the data
themselves. We can’t measure everything,
but what we do measure is a sample of
the universe. These values have
properties like support, distribution,
cardinality, etc.
HOW DOES SAMPLING
CHANGE VERSION?
Time—it marches ever on
Extrinsic changes in the universe
Inserts, Deletions, Updates
Etc.
It is very difficult to specify or detect shifts
in “versions” here except by example. We
often think of this as moving forward with
time, but that versions are not necessarily
time-dependent.
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
24
Schema
Schema refers to the shape of our data.
This can be a database schema, e.g. a
table/column/constraint definition, or it
could just refer to shape of the incoming
data (e.g. JSON fields, XML schema, etc).
HOW DOES SCHEMA
CHANGE VERSION?
Software updates
Requirements changes
Migrations
Etc.
It is very difficult to specify or detect shifts
in “versions” here except by example. We
often think of this as moving forward with
time, but that versions are not necessarily
time-dependent.
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
25
ML SYSTEMS HAVE FOUR “VERSION AXES”
Any data-driven service can experience version drift along any of these axes independently or jointly.
Schema
Sampling
Model
Code
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
DIFFERENT WORKFLOWS
26
master
DEVELOPERS
DIFFERENT WORKFLOWS
27
master
change-max-depth
try-random-forest
©ThoughtWorks 2020
DATA SCIENTISTS
MORE TYPES OF PIPELINES
DATA PIPELINE
ML PIPELINE DEPLOYMENT
PIPELINE
PUTTING EVERYTHING TOGETHER
29
Data Science,
Model
Building
Training Data
Source Code
+
Executables
Model
Evaluation
Productionize
Model
Integration
Testing
Deployment
Test Data
Model +
parameters
CD Tools and Repositories
DiscoverableandAccessibleData
Monitoring
©ThoughtWorks 2020
Production Data
WHAT DO WE NEED IN OUR STACK?
30
Doing CD with Machine Learning is still a hard problem
MODEL
PERFORMANCE
ASSESSMENT
VERSION
CONTROL AND
ARTIFACT
REPOSITORIES
©ThoughtWorks 2020
MONITORING
AND
OBSERVABILITY
DISCOVERABLE
AND
ACCESSIBLE
DATA
CONTINUOUS
DELIVERY
ORCHESTRATION
TO COMBINE
PIPELINES
INFRASTRUCTURE
FOR MULTIPLE
ENVIRONMENTS
AND
EXPERIMENTS
WHAT DO WE NEED IN OUR STACK?
31
Doing CD with Machine Learning is still a hard problem
MODEL
PERFORMANCE
ASSESSMENT
VERSION
CONTROL AND
ARTIFACT
REPOSITORIES
©ThoughtWorks 2020
MONITORING
AND
OBSERVABILITY
DISCOVERABLE
AND
ACCESSIBLE
DATA
CONTINUOUS
DELIVERY
ORCHESTRATION
TO COMBINE
PIPELINES
INFRASTRUCTURE
FOR MULTIPLE
ENVIRONMENTS
AND
EXPERIMENTS
WHAT DO WE NEED IN OUR STACK?
32
Doing CD with Machine Learning is still a hard problem
MODEL
PERFORMANCE
ASSESSMENT
VERSION
CONTROL AND
ARTIFACT
REPOSITORIES
©ThoughtWorks 2020
MONITORING
AND
OBSERVABILITY
DISCOVERABLE
AND
ACCESSIBLE
DATA
CONTINUOUS
DELIVERY
ORCHESTRATION
TO COMBINE
PIPELINES
INFRASTRUCTURE
FOR MULTIPLE
ENVIRONMENTS
AND
EXPERIMENTS
DEMO
DEMO
33
Data Scientist
Develops ML Model
Test and productionize
the model
Deploy to production
servers©ThoughtWorks 2020
Application
34
YOUR OBJECTIVE FUNCTION MUST LINK TO
BUSINESS VALUE
35
©ThoughtWorks 2020
NDC Porto (Virtual!), April 23, 2020
3636
THANK YOU!
Arif Wider
awider@thoughtworks.com
Emily Gorcenski
egorcens@thoughtworks.com
©ThoughtWorks 2020
join.thoughtworks.com

Continuous Intelligence: Keeping your AI Application in Production

  • 1.
    1 Continuous Intelligence Keeping your AIApplication in Production Arif Wider Emily Gorcenski NDC Porto, April 23-24, 2020
  • 2.
    7000+ technologists with43 offices in 14 countries Partner for technology driven business transformation Barcelona - Madrid - London - Manchester - Berlin - Hamburg - Munich - Cologne
  • 3.
    #1 in Agile and ContinuousDelivery 100+ books written ©ThoughtWorks 2020
  • 4.
  • 5.
    TECHNIQUES Continuous delivery for machine learning(CD4ML) models #8 TRIAL 8 ©ThoughtWorks 2020
  • 6.
    TECHNIQUES Continuous delivery for machine learning(CD4ML) models #8 TRIAL 8 ©ThoughtWorks 2020
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
    CONTINUOUS DELIVERY PIPELINES 13 PredictionModel Pipeline Web Application Pipeline
  • 14.
  • 15.
    NEW CHALLENGES 15 → Howto version control training data? → Training data and prediction models don’t fit into Git :-( → Model re-training slows down the entire continuous delivery server! → Data scientists want to evaluate several solutions at the same time... → ...and they use analytics notebooks which are hard to version control! → How to unit test data science code that is tied to changing data? → How to prevent behaviour changes of the model to break the application?
  • 16.
    WHAT ARE THEREASONS? 16
  • 17.
    Continuous Delivery isthe ability to get changes of all types — including new features, configuration changes, bug fixes and experiments — into production, or into the hands of users, safely and quickly in a sustainable way. Jez Humble & Dave Farley
  • 18.
    MANY SOURCES OFCHANGE 18 ModelData Code + + Schema Sampling over Time Volume ... Research, Experiments Training on New Data Performance ... New Features Bug Fixes Dependencies ... Icons created by Noura Mbarki and I Putu Kharismayadi from Noun Project ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 19.
    19 Code is abroad concept. It can refer to the source code of our services and systems. It can represent our infrastructure. It can refer to the code used to access, transform, or prepare data. It can refer to the code used to train, validate, and assess models. Code HOW DOES CODE CHANGE VERSION? Bug fixes New features Dependencies Operating systems Scope change Etc. This axis is the best-understood axis of version change for machine learning systems. ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 20.
    20 Model Model here refersto both the modeling approach (e.g. random forest classification) and the actual artifact produced (e.g. a pkl file). A model is a product of hyperparameters (not varied during training) and parameters (computed during training). HOW DOES A MODEL CHANGE VERSION? Research — trying new approaches Dependencies New data Performance improvements Etc. This axis is not as well-understood and machine learning, as a field, is changing so rapidly that many models can be expected to be obsolete in short order. ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 21.
    21 Data DATA IS MORECOMPLICATED ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 22.
    22 Data DATA IS MORECOMPLICATED Random Sample by Becris from the Noun Project, Puzzle by shashank singh from the Noun Project Sampling Schema Data is an assessment of the state of the universe at a point in time. It has a measurement and a shape. ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 23.
    23 Sampling Sampling refers tothe values in the data themselves. We can’t measure everything, but what we do measure is a sample of the universe. These values have properties like support, distribution, cardinality, etc. HOW DOES SAMPLING CHANGE VERSION? Time—it marches ever on Extrinsic changes in the universe Inserts, Deletions, Updates Etc. It is very difficult to specify or detect shifts in “versions” here except by example. We often think of this as moving forward with time, but that versions are not necessarily time-dependent. ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 24.
    24 Schema Schema refers tothe shape of our data. This can be a database schema, e.g. a table/column/constraint definition, or it could just refer to shape of the incoming data (e.g. JSON fields, XML schema, etc). HOW DOES SCHEMA CHANGE VERSION? Software updates Requirements changes Migrations Etc. It is very difficult to specify or detect shifts in “versions” here except by example. We often think of this as moving forward with time, but that versions are not necessarily time-dependent. ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 25.
    25 ML SYSTEMS HAVEFOUR “VERSION AXES” Any data-driven service can experience version drift along any of these axes independently or jointly. Schema Sampling Model Code ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 26.
  • 27.
  • 28.
    MORE TYPES OFPIPELINES DATA PIPELINE ML PIPELINE DEPLOYMENT PIPELINE
  • 29.
    PUTTING EVERYTHING TOGETHER 29 DataScience, Model Building Training Data Source Code + Executables Model Evaluation Productionize Model Integration Testing Deployment Test Data Model + parameters CD Tools and Repositories DiscoverableandAccessibleData Monitoring ©ThoughtWorks 2020 Production Data
  • 30.
    WHAT DO WENEED IN OUR STACK? 30 Doing CD with Machine Learning is still a hard problem MODEL PERFORMANCE ASSESSMENT VERSION CONTROL AND ARTIFACT REPOSITORIES ©ThoughtWorks 2020 MONITORING AND OBSERVABILITY DISCOVERABLE AND ACCESSIBLE DATA CONTINUOUS DELIVERY ORCHESTRATION TO COMBINE PIPELINES INFRASTRUCTURE FOR MULTIPLE ENVIRONMENTS AND EXPERIMENTS
  • 31.
    WHAT DO WENEED IN OUR STACK? 31 Doing CD with Machine Learning is still a hard problem MODEL PERFORMANCE ASSESSMENT VERSION CONTROL AND ARTIFACT REPOSITORIES ©ThoughtWorks 2020 MONITORING AND OBSERVABILITY DISCOVERABLE AND ACCESSIBLE DATA CONTINUOUS DELIVERY ORCHESTRATION TO COMBINE PIPELINES INFRASTRUCTURE FOR MULTIPLE ENVIRONMENTS AND EXPERIMENTS
  • 32.
    WHAT DO WENEED IN OUR STACK? 32 Doing CD with Machine Learning is still a hard problem MODEL PERFORMANCE ASSESSMENT VERSION CONTROL AND ARTIFACT REPOSITORIES ©ThoughtWorks 2020 MONITORING AND OBSERVABILITY DISCOVERABLE AND ACCESSIBLE DATA CONTINUOUS DELIVERY ORCHESTRATION TO COMBINE PIPELINES INFRASTRUCTURE FOR MULTIPLE ENVIRONMENTS AND EXPERIMENTS DEMO
  • 33.
    DEMO 33 Data Scientist Develops MLModel Test and productionize the model Deploy to production servers©ThoughtWorks 2020 Application
  • 34.
  • 35.
    YOUR OBJECTIVE FUNCTIONMUST LINK TO BUSINESS VALUE 35 ©ThoughtWorks 2020 NDC Porto (Virtual!), April 23, 2020
  • 36.
    3636 THANK YOU! Arif Wider awider@thoughtworks.com EmilyGorcenski egorcens@thoughtworks.com ©ThoughtWorks 2020 join.thoughtworks.com