Champion and challenger: how a new model earns production traffic
Good offline metrics are a hypothesis, not a promotion.
The problem
Every retrain of the LightGBM ranking model produces a new candidate. It scored well on a held-out set — but a held-out set is a fixed snapshot, and production traffic is not. Promoting a model straight from “training finished” to “serving every home feed request” means the first time it meets real, adversarial, drifting traffic is also the first time anyone finds out whether it actually works.
Approaches considered
Auto-promote on training completion. Whatever comes out of the training job becomes the active model immediately. Fastest iteration loop, and the one with no safety net if a training run degraded quietly — a broken feature materialization can still produce a model that trains cleanly and scores plausibly.
Manual review before promotion. A person checks the metrics and decides. Adds a judgment call, but doesn’t scale past occasional retrains and depends on someone remembering to look.
Champion/challenger with an automated promotion gate. Every retrain produces a challenger. It’s evaluated against fixed thresholds and dataset quality checks; only a challenger that clears the gate becomes the new champion.
Trade-offs
The gate means a genuinely better model can sit as a challenger for a cycle if a dataset quality check false-positives, and it means maintaining two sets of thresholds (metric quality and dataset quality) that both need tuning as the system evolves. It’s slower than trusting the training job outright.
The decision
Every retrain is tracked as a challenger in MLflow, gated on minimum AUC and NDCG@20 against held-out data plus dataset quality checks, before it can become the champion.
Why
The cost of a bad promotion — a subtly worse ranking model degrading every user’s home feed until someone notices — is much higher than the cost of a delayed promotion. A gate that’s occasionally too conservative is a cheap failure mode; a gate that’s too permissive is not. MLflow tracking both models by version is what makes the eventual swap a pointer flip instead of a redeploy, and what makes rolling back just as fast as promoting.
Implementation
# ml-service — evaluate a freshly trained challenger against the
# current champion, and only promote if it clears every gate.
def evaluate_and_promote(challenger_run_id: str):
challenger = mlflow.lightgbm.load_model(f"runs:/{challenger_run_id}/model")
metrics = mlflow.get_run(challenger_run_id).data.metrics
dataset_ok = check_dataset_quality(challenger_run_id)
metrics_ok = (
metrics["auc"] >= PROMOTION_THRESHOLDS["min_auc"]
and metrics["ndcg_at_20"] >= PROMOTION_THRESHOLDS["min_ndcg_20"]
)
if not (dataset_ok and metrics_ok):
mlflow.set_tag(challenger_run_id, "promotion_status", "rejected")
return False
client = mlflow.tracking.MlflowClient()
client.transition_model_version_stage(
name="home-feed-ranker",
version=challenger_run_id,
stage="Production",
archive_existing_versions=True,
)
return True
# The scoring service reloads its pointer on promotion — no
# restart, and the previous champion stays one flip away.
def reload_champion(self):
latest = mlflow.tracking.MlflowClient().get_latest_versions(
"home-feed-ranker", stages=["Production"]
)[0]
self.champion_model = mlflow.lightgbm.load_model(latest.source)