# CT/CD Automation

## Models That Improve Themselves

Continuous Training and Continuous Deployment. Close the feedback loop, automate retraining, and deploy with confidence using shadow models.

0

- Manual intervention  
- 24/7  
- Automated loop  
- 100% Safe deployments  
- ∞ Model iterations

## Production data becomes training data

Connect your deployment to your training pipeline. Reviewed predictions automatically flow into your training datasets, creating a continuous improvement cycle.

1

### Capture predictions

Every inference logged automatically

2

### Review anomalies

Flag and correct mispredictions

3

### Enrich datasets

Add reviewed data to training sets

4

### Trigger retraining

Automated based on thresholds

### SDK

```
# Setup feedback loop
deployment.setup_feedback_loop()

# Attach dataset for enrichment
deployment.attach_dataset_version_to_feedback_loop(
  dataset_version=training_set
)

# Activate
deployment.toggle_feedback_loop(True)
```

### Feedback Pipeline

- Active
- Predictions logged: 12,847
- Reviewed: 2,156
- Added to training set: 1,892
- Ready to trigger: 1,892 / 2,000 threshold reached

### Retraining Triggers

- **Configure**
  - Review Threshold: Active
  - Trigger retraining when reviewed predictions reach threshold: 750/1000  
  - Drift Alert: Monitoring
    - Trigger when distribution drift exceeds threshold: 8%/15%  
  - Scheduled: Disabled
    - Retrain on a fixed schedule (weekly, monthly)

## Training Orchestration

### Automated retraining on your terms

Define triggers based on review thresholds, drift detection, or schedules. When conditions are met, Picsellia automatically provisions GPUs and launches training.

- Review threshold triggers
- Distribution drift detection
- Scheduled retraining
- Automatic GPU provisioning
- Full experiment tracking

```python
# Setup continuous training
deployment.setup_continuous_training(
trigger_threshold=1000,
experiment_name="auto-retrain-v{n}",
gpu_type="A10G"
)
```

## Shadow Deployment

### Deploy with confidence

Test new models in production without risk. Shadow models run alongside your primary model, comparing performance on real traffic before you promote.

### How Shadow Deployment Works

1. **Deploy shadow model**
   - New model version runs in parallel, processing the same inputs as production  
2. **Compare predictions**
   - Both models make predictions, but only primary results are returned to users  
3. **Promote when ready**
   - Once shadow outperforms primary, promote it with a single command

### Live Comparison

| Metric  | Primary | Shadow  |
|---------|---------|---------|
| mAP     | 84.7%   | 89.2%   |
| Precision| 91.0%  | 94.0%   |
| Recall  | 88.0%   | 86.0%   |
| Latency | 45ms    | 52ms    |

- Shadow outperforming on 3/4 metrics

### SHADOW DEPLOYMENT SDK

```python
# Deploy shadow model
deployment.set_shadow_model(
  model_version=new_version
)

# Run shadow prediction
prediction.predict_shadow()
```

```python
# Setup auto-promotion policy
deployment.setup_continuous_deployment(
  promotion_threshold=0.05,
  min_samples=1000
)

deployment.toggle_continuous_deployment(True)
```

## End-to-End

### The complete automation stack

From data collection to model deployment, every step is connected and automated. Full lineage, full visibility.

- Continuous Training
  - Automatic retraining triggered by review thresholds or drift detection
  - Review-based triggers
  - Drift detection
  - GPU auto-provisioning
- Continuous Deployment
  - Safe model promotion with shadow deployment and automated policies
  - Shadow model testing
  - A/B comparison
  - One-click promotion
- Full Observability
  - Monitor every prediction, track every metric, trace every decision
  - Real-time dashboards
  - Anomaly alerts
  - Complete lineage

## Ready to automate your ML lifecycle?

Set up continuous training and deployment in minutes. Let your models improve themselves.
