Skip to content
BIASED

Experiments, reproducibility and the model registry

Fit a small model, preserve evaluation evidence and resolve deployment aliases to stable artifacts.

Record the fitted computation

Two files are called model.json. One came from a constant predictor and the other from a fitted line. The newer file has a better evaluation score, but a request log containing only the filename cannot explain which predictor answered yesterday. Experiment tracking preserves the computation; a registry gives the resulting artifact a stable identity for deployment.

We will fit a tiny scalar model using independently specified numbers, record its evidence and move a deployment alias without changing old records. This is a standard-library fixture, not an MLflow integration, an evaluation of a real preview model or a downloaded dataset.

A filename is a location, not an experiment

Overwriting a shared file loses the link between an earlier result and the bytes that produced it. Keeping numbered filenames helps locate artifacts but does not explain training data, feature state or evaluation. A copied file may also keep its name while its contents change.

Assign a run identity to each execution and a content identity to each resulting artifact. They answer different questions. Two independent runs can produce equal bytes; a failed run may produce intermediate files without an accepted model. Keep run status and publication status separate, so a partially completed experiment cannot become the default serving artifact simply because a file exists.

Record the inputs that determine the result

A useful run description identifies code revision, source-data snapshot, split definition, feature state, algorithm configuration, environment and randomness controls. Also identify the evaluation procedure and any acceptance threshold. If a value changes the computation or the interpretation of its score, it belongs in the evidence.

A seed is only one dependency. Data order, nondeterministic kernels, library changes and different hardware can affect a result. Bouthillier and coauthors examine several sources of variation in ML benchmarks; their work motivates reporting the scope of a comparison rather than treating one favourable run as a universal property. Our arithmetic fixture uses no randomness and makes a much narrower reproducibility claim.

The training inputs are (0,1),(1,2),(2,4)(0,1),(1,2),(2,4), where each pair is (x,y)(x,y). The evaluation inputs are (3,5),(4,7)(3,5),(4,7). These are authored scalar pairs, not measurements of learners or an operational service. Their small size lets every fitted coefficient and error be checked by hand.

Compare a constant predictor with an ordinary least-squares line f(x)=wx+bf(x)=wx+b. The training means are xˉ=1\bar x=1 and yˉ=7/3\bar y=7/3. The constant predicts 7/37/3. For the line,

w=∑i(xi−xˉ)(yi−yˉ)∑i(xi−xˉ)2=32,b=yˉ−wxˉ=56.w=\frac{\sum_i(x_i-\bar x)(y_i-\bar y)}{\sum_i(x_i-\bar x)^2}=\frac32, \qquad b=\bar y-w\bar x=\frac56.

This follows by minimizing the sum of squared residuals with respect to slope and intercept; the denominator is nonzero because the training inputs vary. The fixture implements these sums directly. It does not call a model library or reuse a benchmark's reported coefficients.

Keep the evaluation split outside fitting

Keep evaluation evidence beside the artifact

Define MSE as the mean squared prediction error on the identified split. The line has training MSE 1/18≈0.0555561/18\approx0.055556. On evaluation inputs 3 and 4 it predicts 16/316/3 and 41/641/6; the errors are 1/31/3 and −1/6-1/6, giving evaluation MSE 5/72≈0.0694445/72\approx0.069444.

Run Predictor Training MSE Evaluation MSE
constant-v1 7/37/3 14/914/9 130/9130/9
ols-v1 (3/2)x+5/6(3/2)x+5/6 1/181/18 5/725/72

The table is an actual consequence of the stipulated inputs. It does not establish generalization beyond them. Decide the acceptance rule before consulting the evaluation result; for this constructed exercise it requires evaluation MSE at most 0.1. Repeatedly tuning against those same two evaluation points would turn them into development data, no matter what the manifest calls the split.

The original code creates a record containing algorithm name, data identity, fitted parameters and both errors. Its data hash covers the two splits and the split-description string. Hashing a canonical representation of the run record gives a stable identity for this fixture. A real tracker should additionally retain execution timestamps, status, operator/environment and retrievable artifacts rather than assuming one JSON record describes all possible dependencies.

Separate configuration from measurement. A requested learning rate is an input; the observed loss is an output. An intended time limit is a constraint; elapsed time is a measurement. Clear fields prevent a dashboard from confusing what was requested with what happened.

A useful failed run is still evidence. Preserve a permitted minimal failing input, exception and last durable artifact. Mark which metrics were completed. Filling missing scores with zero would make an interrupted run look artificially good for an error metric. Deleting every failed attempt can also hide how much effort or compute was required to obtain the successful result.

The evaluation rows are read only when calculating the second error; they do not enter the coefficient sums. That boundary is easy to inspect here. In a larger pipeline, a preprocessing step fitted on all rows can cross the same boundary even if the estimator itself receives only a training split. A run record needs the provenance of preprocessing as well as the estimator call.

Resolve an alias to an immutable version

A registry connects a stable version to a movable role

Register the constant artifact as version 1 and the line as version 2. Let the alias serving initially resolve to version 1. A request records that resolved version. After the line passes the constructed acceptance rule, move the alias to version 2. The old request still refers to version 1; a new resolution sees version 2.

Object What can change? Evidence to retain
Version 1 Its identity should remain stable Constant model bytes and run record
Version 2 Its identity should remain stable Line coefficients and evaluation
Alias serving May point to another version Change event, decision owner and target
Request record Preserves its resolved version Actual artifact that answered

MLflow's registry documentation distinguishes model versions and aliases with this purpose. The fixture models that distinction using ordinary dictionaries; it does not reproduce the API example or test access-control behaviour of a running registry.

Promotion needs more than a convenient label. Check that the artifact being promoted is exactly the one evaluated, that its required feature schema is available, and that the serving environment can load it. Record authorization for the transition. A mutable alias should not bypass review by silently picking up an unrelated artifact with a familiar name.

Rollback similarly selects an identified compatible version. Restoring an old model without its vocabulary, normalization or decision threshold may not restore the old behaviour. Keep the release bundle and test the complete response path. If a source or environment required by the old version is no longer available, the rollback plan needs another validated route.

Choose a loader with an explicit trust boundary

Packaging defines what a loader may interpret

Our fitted predictor needs two coefficients, the function that consumes them and an input contract. Store the coefficients as finite numbers in JSON and validate the schema before computing. The fixture serializes and reloads them, then verifies identical predictions on the two evaluation inputs. That checks this local round trip, not cross-language bitwise equivalence for every model.

A package for a larger model also needs architecture information, tokenizer or preprocessing state, supported dtypes/shapes, dependencies and output interpretation. A numerically equal weight tensor with a different tokenizer does not define the same application. Hash the actual files rather than a list of intended download names.

Pickle can invoke code while loading

Python's pickle format can reconstruct objects by invoking callable behaviour. Loading an untrusted pickle is therefore an execution trust decision, even before inference starts. The official documentation explicitly warns about arbitrary code execution. A friendly filename or plausible metric does not make an artifact trustworthy.

Keep provenance and access controls on serialized model artifacts. Where a narrower data format suffices, use it and validate size, schema and numeric values. A cryptographic signature can establish who signed particular bytes; it does not prove the signer's program is safe or that the model meets its quality requirement. Our example loads only JSON it created and does not construct or execute a pickle payload.

Distinguish data layout from accepted behavior

Safetensors separates tensors from Python object reconstruction

The safetensors format describes a tensor payload using a length-prefixed JSON header with dtype, shape and data offsets, followed by the tensor bytes. This avoids a format whose purpose includes reconstructing arbitrary Python objects. The official format specification also notes that tensor values can contain NaN or infinities; serialization safety is not numerical validity.

Weights alone do not supply an architecture or an accepted use policy. The application must select compatible model code, constrain resource use and check the resulting computation. Parser vulnerabilities and excessive allocation are separate concerns for any reader of untrusted bytes. No safetensors file or library is downloaded or executed in this fixture; the format discussion is a checked conceptual comparison.

ONNX represents computation through typed operators

ONNX represents a model as a graph with typed inputs, outputs, operator nodes and stored parameters. Operator semantics depend on the declared domain and opset version. A runtime must support the operators and shapes required by the graph; a successful conversion does not establish identical numerical behaviour on every backend.

Compare outputs of the original and exported artifact on permitted representative inputs, with tolerances tied to precision and task. Include boundary shapes and any preprocessing that the graph does not contain. Preserve the converter and runtime versions with the comparison. Our scalar JSON model is not an ONNX export, and we do not claim an export test from merely reading the format documentation.

Keep the scope of reproducibility visible

What changed

The fitted line is tied to exact training/evaluation inputs and measured fixture errors. Moving serving changes future resolution without rewriting the version recorded by an earlier request. The package separates coefficients from executable loader behaviour and makes the scope of the round-trip check explicit.

Limitations

Three training pairs and two evaluation pairs are an arithmetic exercise. There is no meaningful estimate of real-world model capability, stochastic variability or infrastructure resilience. The dictionary registry has no concurrent writers, transactions, permissions or durable service. JSON round-trip equality applies to these local coefficients. No pickle, safetensors or ONNX artifact from another party is loaded.

What to retain

Give executions and artifact contents distinct identities. Preserve data, feature, evaluation and environment dependencies. Keep failures and missing measurements visible. Resolve deployment aliases to stable versions in request evidence. Evaluate the exact package being promoted. Choose a loader according to the trust and interpretation it requires.

Next

Testing ML systems adds checks that an average score cannot capture, including the requirement that irrelevant identifiers do not alter a decision.

References

  • MLflow contributors. Model Registry Workflows, revision 614d987, read 13 November 2026: versions, aliases and logged-run association. No API example or dataset copied.
  • Xavier Bouthillier and coauthors. Accounting for Variance in Machine Learning Benchmarks. MLSys, 2021: sources of benchmark variation. No benchmark results reused.
  • Python Software Foundation. pickle, documentation 3.15.2: loading trust boundary.
  • Safetensors contributors. Format specification, revision 9e6f4d6: tensor layout and numeric-value caveats. No implementation code or tensor asset reused.
  • ONNX contributors. ONNX Concepts, documentation 1.24.0: typed graph and opset semantics. No graph example or model asset copied.

Check your understanding

The same questions as in Pulse. Answers are shared between modes.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Fit a line and preserve the resolved artifactoptional

    Three training and two evaluation pairs are authored scalar inputs. The dictionary registry has no real concurrency, permissions or service. Only locally authored JSON is loaded; no pickle or downloaded model is executed.

    ~20 min · easier on a computer · The corresponding lesson and basic Python functions.

    Self-check in the notebook — not part of mastery or the certificate.

Full notes

Answers are saved on the server and tied to this browser until you sign in.