Knowing Which Model Produced an Answer
A result needs a link to the model, preparation, data, and code that produced it. Version the prediction procedure so comparisons and rollbacks are meaningful.
13 sections · 4 questions · 2 coding challenges
The arrow keys move between sections too.
Preserving the Dependencies of a Prediction
BOTIE
Versioning is a software-engineering response to that practical problem. Our exercise uses immutable example manifests and comparison fixtures; it does not claim that a filename or checksum alone documents the whole experiment.
Sources for this history
Which Set of Weights Answered Yesterday’s Request?
Botie replaces a model and later receives a report about an incorrect prediction. The current model behaves differently, and the original files were overwritten.
To investigate the report, we need the exact version that made the prediction. Save each version's fitted state and a manifest describing its inputs and origin. Keep a reference to the version used for each prediction so we can reproduce the calculation or restore an earlier compatible procedure.
The supplied predictions illustrate a regression check on fixed test inputs.
Step 1 of 3
Keep two distinct artifacts
Do not overwrite the old state.
| Feature coefficient | Version A weights | Version B weights |
|---|---|---|
| Feature 1 | 2 | 1 |
| Feature 2 | -1 | 1 |
Feature 1
- Version A weights
- 2
- Version B weights
- 1
Feature 2
- Version A weights
- -1
- Version B weights
- 1
Step 2 of 3
Run the same fixture
A fixed input makes behaviour comparable.
| Fixture | Feature 1 | Feature 2 | Bias |
|---|---|---|---|
| Shared input | 3 | 2 | 0 |
Shared input
- Feature 1
- 3
- Feature 2
- 2
- Bias
- 0
Step 3 of 3
Attach identity to the difference
The changed answer can be traced to its state.
Version A = (3 × 2) + (2 × −1) = 4 Version B = (3 × 1) + (2 × 1) = 5
A version comparison needs preserved state and shared inputs
A shared fixture set makes behavioural changes measurable.
Which answers changed between the two saved versions?
Both versions saw the same ordered fixtures. Change a prediction and inspect the largest difference before deciding whether the behavioural change is acceptable.
BOTIE
Largest prediction difference across the fixtures
0.5
Follow the operations
1. Candidate fixture predictions
- 05
- 12
2. Current-version fixture predictions
- 04
- 12
3. Subtract
- 01
- 10
4. Square
- 01
- 10
5. Mean
0.5
6. Result
0.5
This is prediction change, not prediction error. It cannot choose the better model without a task criterion.
1. Distinguish a Name From Content
A human-readable version can identify a release, but a mutable file with that name can still change. A content hash detects byte changes in the serialized artifact.
A hash is not proof that the artifact is correct, safe, or from an authorised source. Provenance and integrity solve related but different questions.
Canonical serialisation makes equivalent manifest content hash consistently in this exercise.
2. Record the Whole Procedure
A manifest can include feature schema version, preprocessing artifact, model artifact, training-data snapshot identifier, code revision, dependencies, seed, and evaluation results. Use references appropriate to the data’s privacy requirements rather than dumping training records into logs.
The manifest should distinguish the current candidate from the currently served version. Promotion changes which version is active without destroying prior artifacts.
A saved weight vector without its preparation and feature schema is an incomplete release.
3. Compare Versions on the Same Fixtures
Run candidate and current procedures on a fixed fixture set and compare predictions, validation metrics, numerical finiteness, and interface compatibility. A changed prediction is not automatically an improvement or a bug.
Track why the change was intended and inspect important boundary cases. A schema-incompatible artifact should not be promoted behind an unchanged request contract.
Fixture x = [3,2]
Version A: dot(x,[2,-1]) = 4
Version B: dot(x,[1,1]) = 5
Prediction difference B-A = 1The numerical comparison needs labels or another criterion before choosing the better version.
Compare the answers on preserved fixtures
Both versions have already predicted the same three inputs in the same order. Retain the signed differences as well as their largest size.
import numpy as np
old_predictions = np.array([1., 2., 3.])
new_predictions = np.array([1., 2.5, 2.])
change = new_predictions - old_predictions
print(change.tolist())
print(float(np.abs(change).max()))[0.0, 0.5, -1.0]
1.0The largest change is on the third fixture and it is a decrease. Practice starts with the preserved model states and computes the predictions for both versions.
4. Retain a Reproducible Rollback Target
Keep the previous model together with its compatible preprocessing and runtime requirements. Reverting weights while keeping new preparation may create a third, untested procedure.
Record the active model identifier with predictions and monitoring summaries. Retention and access controls should reflect the sensitivity of any associated data.
The workshop compares version outputs; rollout and rollback decisions require the surrounding operational checks.
5. A New Weight File May Need a New Input Contract
Changing feature order, category vocabulary or target units can make a model incompatible with an earlier caller even when its array shape stays the same. Version the whole fitted procedure and its contract together.
A release manifest should identify the artifact, training data snapshot or reproducible reference, code version, dependencies, evaluation report and intended use. A human-friendly version name helps discussion; a content hash helps identify the exact bytes.
6. Compare Releases on Preserved Requests
A new model may legitimately change predictions. The comparison should make those changes visible and check both expected improvements and unacceptable regressions.
Use fixtures with normal inputs, boundary values and known failure cases. Compare target units and preprocessing before comparing numerical differences.
Report prediction changes without calling every change a bug
Both versions predict the same quantity on the same three requests.
import numpy as np
old = np.array([10.,20.,30.])
new = np.array([10.5,19.,36.])
change = new-old
print(change.tolist())
print(np.flatnonzero(np.abs(change) > 2).tolist())[0.5, -1.0, 6.0]
[2]The final fixture exceeds the declared review threshold. Investigation still needs the input and eventual outcome; a large change alone does not say which version is better.
7. Keep Earlier Releases Loadable
Do not overwrite the previous artifact when a candidate passes offline evaluation. Store releases immutably and change a separate active-version reference. Rollback then selects a known artifact rather than trying to recreate yesterday's model from memory.
Test that the earlier runtime and preprocessing still load correctly. A retained weight file is not a usable rollback if its dependencies or input contract have been removed.
Check yourself
Questions on Parts 1 to 7
Question 1 of 4
What has been lost without another copy?
Use the information below.
A model filename stays the same but its contents are overwritten.Try it with Botie
Build with Botie
Write and run Python