A model update can change a system’s behavior even when its API looks unchanged. Model versioning assigns distinct identifiers to revisions and lets a caller request a specific version during initialization. Updating a model without changing its version can silently change results. section 13.1
Listing 13.3 Adding a model version to the API
class Model:
def __init__(self, version):
self.version = version
self.model = load_model(version)
def predict(self, features, time=None, seed=42):
if time is None:
time = datetime.now()
return self.model.predict(features, time, seed)
The model is loaded using the version requested when the object is initialized. section 13.1
Versioning the model alone may not preserve compatibility. Changes to input or output data, preprocessing, postprocessing, or dependencies can also change results. Even a Python version update can produce different outputs while everything else stays fixed. section 13.1
Features need versioning too. If a feature’s calculation or data source changes, values calculated before and after the update may differ and should not be mixed. Treating every update as a new feature avoids ambiguity but can clutter the code with near-duplicates. section 11.4.2
To support reproducibility and safer updates:
- Record feature versions in dataset metadata alongside the features and timestamp range. section 11.4.2
- When a feature changes, overwrite it or write the new version to a separate table and backfill available history. section 11.4.2
- Reflect breaking model changes in the version, and check the rest of the pipeline for compatibility changes. section 13.1


























