Pipeline

In machine learning, a pipeline is a defined sequence of automated steps, such as cleaning data, transforming it, running a model and processing the output, that runs as a single repeatable process.

The word is used at several scales, but the idea is the same each time: chain steps so the output of one becomes the input of the next, and run the whole chain as one repeatable unit. At the smallest scale, the scikit-learn library's Pipeline joins several processing steps into a single object. Every step except the last must transform the data; the last can be a model such as a classifier. A pipeline might reduce the number of features and then classify, all with one call to fit and one to predict.

That packaging does more than save typing. Scikit-learn lists three benefits: convenience, the ability to tune settings for every step at once, and safety. The last point matters most. If data is normalised using averages computed across the whole dataset before it is split, information from the test set leaks into training and makes results look better than they are. A pipeline fitted only on the training portion avoids that mistake during cross-validation.

Hugging Face uses the word for the same pattern applied to running models. Its pipeline function wraps preprocessing, such as turning text into tokens, the model itself and post-processing into one call: give a text-classification pipeline a sentence and it returns a label and a confidence score.

At production scale, pipelines are the backbone of MLOps. Google's MLOps guidance describes automated training pipelines that validate incoming data, retrain the model, validate the result and deploy it. At what Google calls level 1 maturity, the thing deployed is the whole training pipeline, which retrains on new data automatically, rather than a single model file. In applications built on language models, an inference pipeline might retrieve documents, assemble a prompt, call the model, check the output and format the answer.

Two other uses are worth separating. Pipeline parallelism is a way of splitting a large model's layers across several chips, so that each processes one stage. And in business news, a company's pipeline usually means its products in development. In machine learning practice, much of the trouble in real systems lives in the steps around the model, and pipelines are how those steps are made visible, testable and repeatable.

Common questions

What is an ML pipeline?

An ML pipeline is an automated sequence of steps that takes raw data through preparation, training or prediction and output handling. Running the steps as one defined process makes results repeatable and lets the whole sequence be tested, versioned and rerun on new data.

What is the difference between a data pipeline and an ML pipeline?

A data pipeline moves and transforms data between systems, for example loading sales records into a warehouse every night. An ML pipeline includes model-specific steps such as feature preparation, training, evaluation and prediction, and often consumes the output of data pipelines.

Why use a pipeline in scikit-learn?

It bundles preprocessing and the model into one object, so you fit and predict with single calls, tune all steps together and avoid leaking information from test data into training during cross-validation.

What is pipeline parallelism?

It is a technique for running a model too large for one chip by splitting its layers into stages on different chips. Data flows from one stage to the next, so several chips work on different parts of the model at the same time. Serving engines such as vLLM support it.

Finding more

Search for "machine learning pipeline", "scikit-learn Pipeline data leakage" or "MLOps training pipeline" to see how pipelines are built at different scales. Reliable sources include the documentation of machine learning libraries such as scikit-learn and Hugging Face, and architecture guides from cloud providers. Tutorials often skip the data leakage point, so prefer sources that explain why steps are fitted only on training data.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.