How to deploy Machine Learning models in production in a reliable, efficient and stable way over time? It is to these issues that MLOPs respond.
MLOps stands for Machine Learning Operations. This term refers to all the practices aimed at deploying machine learning and deep learning models in production environments, in order to serve the models to end users after an experimentation phase.
Origin Of MLOps
The MLOps combines three disciplines:
- Data Engineering: the construction of an environment in which the data is usable
- Machine Learning: computer-aided learning of the information contained in the data
- DevOps: automation of the integration and deployment of software modifications
While Machine Learning and Data Engineering are always naturally united, MLOps was born by association of the two previous disciplines with the DevOps movement. In the context of DevOps, we often talk about a CI/CD automation pipeline, for:
- Continuous Integration : Verification that each new version of the software retains the functionality already integrated.
- Continuous Delivery/Deployment : Automation of software updates
During a Machine Learning project, it is no longer enough to integrate and deploy the modifications of a software to meet the needs of the users. Data and its modelling are at the centre of machine learning projects. However, the data is constantly changing and the model must therefore adapt to these changes.
For this reason the MLOps integrates, in addition to the CI/CD pipeline, a CT/CM pipeline:
- CT for Continuous Training (or continuous training) which allows the model to adapt to the data and their modifications.
- CM for Continuous Monitoring (or continuous monitoring) which makes it possible to check and alert during the evolution of the data and the performances of the model.
Modelling is served to users through software, most often through one of the following two solutions:
- an API (for Application Programming Interface) which provides functionalities via a standardized interface (for example web). An example of an API is Google Translate: the functionality provided is the translation of sentences, the translation is done on Google servers with their own algorithm.
- an embedded model, which is used when the model is deployed to individual devices. Such a model is often used for mobile games: to be able to play “offline”, the game’s AIs are directly deployed in the application and each decision is made thanks to the calculations made on the phone.
Therefore, the software constraints (throughput, latency and cost) present in DevOps also apply in the context of MLOps.
MLOps In A Machine Learning Project
Let’s take a look at integrating MLOps into a Machine Learning project. These projects can be broken down into 4 phases: Scoping, Data, Modelling and Deployment.
Completing a machine learning project is an iterative process. For example, one can realize during the modelling that the model obtained is not effective on an age category. It will then be possible to return to the data collection phase to increase the number of individuals in this age category and thus help the model learn their behaviour.
Naturally, we think that the MLOps only intervenes at the deployment phase, when the model is made available to users. Except that the production of a model does not stop at its deployment: the MLOps has repercussions in the other phases as well:
- Data: When using the model, the data evolves. For example, after updating the data sources to incorporate more predictive variables, there may be new missing values to correct due to a change in the data acquisition process,
- Modelling: When using the model, users can provide feedback on predictions made and allow retraining of a model to correct errors. For example, by deploying a forest fire detection model, firefighters can feedback the model to learn how to detect fires it missed (or detected too late).
The MLOps is therefore integrated into the different phases of the project since at the end of the deployment we generally continue to iterate on the quality of the data and the model in a more or less automated way.
To automate these iterations, it is necessary to adopt an MLOps point of view when:
- Data definition : define patterns and scenarios to detect changes, for example: ensure that the number of missing values does not exceed more than 5% of individuals.
- The modelling phase : define the metrics to be monitored, for example: check that performance on the population of over 50s remains above 85%, etc.
MLOps is therefore an approach to Machine Learning projects that goes beyond the scope of model deployment. It makes it possible to consider the different aspects of the project likely to have an impact on the quality of the predictions presented to the user: the performance of the software, the quality of the data and the quality of the model.