Model Versioning
Track changes to models, prompts, datasets, and evaluation results.
Machine-learning systems evolve through new data, labels, features, algorithms, parameters, runtimes, prompts, and product requirements. Model versioning gives each meaningful artifact an immutable identity and connects it to the exact inputs, evaluations, and deployments needed to understand its behavior.
What Is Model Versioning?
Model versioning is the practice of assigning a unique identity to each registered model artifact and recording its lineage, compatibility, evaluation, lifecycle status, and deployment history. A new artifact or behaviorally meaningful model change creates a new version instead of overwriting an existing one.
A model version is not only a filename or marketing label. It must resolve to exact immutable content and enough metadata to load, evaluate, deploy, monitor, and investigate that content safely.
Why Versioning Matters
- Identifies the exact model serving each prediction or batch result.
- Makes candidate comparisons meaningful and repeatable.
- Links observed regressions to model, data, code, features, and configuration changes.
- Supports staged release, rollback, incident response, and output reconciliation.
- Prevents accidental replacement of approved production artifacts.
- Enables collaboration across training, evaluation, platform, product, and governance teams.
- Creates lifecycle history for audit, security review, retention, and retirement.
Version the Whole Behavioral System
| Component | Why It Affects Behavior |
|---|---|
| Model weights or parameters | Contain learned behavior |
| Training dataset and split | Determine examples, labels, and evaluation boundaries |
| Feature and preprocessing logic | Define the inputs the model actually sees |
| Algorithm and hyperparameters | Control training and model structure |
| Tokenizer, vocabulary, label map, and calibration | Change encoding and interpretation |
| Source code and dependencies | Implement training and inference behavior |
| Runtime and hardware | Can affect compatibility, precision, and performance |
| Thresholds and business policy | Convert scores into product actions |
| Prompt, tools, and retrieval data | Define generative-AI behavior and knowledge |
| Evaluation suite | Defines how quality and safety were measured |
Model Version vs Release Version
| Identifier | Represents |
|---|---|
| Training run ID | One execution of a training pipeline |
| Model version | One immutable registered model artifact |
| Application version | One release of serving code and API behavior |
| Configuration version | Feature flags, thresholds, and environment settings |
| AI release version | Compatible model, prompt, retrieval, tools, policy, and API bundle |
| Deployment revision | What was released to a specific environment and traffic allocation |
Keep these identities distinct and record their relationships. The same model can be served by several application releases, and one application release can support several model versions.
Immutable Identity
Use a registry-generated version or globally unique identifier plus an artifact checksum. Human-readable aliases such as champion or production are useful pointers, but they are mutable and must not replace the immutable version in logs, releases, or audit records.
{
"model_name": "support-classifier",
"model_version": "17",
"artifact_sha256": "<approved-checksum>",
"aliases": ["candidate"],
"training_run_id": "run_8f31",
"source_commit": "a1b2c3d",
"dataset_version": "tickets-2026-07",
"evaluation_suite": "ticket-eval-v6"
}How Model Versioning Works
Versioned code, data, features, and config
-> Reproducible training run
-> Produce artifact and checksum
-> Evaluate against fixed suite and production baseline
-> Register immutable model version with lineage
-> Approve for a defined environment and use
-> Deploy with compatible serving image and config
-> Attach version to telemetry and outcomes
-> Promote, roll back, supersede, archive, or retireMetadata for Every Version
| Category | Metadata |
|---|---|
| Identity | Name, registry version, artifact URI, checksum, format, size |
| Purpose | Owner, intended use, prohibited use, users, risk level |
| Lineage | Run ID, Git commit, dataset, split, features, parameters, environment |
| Evaluation | Metrics, slices, calibration, robustness, fairness, safety, latency, cost |
| Compatibility | Input and output schema, preprocessing, runtime, hardware, serving versions |
| Lifecycle | Candidate, approved, deployed, superseded, archived, or retired |
| Deployment | Environment, image digest, configuration, traffic, time, rollback target |
| Operations | Monitoring links, incidents, drift, overrides, review and expiration dates |
Version Numbering Strategies
| Strategy | Advantage | Caution |
|---|---|---|
| Registry sequence | Simple unique version assigned automatically | Does not describe compatibility by itself |
| Semantic version | Can communicate intended breaking, feature, and patch changes | ML quality changes do not always fit semantic rules |
| Timestamp | Sorts chronologically | Concurrent runs and repeated builds need more identity |
| Content hash | Tied to exact artifact bytes | Not human-friendly for discussion |
| Run ID | Links directly to experiment execution | A run may produce several artifacts |
| Composite | Combines release, run, and digest references | Requires consistent automation and documentation |
The registry version and content digest should provide uniqueness. Use human-readable release labels for communication, not as the only identity.
When to Create a New Version
- Model weights or serialized artifact bytes change.
- Training data, labels, sampling, or splits change.
- Features, preprocessing, tokenizer, vocabulary, or calibration change.
- Algorithm, architecture, hyperparameters, objective, or randomness changes the artifact.
- Compression, quantization, conversion, or optimization produces a new artifact.
- A bug fix changes inference behavior.
- A prompt, retrieval corpus, tool schema, or provider model changes a logical AI release.
A metadata typo may be corrected through an audited metadata revision if policy permits, but the model artifact itself should remain immutable.
Example Version History
| Version | Change | Macro F1 | P95 Latency | Status |
|---|---|---|---|---|
| 15 | Initial approved transformer | 0.90 | 78 ms | Production champion |
| 16 | Larger architecture | 0.93 | 420 ms | Rejected for online use |
| 17 | New labels and calibration | 0.92 | 84 ms | Canary candidate |
| 18 | Quantized edge artifact | 0.91 | 38 ms | Approved for edge only |
The best version is contextual. Version 16 has the highest F1 but misses the online latency requirement; version 18 may be best for constrained hardware.
Compare Versions Correctly
- Use the same versioned evaluation dataset, scoring code, and metric definitions.
- Compare against both a simple baseline and the current production champion.
- Evaluate important slices, rare classes, robustness, calibration, fairness, and safety.
- Measure latency, throughput, memory, accelerator use, startup, and cost on target hardware.
- Report uncertainty and avoid choosing a winner from insignificant or noisy differences.
- Declare acceptance and regression thresholds before seeing candidate results.
Compatibility
| Compatibility Boundary | Question |
|---|---|
| Input schema | Does the model accept the fields, shapes, categories, and units produced in serving? |
| Preprocessing | Is the exact compatible feature or tokenizer version available? |
| Output schema | Can the application interpret scores, labels, embeddings, and null behavior? |
| Runtime | Are library, language, and serialization versions supported? |
| Hardware | Does the artifact run with the target CPU, GPU, accelerator, and precision? |
| Business policy | Are thresholds and actions valid for this model's calibration and classes? |
| Data contract | Can old and new versions coexist during rolling deployment and replay? |
Version Preprocessing with the Model
Training-serving skew occurs when production uses different transformations from training. Package preprocessing into the model pipeline when suitable or version and test it as a required compatibility dependency. Never load a model with whichever feature code happens to be on the server.
Model Registry and Artifact Store
The artifact store holds large files; the model registry manages identity, lineage, lifecycle, approval, and deployment relationships. Source control manages code and text-based definitions. Together they provide a reproducible chain rather than forcing Git to store model binaries.
Promotion Is Separate from Version Creation
Creating version 19 does not make it newer in a quality or governance sense than version 18. Registration creates a candidate identity; evaluation and approval determine whether that version is eligible for a particular use or environment.
Registered candidate 19
-> Validate lineage and artifact integrity
-> Pass quality, slice, robustness, safety, latency, and cost gates
-> Verify serving compatibility
-> Approve for shadow
-> Observe production-like traffic
-> Approve limited canary
-> Promote alias only if guardrails passAliases and Traffic
Aliases such as champion, candidate, shadow, or edge can point to versions, but deployment records should resolve and store the exact target. Changing an alias should be authorized, audited, and reflected in the release process rather than silently changing running behavior.
Deployment Traceability
{
"deployment_id": "deploy_20260720_04",
"environment": "production-ap-south",
"api_version": "1.4.0",
"serving_image_digest": "sha256:<image-digest>",
"model_name": "support-classifier",
"model_version": "17",
"model_artifact_sha256": "<model-checksum>",
"feature_schema": "ticket-features-v4",
"traffic_percent": 10,
"rollback_model_version": "15"
}Expose Versions in Telemetry
- Include immutable model and serving versions in structured logs, metrics, and traces.
- Attach version metadata to batch output and prediction records when appropriate.
- Segment latency, errors, prediction distributions, quality, and cost by version.
- Connect feedback and ground-truth labels to the version that produced the prediction.
- Avoid high-cardinality raw artifact hashes in metric labels if the monitoring system cannot handle them; keep detailed identity in logs and traces.
Rollback
Versioning makes prior artifacts available, but rollback must restore a compatible combination of model, preprocessing, serving code, configuration, features, and infrastructure. It must also address outputs already produced by the bad version.
Guardrail breach on version 17
-> Halt rollout and disable harmful actions
-> Route traffic to model 15 with its compatible serving release
-> Verify readiness and synthetic predictions
-> Monitor recovery
-> Identify predictions and business actions produced by version 17
-> Reprocess, correct, or notify according to policy
-> Record incident and supersede or reject version 17Reproducibility
A version should be traceable to the code, data, environment, and configuration that produced it. Byte-for-byte retraining may be impossible with nondeterministic hardware or algorithms, but teams should be able to explain and closely reproduce the process and verify the stored artifact's integrity.
Versioning Converted and Optimized Models
Exporting to ONNX, quantizing, pruning, compiling, or converting precision creates a new artifact with possibly different quality and hardware behavior. Version, checksum, test, and approve it separately, even if it originated from the same training run.
Branches and Variants
| Variant | Example Requirement |
|---|---|
| Regional | Different language, policy, or data distribution |
| Tenant-specific | Approved customization for one customer |
| Hardware-specific | CPU, GPU, mobile, or edge artifact |
| Risk-tier | High-sensitivity model with stricter thresholds |
| Batch vs online | Throughput-optimized and latency-optimized versions |
| Experimental | Shadow challenger not eligible for user-facing actions |
Use names and metadata that make intended context explicit. Do not compare or deploy variants as interchangeable when their contracts, data, or policies differ.
Versioning Generative AI Systems
When a third party hosts the model weights, version the logical system release. Its behavior depends on the provider model identifier, system prompt, examples, output schema, tools, retrieval index, chunking, safety policy, temperature, and application logic.
ai_release: support-assistant-12
provider_model: approved-provider-model-id
prompt_bundle: support-prompts-v8
output_schema: support-response-v4
tool_schema: support-tools-v3
retrieval_index: support-kb-2026-07-20
chunking_config: support-chunking-v5
safety_policy: support-policy-v6
evaluation_suite: support-assistant-eval-v10
serving_app: support-api-1.9.0Provider Model Changes
If a provider updates an alias or retires a model, behavior can change without a repository commit. Prefer fixed provider identifiers where available, monitor provider notices, rerun evaluations before migration, and record the actual model returned with each release and request when supported.
Security and Integrity
- Verify artifact checksums and provenance before registration, transfer, and loading.
- Restrict who can upload, approve, alias, deploy, archive, or delete versions.
- Treat unsafe serialization formats as potential code execution.
- Scan model packages, dependencies, and serving images.
- Use approved artifact storage, encryption, network controls, and workload identity.
- Prevent training jobs and serving workloads from mutating registered versions.
- Audit unusual downloads, promotions, deletions, and metadata changes.
Governance
- Assign a business owner, technical owner, intended use, prohibited use, and risk level to each deployable line.
- Record data rights, privacy limits, evaluation evidence, known failure modes, and human oversight.
- Set review and expiration dates so old approvals do not last indefinitely.
- Preserve approval, deployment, incident, override, and retirement history.
- Require independent or cross-functional review for high-impact versions.
- Link version records to model cards or equivalent documentation.
Retention and Cleanup
- Retain current production and tested rollback versions for the required period.
- Keep artifacts needed for audit, incident, legal, or reproducibility requirements.
- Archive failed and stale candidates with a reason or remove them under policy.
- Avoid deleting shared dependencies still referenced by releases.
- Track storage cost and large duplicate artifacts.
- Retire model endpoints, credentials, monitoring, and traffic before deleting artifacts.
Versioning Metrics
| Area | Metric |
|---|---|
| Inventory | Versions by owner, state, risk, and age |
| Flow | Time from training to registration, approval, and production |
| Quality | Promotion, rejection, regression, and rollback rates |
| Reproducibility | Versions with complete lineage and successful load tests |
| Compatibility | Failed serving, schema, runtime, and hardware checks |
| Governance | Expired approvals, missing documentation, overdue reviews |
| Operations | Incidents and customer impact by model version |
| Cost | Artifact storage, evaluation, deployment, and inference by version |
Common Mistakes
| Mistake | Better Practice |
|---|---|
| Use model_final filenames | Register immutable versions with checksums |
| Version only weights | Version data, features, code, schema, runtime, evaluation, and policy |
| Overwrite a production artifact | Create a new version and preserve prior rollback target |
| Use latest in deployment | Resolve an approved immutable version before release |
| Promote highest accuracy | Apply context-specific multidimensional gates |
| Ignore converted artifacts | Version and test every quantized, compiled, or exported model |
| Log no model version | Attach version to predictions and telemetry |
| Assume rollback is file replacement | Restore compatible system bundle and reconcile outputs |
Practical Exercise
- Train three candidates with different data, parameters, or algorithms.
- Assign immutable registry versions and artifact checksums.
- Record code, data, feature, environment, and evaluation lineage.
- Compare candidates on quality, slices, latency, memory, and cost.
- Reject one candidate, approve one for online canary, and approve one only for edge use.
- Deploy a candidate with a compatible serving image and attach versions to logs and outputs.
- Simulate a regression and roll back the full compatible release.
- Archive or retain artifacts according to a documented policy.
Version Record Checklist
[ ] Unique immutable model version and checksum
[ ] Training run, source commit, dataset, split, and feature versions
[ ] Algorithm, parameters, runtime, dependencies, and hardware
[ ] Input, output, preprocessing, tokenizer, labels, and calibration
[ ] Evaluation suite, metrics, slices, robustness, safety, latency, and cost
[ ] Intended use, limits, owner, risk, approval, and expiration
[ ] Serving image, configuration, deployment, traffic, and rollback target
[ ] Monitoring, feedback, incidents, retention, and retirement stateBest Practices
- Use immutable registry versions and content hashes rather than filenames or mutable tags.
- Version the complete behavioral system, including data, features, code, schemas, runtime, thresholds, and AI components.
- Record enough lineage and compatibility metadata to reproduce, load, evaluate, and explain every version.
- Separate registration from evaluation, approval, deployment, and alias movement.
- Compare versions under consistent tests and target production constraints.
- Attach exact versions to deployments, predictions, logs, metrics, feedback, and incidents.
- Test full-system rollback and reconcile outputs already produced.
- Apply least privilege, integrity verification, retention, review, and retirement governance.