chapter nine

9 Managing model evolution, drift, and versioning

 

This chapter covers

  • Versioning models and data with a lightweight JSON registry
  • Detecting four types of model drift using TF-IDF cosine similarity and canary prompts
  • Rolling back to a previous model version when a new deployment fails
  • Monitoring security and abuse patterns with monthly red-team testing
  • Upgrading base models safely without breaking fine-tuned adapters
  • Maintaining and retraining on a sustainable cadence

Half a year into production, your team discovers the fine-tuned IT support model has started producing subtly different outputs. Customer satisfaction scores have dipped 8%. Nobody changed the model, so what happened? The world changed around it: users began asking about a new software platform the model had never seen, the support team updated their ticket categories, and a base-model security patch altered the underlying tokenizer behavior. Your model is the same, but the environment it serves is not.

You have trained a LoRA adapter, run full supervised fine-tuning, distilled a student model from a stronger teacher, and applied preference optimization to sharpen response quality and safety. Your model is ready for production. The hard part is over, or so it seems.

9.1 Model and data versioning

9.1.1 What to version

9.1.2 Our approach: A single JSON file

9.1.3 Running the registry

9.2 Model drift: Understanding and responding

9.2.1 Detection approaches

9.2.2 Embedding-based drift detection

9.2.3 Running the detector

9.2.4 Canary prompts

9.3 Handling failure and rollback

9.3.1 Rollback timeline

9.3.2 Running the rollback demo

9.3.3 Blue-green deployment for LLMs

9.4 Security and abuse monitoring

9.4.1 The red-team prompt suite

9.4.2 Running the safety monitor

9.4.3 When to retrain for safety

9.4.4 Production prompt monitoring

9.5 Base model evolution

9.5.1 When to upgrade (green lights)

9.5.2 When to stay (red lights)

9.5.3 The hidden cost of upgrading

9.5.4 Version locking

9.6 Long-term maintenance practices