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

ComponentWhy It Affects Behavior
Model weights or parametersContain learned behavior
Training dataset and splitDetermine examples, labels, and evaluation boundaries
Feature and preprocessing logicDefine the inputs the model actually sees
Algorithm and hyperparametersControl training and model structure
Tokenizer, vocabulary, label map, and calibrationChange encoding and interpretation
Source code and dependenciesImplement training and inference behavior
Runtime and hardwareCan affect compatibility, precision, and performance
Thresholds and business policyConvert scores into product actions
Prompt, tools, and retrieval dataDefine generative-AI behavior and knowledge
Evaluation suiteDefines how quality and safety were measured

Model Version vs Release Version

IdentifierRepresents
Training run IDOne execution of a training pipeline
Model versionOne immutable registered model artifact
Application versionOne release of serving code and API behavior
Configuration versionFeature flags, thresholds, and environment settings
AI release versionCompatible model, prompt, retrieval, tools, policy, and API bundle
Deployment revisionWhat 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.

JSON
{
  "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

Output
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 retire

Metadata for Every Version

CategoryMetadata
IdentityName, registry version, artifact URI, checksum, format, size
PurposeOwner, intended use, prohibited use, users, risk level
LineageRun ID, Git commit, dataset, split, features, parameters, environment
EvaluationMetrics, slices, calibration, robustness, fairness, safety, latency, cost
CompatibilityInput and output schema, preprocessing, runtime, hardware, serving versions
LifecycleCandidate, approved, deployed, superseded, archived, or retired
DeploymentEnvironment, image digest, configuration, traffic, time, rollback target
OperationsMonitoring links, incidents, drift, overrides, review and expiration dates

Version Numbering Strategies

StrategyAdvantageCaution
Registry sequenceSimple unique version assigned automaticallyDoes not describe compatibility by itself
Semantic versionCan communicate intended breaking, feature, and patch changesML quality changes do not always fit semantic rules
TimestampSorts chronologicallyConcurrent runs and repeated builds need more identity
Content hashTied to exact artifact bytesNot human-friendly for discussion
Run IDLinks directly to experiment executionA run may produce several artifacts
CompositeCombines release, run, and digest referencesRequires 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

VersionChangeMacro F1P95 LatencyStatus
15Initial approved transformer0.9078 msProduction champion
16Larger architecture0.93420 msRejected for online use
17New labels and calibration0.9284 msCanary candidate
18Quantized edge artifact0.9138 msApproved 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 BoundaryQuestion
Input schemaDoes the model accept the fields, shapes, categories, and units produced in serving?
PreprocessingIs the exact compatible feature or tokenizer version available?
Output schemaCan the application interpret scores, labels, embeddings, and null behavior?
RuntimeAre library, language, and serialization versions supported?
HardwareDoes the artifact run with the target CPU, GPU, accelerator, and precision?
Business policyAre thresholds and actions valid for this model's calibration and classes?
Data contractCan 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.

Output
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 pass

Aliases 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

JSON
{
  "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.

Output
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 17

Reproducibility

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

VariantExample Requirement
RegionalDifferent language, policy, or data distribution
Tenant-specificApproved customization for one customer
Hardware-specificCPU, GPU, mobile, or edge artifact
Risk-tierHigh-sensitivity model with stricter thresholds
Batch vs onlineThroughput-optimized and latency-optimized versions
ExperimentalShadow 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.

YAML
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.0

Provider 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

AreaMetric
InventoryVersions by owner, state, risk, and age
FlowTime from training to registration, approval, and production
QualityPromotion, rejection, regression, and rollback rates
ReproducibilityVersions with complete lineage and successful load tests
CompatibilityFailed serving, schema, runtime, and hardware checks
GovernanceExpired approvals, missing documentation, overdue reviews
OperationsIncidents and customer impact by model version
CostArtifact storage, evaluation, deployment, and inference by version

Common Mistakes

MistakeBetter Practice
Use model_final filenamesRegister immutable versions with checksums
Version only weightsVersion data, features, code, schema, runtime, evaluation, and policy
Overwrite a production artifactCreate a new version and preserve prior rollback target
Use latest in deploymentResolve an approved immutable version before release
Promote highest accuracyApply context-specific multidimensional gates
Ignore converted artifactsVersion and test every quantized, compiled, or exported model
Log no model versionAttach version to predictions and telemetry
Assume rollback is file replacementRestore 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

Output
[ ] 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 state

Best 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.