Hello! Welcome to the next lesson in our module on Architecture for AI & Machine Learning.
In our previous session, we explored the feature store, establishing it as the central source of truth for ML data. We learned how it solves critical issues like training-serving skew and enables feature discovery and reuse.
Today, we will build directly on that foundation. Now that we have a reliable source of features, how do we use them to build a model in a systematic and automated way? This lesson addresses the learning outcome: Describe a reference architecture for a batch ML model training pipeline. As an architect, mastering this pattern is essential for designing robust, reproducible, and automated systems that transform raw data into valuable predictive assets.
1. From Manual Notebooks to Automated Pipelines
In the early stages of an ML project, a data scientist often works interactively in a notebook, manually loading data, training a model, and checking its performance. While this is great for exploration, it is not a sustainable or reliable process for production.
A batch training pipeline formalizes and automates this process. It is a sequence of pre-defined, automated steps that runs on a schedule (e.g., daily, weekly) or is triggered by an event (e.g., new data arrival). The entire process, from data fetching to model validation, is codified and executed without manual intervention.
From an architectural standpoint, this is a shift from an ad-hoc craft to an automated factory. The pipeline is the assembly line, the data is the raw material, and the trained model is the finished product.
2. The Core Pattern: Orchestrated Pull-Based Training
A common and powerful pattern for batch training is the orchestrated pull-based architecture. This name captures the two essential characteristics:
- Orchestrated: A central workflow management tool (an orchestrator) is responsible for running the steps in the correct order, managing dependencies, handling failures, and providing observability.
- Pull-based: The pipeline "pulls" the required data from a source (like our feature store) when it runs, rather than having data "pushed" to it in real-time.
The diagram below from the "MLOps Architecture Guide" by Neptune.ai illustrates this concept. An orchestrator schedules and triggers both a data pipeline (to refresh features) and a training pipeline (to build the model).

This diagram from Neptune.ai shows an orchestrated pull-based training architecture. A workflow orchestrator triggers both the data pipeline (which populates a feature store) and the training pipeline (which consumes from the feature store and produces a model in a registry).
3. Deconstructing the Batch Training Pipeline
A training pipeline is best understood as a Directed Acyclic Graph (DAG), where each node is a distinct processing step. Let's walk through a reference architecture for these steps.
Step 1: Triggering and Orchestration
A production pipeline doesn't start by someone clicking "run." It's triggered automatically.
- Trigger: This is typically a time-based schedule (e.g., "run every Sunday at 2 AM") defined in an orchestrator.
- Orchestrator: This is the brain of the operation. Instead of simple schedulers like cron, modern data platforms use tools like Apache Airflow or integrated services like Databricks Workflows.
To understand why an orchestrator is a critical architectural component, watch this short clip.
Design an ML Recommendation Engine | System Design
This clip from the 'Interview Pen' channel explains the move from a simple cron job to a full-fledged workflow orchestration system like Airflow, highlighting the benefits for scalability and observability.
Watch the section from 04:57 to 05:51. Focus on the two key advantages the video mentions for using a tool like Airflow over a simple scheduler.
As you saw, orchestrators provide crucial visibility into successes and failures and make it easier to scale the system, which are key concerns for any architect.
Step 2: Data Preparation
The first task in the pipeline is to assemble the dataset.
- Fetch Features: The pipeline queries the offline feature store (which we discussed in the last lesson) to get the specific set of features and labels needed for training. This ensures that the model is trained on the same, governed feature definitions that will be used elsewhere.
- Split Data: The dataset is split into distinct sets for different purposes: a training set (to teach the model), a validation set (to tune the model's parameters and evaluate it during development), and a test set (to provide a final, unbiased assessment of the model's performance).
Step 3: Model Training
This is the computational core of the pipeline.
- Execute Algorithm: The training code is executed on a compute cluster (like Apache Spark). It runs a learning algorithm on the training dataset.
- Output Model Artifact: The result of this step is a model artifact. This isn't just one file; it can be a collection of files representing the learned parameters, model structure, and information about the code environment it was trained in.
Step 4: Model Evaluation
A newly trained model is useless until we know how well it performs.
- Generate Predictions: The pipeline uses the trained model to make predictions on the validation or test set.
- Calculate Metrics: It then compares these predictions to the true labels and calculates performance metrics (e.g., accuracy for classification, Mean Squared Error for regression). These metrics are logged for comparison.
Step 5: Model Validation and Registration
This is the automated quality gate. The pipeline decides if the new model is "good enough" for production.
- Business Logic: The pipeline runs a validation check. This could be a simple threshold (e.g.,
accuracy > 90%) or a comparison against the current production model (e.g.,new_model_error < 0.98 * production_model_error). - Register Model: If the new model passes validation, it is saved to a Model Registry. A model registry, like the one included in MLflow, is a central system for versioning trained models and managing their lifecycle (e.g., transitioning them from
StagingtoProduction). If the model fails validation, it is still logged but not promoted.
This video provides a practical walkthrough of these steps within the AWS SageMaker platform, which helps visualize the process.
End-to-end ML pipeline with SageMaker pipelines | Quick walkthrough
This video from 'Denys on Data' demonstrates an end-to-end pipeline. It's a great practical example of the steps we've just discussed in theory.
Watch the sections covering preprocessing, training, evaluation, and the conditional step (from 02:38 to 07:10). Notice how each part is a distinct 'step' in the pipeline and how the final registration depends on the evaluation results.
Test your understanding!
You are designing a pipeline to retrain a customer churn prediction model weekly. The business rule is that a new model should only be deployed if its accuracy is at least 2% better than the current production model's accuracy.
Sketch out the key steps in your training pipeline, paying special attention to how you would implement this business rule in the final stages.
Show answer
The pipeline would follow these steps:
- Trigger: An orchestrator starts the pipeline on a weekly schedule.
- Data Prep: Fetch the latest customer features and churn labels from the feature store and split the data.
- Training: Train a new churn model (
new_model) on the training set. - Evaluation:
a. Load the current production model (prod_model) from the Model Registry.
b. Evaluate bothnew_modelandprod_modelon the same unseen test set to getnew_accuracyandprod_accuracy. - Validation & Registration (The 'Quality Gate'):
a. Compare Metrics: Implement a conditional step:IF new_accuracy >= prod_accuracy * 1.02.
b. Promote: If the condition is true, registernew_modelin the Model Registry and transition its stage toProduction(and potentially archive the old one).
c. Reject: If the condition is false, log thenew_modeland its failed metrics, but do not promote it. The current production model remains active.
4. A Reference Architecture in the Lakehouse
The concepts we've discussed are platform-agnostic, but it's helpful to see them applied in a modern data platform like Databricks. The following resource describes a reference architecture for MLOps on the Lakehouse.
Architecting MLOps on the Lakehouse
This article from Databricks, 'Architecting MLOps on the Lakehouse', provides a detailed look at how these pipeline concepts are implemented in a real-world production environment. It perfectly summarizes and contextualizes our discussion.
Please read the section titled 'Production environment'. It details the workflow, including feature refresh, model training, continuous deployment (which includes our validation and registration steps), and retraining triggers. This reinforces all the steps we've covered today.
The diagram below provides a simplified but complete view of a batch training pipeline within an Azure Databricks context. It clearly shows the flow from data ingestion to a scheduled training job that produces a model.

Conclusion
Today, we have designed the automated factory for producing machine learning models. You've learned that a batch training pipeline is a fundamental pattern in MLOps that brings reliability, reproducibility, and governance to the model creation process.
Key Takeaways:
- A batch training pipeline is an automated, orchestrated sequence of steps that trains, evaluates, and validates an ML model.
- The architecture is typically a DAG (Directed Acyclic Graph) of steps managed by an orchestrator like Airflow or Databricks Workflows.
- The key steps are: Data Preparation (from a feature store), Model Training, Model Evaluation, and Model Validation/Registration.
- A Model Registry (like MLflow) is a critical component for versioning models and managing their lifecycle from
StagingtoProduction.
Preview of the next lesson:
We now have a versioned, validated, production-ready model sitting in our model registry. What's next? We need to use it to make predictions. In our next lesson, we will explore architectural patterns for model inference, comparing the approaches for generating predictions in batch versus in real-time.