Re-running the training job below from the same git commit one month later gives a validation AUC of 0.861 instead of the logged 0.874. The library versions, Docker image and seeds are all pinned. What is the most likely cause, and the fix?
# requirements.txt: scikit-learn==1.4.2, pandas==2.2.1
# image: trainer@sha256:9f1c0a...
SEED = 42
np.random.seed(SEED)
df = bq.query("""
SELECT * FROM prod.transactions
WHERE txn_date < CURRENT_DATE()
""").to_dataframe()
X, y = df[FEATURES], df["is_fraud"]
X_train, X_val, y_train, y_val = train_test_split(X, y, random_state=SEED)
model = GradientBoostingClassifier(random_state=SEED).fit(X_train, y_train)
auc = roc_auc_score(y_val, model.predict_proba(X_val)[:, 1])
mlflow.log_params(model.get_params())
mlflow.log_metric("val_auc", auc)Show the answer and explanation
Correct answer: D, The data is not versioned: CURRENT_DATE() now covers a month of extra rows plus late or backfilled records, so train on a fixed snapshot (date range, table snapshot, DVC).
Explanation MLOps
Reproducibility needs four things pinned: code (git commit), environment (locked dependencies, image digest), randomness (seeds) and data. This job pins the first three, but its query is relative to today. A month later txn_date < CURRENT_DATE() returns a month of extra rows, and the source table may also contain late-arriving or corrected records. The model was trained and validated on a different dataset, so a different AUC is expected.
Fixes:
- Use an explicit, logged date range instead of
CURRENT_DATE(). - Snapshot the training data: a BigQuery table snapshot (time travel only reaches back up to 7 days), a versioned Parquet export, or DVC (git-like versioning of data files backed by cloud storage).
- Add an
ORDER BYon a unique key: BigQuery returns rows in no guaranteed order, and a seededtrain_test_splitonly reproduces the split if the rows arrive in the same order. - Log the dataset version or hash, row count and query text with the run, e.g. as MLflow params or artifacts, so lineage is complete.
Why the other explanations fail: scikit-learn's GradientBoostingClassifier has no multithreaded split search; with its random_state set, as here, it builds the same trees from the same data, and train_test_split is seeded too. sklearn.set_config has no global seed option. MLflow logs metrics as double-precision numbers, and float rounding could never explain a 0.013 gap.
Interview tip: define reproducibility as "same code + same environment + same data + same seeds gives the same model", then name a concrete tool for each: git, lock files and image digests, DVC or warehouse snapshots, and seeds logged in the experiment tracker.