Machine Learning
Machine learning (ML) and AI training are among the most demanding consumers of the data lake. Reports need correct numbers. Models need large volumes of correct, consistent, historical and well-understood data, and they turn every data problem into a model problem: biased data produces biased predictions, leaked data produces models that look great in testing and fail in production, and silently changing data makes yesterday's good model wrong today.
This page summarizes the problem space and the common architecture patterns for building ML on top of the organization's data foundations.
The problem space
ML systems are more than models
A traditional application is defined by its code. An ML system is defined by code, data and the trained model together, and all three change over time. The well-known paper Hidden Technical Debt in Machine Learning Systems observed that the model code is often a small part of a real ML system. Most of the effort goes into data collection, feature engineering, validation, serving infrastructure and monitoring.
Typical challenges
| Challenge | What goes wrong |
|---|---|
| Data availability and quality | Data is locked in silos, incomplete, inconsistent across sources, or poorly documented (see unlocking the data) |
| Labels | Supervised learning needs known outcomes (fraud or not, churned or not), which are often missing, delayed or expensive to produce |
| Data leakage | Training uses information that would not be available at prediction time, for example a field that is only filled in after the outcome is known. The model looks excellent in testing and fails in production |
| Training–serving skew | Features are calculated one way for training (in batch, on the lake) and another way for predictions (in real time, in an application) |
| Reproducibility | Nobody can recreate the exact data, code and parameters that produced the model in production |
| Drift | The world changes: customer behavior, prices, products. Model accuracy degrades silently over time |
| Compute cost | Training, especially deep learning, needs GPUs and can be expensive; idle GPU capacity is costly |
| Governance and ethics | Personal data in training sets, bias and fairness, explainability, and regulation such as the EU AI Act |
Kinds of ML workloads
| Workload | Typical data | Examples |
|---|---|---|
| Classical ML | Structured, tabular data from silver and gold layers | Churn prediction, demand forecasting, credit scoring, fraud detection, recommendations |
| Deep learning | Large volumes of images, text, audio, sensor data | Image recognition, document classification, speech, anomaly detection |
| Generative AI with foundation models | Documents, knowledge bases, curated examples | Retrieval-augmented generation (RAG), fine-tuning for domain tasks, evaluation datasets |
Most organizations do not train large foundation models themselves. They use existing models and adapt them with their own data, which makes data preparation, retrieval and evaluation the main architectural work for generative AI.
The ML lifecycle
MLOps applies DevOps practices to this lifecycle: versioning, automation, testing, continuous delivery and monitoring, for data and models as well as code. Google's article on MLOps continuous delivery and automation pipelines describes maturity levels from manual notebooks to fully automated training pipelines; ml-ops.org collects principles and practices.
Common architecture patterns
1. Training on the lakehouse
Models are trained directly on data in the lake, mostly from the silver layer (clean, detailed records) and gold layer (business-level aggregates). The lake gives ML what operational databases cannot: long history, data combined from many sources, and the scale to process it.
Good practices:
- Snapshot training data. Open table formats such as Iceberg and Delta Lake support time travel. Recording the table version used for training makes every model reproducible.
- Respect point-in-time correctness. Build training examples only from data that was available at the moment of the historical prediction, to avoid leakage.
- Write predictions back to the lake. Predictions and later outcomes become data for monitoring, analysis and retraining.
2. Feature store
A feature is an input to a model, such as "number of orders in the last 30 days" or "average basket value". Computing features consistently is one of the hardest parts of ML. A feature store defines features once and serves them in two ways:
- an offline store (on the lake) with full history, for building training datasets with point-in-time correctness
- an online store (a low-latency database) with the latest values, for real-time predictions
Because training and serving use the same feature definitions, training–serving skew is avoided. Features also become reusable across teams and models. Examples include Feast (open source), Amazon SageMaker Feature Store, Google Cloud's Feature Store and the feature engineering capabilities in Databricks.
A feature store is worth its complexity when there are real-time models or many models sharing features. For a few batch models, well-designed gold tables are often enough.
3. Experiment tracking and model registry
- Experiment tracking records every training run: code version, data version, parameters, metrics and artifacts, so results can be compared and reproduced.
- A model registry stores approved model versions with their metadata and lifecycle stage (candidate, production, archived), and is the single source for deployment.
MLflow is the most widely used open source tool for both, and is built into several platforms. DVC adds version control for datasets and models alongside code.
4. Model serving
How predictions are delivered depends on how quickly they are needed:
| Pattern | How it works | Latency | Examples |
|---|---|---|---|
| Batch inference | A scheduled job scores all records and writes predictions to the lake or a database | Hours | Churn scores for the marketing team, nightly demand forecasts |
| Online inference | The model runs behind an API; applications call it per request | Milliseconds | Fraud check during payment, product recommendations on a web page |
| Streaming inference | The model consumes events and publishes predictions as events | Seconds | Anomaly detection on sensor data, real-time risk signals |
| Embedded / edge | The model runs inside an application, device or browser | Immediate, offline-capable | Mobile apps, IoT devices, factory equipment |
Start with batch where possible. It is the simplest to build, test and operate, and many use cases do not need real-time predictions. Online and streaming serving add requirements for availability, latency, scaling and the online feature store.
5. ML pipelines and continuous training
In mature setups, the whole path from data to deployed model is an automated pipeline, triggered on a schedule, when new data arrives, or when monitoring detects drift:
- extract and validate data
- compute features and build the training set
- train and evaluate the model
- compare with the current production model
- register and deploy if it is better and passes all checks (accuracy, fairness, performance)
Pipelines are orchestrated with tools such as Kubeflow, the pipeline features of cloud ML platforms, or general orchestrators like Apache Airflow and Dagster. Ray is widely used for distributed training and processing.
6. Monitoring and feedback
A deployed model needs monitoring beyond the usual technical metrics (see observability):
| What to monitor | Why |
|---|---|
| Input data drift | The distribution of incoming data differs from the training data |
| Prediction drift | The distribution of predictions changes unexpectedly |
| Model performance | Accuracy against actual outcomes, once labels become available |
| Data quality | Missing values, broken pipelines, schema changes upstream |
| Fairness | Performance across customer groups and other relevant segments |
Tools such as Evidently and the monitoring features of ML platforms automate these checks. Capturing actual outcomes and joining them to predictions in the lake closes the loop for evaluation and retraining.
7. Adapting foundation models
For generative AI built on foundation models, the data lake supplies the data used to adapt and evaluate them:
- Fine-tuning: curated examples from the lake adapt a model to a specific task, format or domain vocabulary. It needs high-quality, representative and well-governed training data, and follows the same lifecycle as other models: versioned datasets, tracked experiments, evaluation and a registry.
- Evaluation datasets: collections of inputs and expected outputs, built from real cases, used to measure quality before and after every change of model, prompt or data.
A practical order of preference is: good instructions and context first, then retrieval-augmented generation (RAG), then fine-tuning, and training a model from scratch only in rare, well-justified cases. Each step adds cost and complexity.
Using foundation models inside processes and products, with retrieval over company knowledge rather than training, is described in the AI in Processes and Products chapter: semantic search and RAG. The lake is a key source for the indexing pipelines described there.
Reference architecture
Platforms and tools
| Category | Examples |
|---|---|
| Cloud ML platforms | Amazon SageMaker AI, Azure Machine Learning, Google Cloud Gemini Enterprise Agent Platform (previously Vertex AI) |
| Data and AI platforms | Databricks, with ML capabilities next to the lakehouse |
| Open source MLOps | MLflow, Kubeflow, Feast, Ray, DVC, Evidently |
| ML frameworks | scikit-learn, XGBoost, PyTorch |
| Models and datasets | Hugging Face for open models, datasets and tooling |
Choose platforms that work on the same data as the lake, without copying it into a separate silo for data scientists.
Governance for ML
ML adds governance requirements on top of those for the data lake and data governance:
- Lineage from data to model: for every production model, which datasets, versions and features were used, so that data issues can be traced to affected models.
- Model documentation: purpose, training data, performance, limitations and intended use, for example as model cards.
- Privacy: minimize personal data in training sets; pseudonymize where possible; know which models were trained on which personal data, because erasure requests and consent changes may affect them.
- Fairness and explainability: test for bias before deployment and monitor afterwards, especially for decisions that affect people (credit, hiring, pricing).
- Risk classification: regulations such as the EU AI Act set requirements based on the risk level of the use case. High-risk uses need documented data governance, human oversight and traceability.
- Access control: data scientists get access to the data they need for a project, not to everything in the lake.
ML as a platform capability
Following the platform mindset, a central ML platform team can provide:
- a golden path for ML projects: project template, data access, experiment tracking, training pipeline, registry and deployment, all pre-configured (see provisioning)
- shared compute with GPU scheduling and cost controls
- reusable features on top of the lake
- standard monitoring and model documentation templates
This lets data scientists focus on the problem and the model, instead of building infrastructure for every project.
Common pitfalls
- Notebook to production by hand: models that only one person can retrain, deployed by copying files.
- Copying data into ML silos: separate data extracts for every project, with no lineage, no updates and no governance.
- Ignoring the baseline: complex models deployed without comparing them to simple rules or a basic model.
- No monitoring after deployment: model quality degrades for months before anyone notices.
- Real-time by default: building online serving and feature stores for problems that a nightly batch job would solve.
- Fine-tuning first: fine-tuning or training models for generative AI use cases that good context and retrieval would solve faster and cheaper.