Module 5 Lesson 6: Versioning and Reproducibility
·AI & LLMs

Module 5 Lesson 6: Versioning and Reproducibility

Creating stable AI systems. How to ensure your custom models remain the same over time.

Versioning and Reproducibility: AI DevOps

As your AI projects grow from "experiments" to "applications," you need a way to manage changes safely. This is where the principles of DevOps meet the world of Local AI.

1. The Problem with latest (Again)

We mentioned this in Module 3, but it’s even more critical for custom models. If you have an app that calls my-bot, and you update the Modelfile and run ollama create my-bot again, the behavior of your app will change instantly.

If the new version has a "bug" (e.g., it stops outputting JSON), your whole application breaks.


2. Using Custom Tags

Just like developers use version numbers (v1.0.0), you should tag your custom models.

Workflow:

  1. ollama create my-bot:v1.0 -f Modelfile
  2. (Later, after changes)
  3. ollama create my-bot:v1.1 -f Modelfile

In your Python/JS code, you call my-bot:v1.0. This ensures that even if you experiment with v1.1, the "Production" version of your app stays stable and predictable.


3. Treating the Modelfile as Source Code

The Golden Rule of AI Engineering:

Never create a model using the ollama run environment commands. Always use a Modelfile.

Why?

  • Version Control (Git): Put your Modelfile in a Git repository. You can see exactly what changed in the SYSTEM prompt 3 months ago.
  • Collaboration: You can share the Modelfile with a teammate. They can run ollama create and have the exact same bot you do, without you having to upload a 5GB file to them.

4. The blob and the Digests

When you run ollama show [model] --modelfile, you will see something called a sha256 digest. This is a unique "Fingerprint" of the model. If the fingerprint is the same, the model is identical. This is the ultimate test for reproducibility.


Summary Checklist for AI stability

  1. Git: Is my Modelfile in a repository?
  2. Naming: Am I using version tags (e.g., :v1) instead of :latest?
  3. Documentation: Does my Modelfile include a comment explaining its purpose?
  4. Testing: Before updating a "Production" tag, have I tested the new logic?

Key Takeaways

  • Reproducibility is achieved by treating Modelfiles as source code.
  • Use Version Tags to manage updates without breaking existing applications.
  • Git is the best place to store and track changes to your AI's behavior.
  • A Modelfile is a "Recipe" that anyone can use to recreate your model.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn