A MLOps Primer
Introduction
In this blog we hope to provide you with a basic understanding of MLOps, what it is, its’ importance in the utilization of data engineering and some best practices in how to leverage it it as you explore more difficult challenges within your workplace. MLOps can help you deliver complex solutions that deliver the insights needed to understand your data like never before.
What is MLOps
Machine Learning Operations, or MLOps, is the iterative practice of deploying and maintaining machine learning models. It is the intersection of data engineering, machine learning, and DevOps, spanning from data preparation to model diagnostics and more. The goal is to automate the process of continuous integration, continuous delivery, and continuous training.
Why MLOps
As machine learning solutions are developed with increasing complexity and scope, the effort needed to manage these projects through their lifecycle increases dramatically. Data environments, tools, and developers come and go and the project can easily become disorganized and unwieldy to manage.
As a practice, MLOps aims to avoid and mitigate these issues by combining the techniques, tools, and methodologies from data engineering, machine learning, and DevOps.
Best Practices
MLOps is a continuous cycle and inherits best practices from the three fields it combines. Continuous integration and continuous delivery/deployment (CI/CD), feature engineering, data cleaning, and model validation are all important parts of MLOps. New to MLOps is the idea of continuous training, where models need to be continually updated to counteract performance degradation.
Data Engineering
A machine learning model is only as strong as the data it’s based on. Data engineering kicks off the MLOps lifecycle as this is where the data is gathered, analyzed, and then prepared.
Robust and organized data architectures, like the medallion architecture, streamline this process making the system easy to maintain and reproduce across different environments.
Machine Learning
The process of training machine learning models should start with a simple baseline. Simple models can be trained and tuned quickly, which enables rapid experimentation and the discovery of any data issues. Complexity should be slowly added to address limitations of previous iterations. Development using this iterative approach makes it easy to weigh possible tradeoffs between models. For example, a complex model may have better performance metrics, but may also have high latency and computational costs.
DevOps
MLOps and DevOps are the most similar to each other but there are a few key differences. Not only does MLOps concern itself with code versioning, but dataset storage and model versioning also need to be implemented as well. Training machine learning models involves a lot of experimentation so keeping track of which models performed well and what datasets were used to train those models will reduce overhead.
On top of this, model performance degrades as data and patterns in data change over time. There needs to be continuous monitoring of model metrics such as accuracy, throughput, and errors/unexpected behaviors. As outcomes may not always be available immediately after prediction, it is also important to monitor the model’s input to detect changes over time. The similarity between the input and the training data can be used to approximate performance.
More Resources
Companies like Databricks, Microsoft, and Amazon are building MLOps platforms with guides and resources diving deeper into the intricacies of the field.
Databricks is Lovelytics’ preferred MLOps platform. It is designed for scalable data engineering and has incorporated MLflow to track and manage machine learning experiments. It is a powerful tool, but also easy to learn and implement with a little assistance.
Microsoft and Amazon have Azure Machine Learning and Amazon SageMaker respectively. Both are designed to streamline the machine learning lifecycle. If you’re looking for a great MLOps platform, you can’t go wrong with any of these three.
As Data Engineers at Lovelytics, we love helping people do more with their data. To learn how we might be able to help you start leveraging the power of MLOps, please connect with us at [email protected].