# What is the ML Model Lifecycle?

_The ML model lifecycle encompasses all stages from problem definition through production monitoring—a continuous process of building, deploying, and maintaining machine learning systems._

The ML model lifecycle encompasses all stages from problem definition through production monitoring—a continuous process of building, deploying, and maintaining machine learning systems.

Why it matters: Models aren't static. Data changes, environments shift, and performance degrades. Organizations that treat model deployment as "done" inevitably face silent failures, surprised users, and emergency fixes. Lifecycle management keeps models reliable over time.

## Lifecycle Stages

### 1. Problem Definition
Before building models, clearly define:
- **Business objective**: What decision or action will the model support?
- **Success metrics**: How will you measure model value? (Not just accuracy—business outcomes)
- **Constraints**: Latency requirements, cost limits, explainability needs, regulatory requirements
- **Scope boundaries**: What the model should and shouldn't do

Many ML projects fail because they optimize for the wrong objective or build solutions to poorly defined problems.

### 2. Data Collection
Gather data that represents the problem you're solving:
- **Relevance**: Does this data actually predict the target?
- **Coverage**: Does it represent the populations and scenarios you'll encounter?
- **Quality**: Is it accurate, complete, and consistent?
- **Freshness**: How old is it? Will patterns still hold?
- **Compliance**: Do you have rights to use this data?

Data quality issues here propagate through everything that follows.

### 3. Data Preparation
Transform raw data into model-ready features:
- **Cleaning**: Handle missing values, outliers, inconsistencies
- **Feature engineering**: Create predictive features from raw data
- **Splitting**: Separate training, validation, and test sets appropriately
- **Versioning**: Track what data was used for which experiments

### 4. Model Development
Build and iterate on model candidates:
- **Algorithm selection**: Choose approaches suited to your problem
- **Hyperparameter tuning**: Optimize model configuration
- **Experiment tracking**: Log parameters, metrics, and artifacts
- **Iteration**: Refine based on evaluation results

### 5. Model Evaluation
Validate models before deployment:
- **Accuracy metrics**: Performance on held-out test data
- **Slice analysis**: Performance across subpopulations
- **[Bias and fairness](/ai-bias-fairness)**: Disparities across protected groups
- **Robustness**: Behavior on edge cases and adversarial inputs
- **Business validation**: Does it actually solve the stated problem?

### 6. Deployment
Move validated models to production. [MLOps](/mlops) practices formalize this transition:
- **Packaging**: Containerize models with dependencies
- **Infrastructure**: Set up serving infrastructure
- **Integration**: Connect to downstream systems
- **Rollout strategy**: Canary, blue-green, or gradual rollout
- **Rollback plan**: How to revert if problems emerge

### 7. Monitoring
Track production model behavior with [ML model monitoring](/ml-model-monitoring):
- **Input monitoring**: Data [drift](/ai-model-drift) from training distribution
- **Output monitoring**: Prediction distribution shifts
- **Performance monitoring**: Accuracy when ground truth available
- **Operational monitoring**: Latency, throughput, errors, costs
- **Safety monitoring**: Policy violations, harmful outputs

Monitoring is observational. [AI supervision](/ai-supervision) adds enforcement—acting on what monitoring reveals to maintain control over model behavior in production.

### 8. Maintenance and Retirement
Keep models healthy or gracefully retire them. Address [model degradation](/model-degradation) proactively:
- **Retraining**: Update models on new data
- **Updates**: Patch issues, improve performance
- **Versioning**: Track model changes over time
- **Retirement**: Deprecate models that no longer serve their purpose
- **Documentation**: Maintain audit trails and institutional knowledge

## The Feedback Loop

The lifecycle is circular, not linear:

```
Problem → Data → Model → Deploy → Monitor
    ↑                            ↓
    └────── Feedback ←──────────┘
```

Production insights inform:
- Data collection improvements
- Feature engineering refinements
- Model architecture changes
- Evaluation criteria updates
- Deployment process improvements

Organizations that close this loop improve faster than those treating each cycle as independent.

## Common Lifecycle Failures

### Development-Production Gap
Models that work in notebooks fail in production due to:
- Different data distributions
- Feature engineering inconsistencies
- Scale and latency issues
- Missing error handling

### Silent Degradation
Models deployed without monitoring degrade undetected:
- Data drift erodes accuracy gradually
- No one notices until impact is severe
- By the time failures are visible, damage is done

### Manual Handoffs
When stages require manual intervention:
- Errors in transferring models and configurations
- Slow, unpredictable timelines
- Lack of reproducibility

### Neglected Maintenance
Models treated as "done" after deployment:
- No retraining process
- No one responsible for ongoing health
- Models become liabilities rather than assets

## LLM Lifecycle Differences

Large language models require adapted lifecycle practices:

- **Less training**: Most organizations use pre-trained models, focusing on prompting and fine-tuning
- **Prompt versioning**: System prompts become primary "model" artifacts
- **Evaluation complexity**: Output quality harder to measure than classification accuracy
- **New monitoring needs**: [Hallucinations](/ai-hallucinations), safety violations, [prompt injection](/ai-prompt-injection) attempts

## How Swept AI Supports the ML Lifecycle

Swept AI provides tools for critical lifecycle stages:

- **[Evaluate](/product/evaluate)**: Pre-deployment validation that tests models under realistic conditions. Understand behavior distributions before production exposure.

- **[Supervise](/product/supervise)**: Continuous production [monitoring](/ai-monitoring) for drift, quality, and safety. Close the feedback loop with real-time visibility into model behavior.

- **[Certify](/product/certify)**: Documentation and evidence generation throughout the lifecycle for [compliance](/ai-compliance), audits, and governance.

The ML lifecycle is the difference between models that demo well and models that deliver sustained business value. See also: [From Demo to Deployment](/post/from-demo-to-deployment-the-ai-consistency-crisis-and-how-swept-ai-solves-it).