You've trained a model. It works. You push it to production.
Three weeks later, something breaks. Users are complaining. You need to roll back. But wait — which version was in production? Where's the checkpoint from two weeks ago? Who fine-tuned it last? What dataset was it trained on?
If you can't answer these questions in 30 seconds, you don't have MLOps. You have chaos.
This is why model registries exist. They're version control for your AI models — the same way Git tracks your code, a model registry tracks your models, their lineage, their metadata, and their deployment status.
Why You Can't Just Use Git for Models
First question everyone asks: "Why not just commit models to Git?"
Because models aren't code. A LoRA adapter is 100MB. A full fine-tuned 7B model is 14GB. A 70B model is 140GB. Git was designed for text files that change line-by-line, not multi-gigabyte binary blobs.
What Code (Git) Models (Registry)
Size KBs-MBs MBs-hundreds of GBs
Format Text files Binary (safetensors, GGUF, ONNX)
Diffing Line-by-line Impossible (binary)
| Metadata | Commit messages | Training config, metrics, dataset info, hardware used |
|---|---|---|
| Lifecycle | Branch → merge | Staging → production → archived |
| Consumers | Developers | Inference servers, pipelines, other models |
You need something purpose-built. Enter model registries.
The Three Big Registries
- HuggingFace Hub — The NPM of AI
If you've downloaded any open-source model in the last two years, you've used HuggingFace Hub. It's the default community registry.
python
from transformers import AutoModelForCausalLM, AutoTokenizer
One line to download any model
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")What makes it great:
Model cards — standardized documentation for every model (more on this below)
Spaces — free hosted demos so you can try before you download
Datasets — not just models, but training data too
Quantized variants — community members upload GGUF, AWQ, GPTQ versions
Git LFS under the hood — it IS Git, but with Large File Storage handling the binaries
What it's missing for production:
No built-in deployment lifecycle (staging → production)
No A/B test tracking
Limited access control for enterprise teams
It's a public registry first, private second
HuggingFace Hub is where you discover and distribute models. It's not where you manage your production model lifecycle.
- MLflow Model Registry — The Enterprise Standard
MLflow is the enterprise answer. It tracks experiments, logs metrics, and manages model lifecycle — all in one platform.
python
import mlflow
Log a model with all its metadata
with mlflow.start_run():
mlflow.log_param("base_model", "llama-3.1-8b")
mlflow.log_param("dataset", "customer-support-v3")
mlflow.log_param("lora_rank", 16)
mlflow.log_metric("eval_loss", 0.42)
mlflow.log_metric("mmlu_score", 0.71)# Register the model
mlflow.transformers.log_model(
model,
"customer-support-model",
registered_model_name="cs-assistant-v2"
)Now you can promote it through stages:
python
from mlflow import MlflowClient
client = MlflowClient()Move from staging to production
client.transition_model_version_stage(
name="cs-assistant-v2",
version=3,
stage="Production")
Roll back to previous version
client.transition_model_version_stage(
name="cs-assistant-v2",
version=2,
stage="Production")
MLflow tracks the full lineage:
Which dataset was used
What hyperparameters were set
Training metrics at every step
Who trained it and when
Which version is in production RIGHT NOW
- Weights & Biases (W&B) — The Experiment Tracker That Grew Up
W&B started as an experiment tracker — beautiful charts, real-time training dashboards. Then they added model management.
python
import wandb
run = wandb.init(project="customer-support-llm")Log model as an artifact
artifact = wandb.Artifact("cs-model-v2", type="model")artifact.add_dir("./model_checkpoint/")
Add metadata
artifact.metadata = {
"base_model": "llama-3.1-8b",
"eval_loss": 0.42,
"training_hours": 4.5,
"gpu": "A100-80GB"}
run.log_artifact(artifact)
W&B gives you the best visualization — training curves, metric comparisons, hyperparameter sweeps. If you care about understanding WHY a model performs the way it does, W&B is excellent.
🔧
Model Cards: The README for AI Models
A model card is a standardized document that describes a model. Think of it as a nutritional label for AI.
Every model on HuggingFace has one (or should). Here's what a good model card includes:
markdown
Model Card: Customer Support Assistant v2
Model Details
- Base model: Llama 3.1 8B Instruct
- Fine-tuning: QLoRA, rank 16, alpha 32
- Training data: 50K customer support conversations (anonymized)
- Training compute: 1x A100 80GB, 4.5 hours
Intended Use
- Customer support chatbot for e-commerce
- NOT for medical, legal, or financial advice
Performance
BenchmarkScore Task accuracy87.3% Hallucination rate4.2% Response relevance91.5%
Limitations
- English only
- May hallucinate product details not in context
- Not tested on multilingual queries
Ethical Considerations
- Trained on anonymized data only
- May reflect biases in customer support patterns
- Regular bias audits scheduled quarterly
Why model cards matter:
They prevent "mystery model in production" situations
They document limitations BEFORE something goes wrong
They're becoming a regulatory requirement (EU AI Act)
They help new team members understand what's deployed
📊
Building Your Own Registry Workflow
Here's a practical workflow for a team shipping AI products:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Experiment │────▶│ Staging │────▶│ Production │
│ (MLflow) │ │ (Registry) │ │ (Serving) │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │Log metrics Run eval suite Monitor metrics
Save checkpoints Compare to prod Track drift
Track datasets A/B test Alert on degradation
Step 1: Experiment tracking Every training run gets logged — parameters, metrics, artifacts. No exceptions.
Step 2: Registration When a model passes your eval threshold, register it with a version number and model card.
Step 3: Staging Deploy to a staging environment. Run your full eval suite. Compare against the current production model.
Step 4: Promotion If staging metrics beat production, promote. Keep the old version tagged for instant rollback.
Step 5: Monitoring Track production metrics. If quality degrades, roll back with one command.
Comparing the Options
Feature HuggingFace Hub MLflow W&B
Best for Distribution Lifecycle management Experiment tracking
| Hosting | Cloud (free tier) | Self-hosted or cloud | Cloud |
|---|---|---|---|
| Model cards | ✅ Built-in | ⚠️ Manual | ⚠️ Manual |
| Lifecycle stages | ❌ | ✅ (Staging → Prod) | ⚠️ Limited |
| Experiment tracking | ❌ | ✅ | ✅✅ (best-in-class) |
| Visualization | ⚠️ Basic | ✅ Good | ✅✅ Excellent |
| Cost | Free / $9/mo | Free (OSS) | Free tier / $50+/mo |
| Integration | Transformers, diffusers | Any framework | Any framework |
My recommendation: Use HuggingFace for distribution and community models. Use MLflow for internal model lifecycle. Use W&B if experiment visualization is your priority.
Most serious teams use a combination: W&B or MLflow for tracking + HuggingFace for distribution.
Practical Takeaways
A model without a registry is a ticking time bomb — you WILL need to roll back, and you WILL need to know which version is running
Model cards aren't optional — document your models like you document your APIs
HuggingFace Hub for sharing, MLflow for lifecycle — they solve different problems
Track everything during training — you can't retroactively add metadata to a checkpoint
Version your datasets too — a model is only reproducible if you know what data trained it
Automate promotion — manual "let me copy this model to the server" doesn't scale
🔬
What's Next?
Episode 86: CI/CD for AI — You've got your models versioned. Now how do you automatically test, deploy, and roll them back? We'll build an actual GitHub Actions pipeline that evaluates a model, compares it to production, and deploys if it passes — no human in the loop.
← Previous
Ep 84: AI Gateway Architecture
Next →
Ep 86: CI/CD for AI
Next: Episode 86 — CI/CD for AI
You wouldn't deploy code without tests or skip staging. Why are you doing it with AI models?
This is part of a 98-episode series covering AI engineering from tokens to production deployment.