MLOps: how to take a machine learning model into production
The stages of a machine learning project, the DevOps and DataOps roots of MLOps, the data-centric approach and the role of pipelines.
A model that works in a pilot still has to become a solution that scales, always responds and holds up over time. Fernando López explains what MLOps is, the stages of a machine learning project, which metrics matter in production, why the focus has shifted from code to data, and how the work is organized into a pipeline.
TABLA DE CONTENIDOS
MLOps is the set of practices for taking a machine learning model into production and keeping it running reliably. This article, published in December 2021, walks through the stages of a machine learning project, where MLOps comes from (DevOps and DataOps), the metrics that govern it, why the focus has shifted from code to data, and how the work is organized into a pipeline.
From one-off project to ongoing operations
MLOps is about moving from a milestone to ongoing operations. That innovative data science project that shone by solving a specific problem, answering hard questions such as a prediction, now has to become an evolving solution, able to grow in both complexity and data volume while always responding with quality and full availability.
We have known for some time that solutions built on machine learning, like any software engineering project, involve many components, and the machine learning code itself is only a small part of them (D. Sculley et al., 2015). In other words, this is a broad workflow, with components ranging from configuration to monitoring, including data collection, feature generation and a serving infrastructure that keeps the model available.
The stages of a machine learning project
A machine learning project goes through four stages, and the last three repeat in a cycle:
- Scoping: scope, objectives, plan and architecture.
- Data: data collection, baselines, labeling and data organization.
- Modeling: testing models and analyzing errors.
- Deployment: putting the model into production and monitoring it.

We start (scoping) by defining a well-bounded scope with measurable objectives. We draw up a project plan covering items such as the architecture, team training and the schedule for the following stages.
Information (the data stage) is central to this kind of project, and it is where most of the effort goes: probably well over half of the time spent on the whole project. Having the data is the starting point for producing the inputs every model will need. Data must be curated, profiled and cleaned so we can define the features on which to build our data science or machine learning algorithms. At this point we start talking about baselines, first for the data profile and then for the models. We also need to classify the data, label it and organize it in our repository (a feature store), typically a data lake.
Once the features are defined, modeling means proposing and testing different algorithms, designed by the team’s data scientists (and why not, with help from AutoML), looking for the best performance while always keeping fairness and privacy in mind.
Models then have to be made available (deployment) under the operating conditions of each case (for example, being able to run on a mobile device), making sure they always respond and that the response is of good quality.
This data, modeling and deployment cycle keeps repeating throughout the life of the solution, adjusting as reality changes.
DevOps, DataOps and MLOps
MLOps grew directly out of DevOps and DataOps, so they are worth a brief look:
- DevOps (development and operations) emerged in response to the growing complexity of the software development cycle, in which IT operations were taking up more and more effort. The goal is to shorten the implementation cycle while ensuring continuous integration without losing quality.
- Continuous integration means merging all developers’ work into a main branch that can be deployed several times a day.
- Continuous delivery means producing software in short cycles so that it can be tested reliably and automatically at any time.
- DataOps (data operations) is a process-oriented methodology used by analytics teams to improve quality and shorten the analytics cycle time.
- MLOps, in line with the definitions above, is the set of practices aimed at deploying and maintaining machine learning models in production reliably and efficiently.
An MLOps solution has to work within acceptable operating conditions. We need to check that performance is adequate under the right operating parameters, and for that we have:
- Machine learning metrics, such as precision, accuracy, F1 score and many others derived from them.
- Software engineering metrics, such as latency and throughput. Latency is the time between a user requesting a result and receiving it. Throughput is the number of requests or processes the system completes per unit of time.
76% of IT leaders say they continue to struggle to strike the right balance between business innovation and operational excellence.
Source: IDG, 2021 State of the CIO
Data-centric machine learning
Around 2021 we began to see a redefinition of what an artificial intelligence system is. In this renewed view, these systems rest equally on two pillars: code and data. If our focus is on code, we work on a static dataset, test different models, pick the one we like best and then tune its hyperparameters. If, instead, we put more emphasis on data, as is the current trend, we choose a model, keep it fixed, and iterate on the data, getting a better dataset with new and better features each time.
Why this renewed emphasis on data? One explanation may lie in how far machine learning methods have come. The versatility of today’s algorithms, plus automated training capabilities (both for hyperparameter selection and for defining model architectures), lets us trust, to a large extent, that the algorithm we are looking for exists.
What we cannot replace is the data. Even that is not entirely true: it is possible to generate artificial data, either by composing more data or by adding noise. One example is GANs (generative adversarial networks), often used for industrial quality control. It is worth noting that synthetic data generation is much more feasible for unstructured data than for data that follows a set schema, usually tied to a transaction in a business system.
A focus on data forces us to get the most out of feature generation: we must select the features that best represent our problem, the richest inputs for a model. To do so, we use selection techniques with varying degrees of automation; for example, we remove features that are redundant or depend on others. There are algorithms that analyze the available features (which can easily number in the hundreds) and keep the best subset.
Feature engineering aims to produce the best input for the modeling stage. It goes far beyond selection: it involves combining features to create new ones, converting them into new data types, inventing representations (such as word embeddings, or vectors) and rescaling them (normalization).
Both the data and its descriptive schema can degrade over time, although it would be fairer to speak of bias than of degradation. Depending on how much the data changes over time, we talk about data drift or concept drift.
Data profiling and exploration matter just as much. Recall Anscombe’s quartet, which shows that a single statistical metric is not enough to profile a dataset.
These data-stage tasks, in which we validate (data types and value domains), describe, clean, change dimensionality and create new representations, can be conveniently organized as a pipeline in the form of a directed acyclic graph, where each step (node) carries out those activities in order.
Pipelines for MLOps
The MLOps cycle starts with data, but it also pays close attention to deploying the machine learning solution. How do we get from data to a model in production in an orderly, methodical and governable way? That is where MLOps shines as a methodology, together with the tools that put these best practices into practice.
A very popular example is TensorFlow Extended (TFX), a free, open-source platform backed by Google. TFX implements the MLOps pipeline through a set of orchestrated components, usable and customizable in Python, covering ingestion, validation, transformation, training and deployment, including monitoring. The TFX documentation shows a diagram of a complete pipeline: Understanding TFX pipelines.
That’s all for now, as an introduction to MLOps.
Reference: D. Sculley et al., Hidden technical debt in machine learning systems, Advances in Neural Information Processing Systems, vol. 28, pp. 2503-2511, 2015.
Fernando López
Big Data & Data Science Practice Leader