Careers Post-AI
AI infrastructure and systems: all chapters

AI infrastructure and systemsPart 5: Production operations

Chapter 20Model deployment pipelines

30 min read, 1 lab, Intermediate

A code change that compiles and passes its tests usually works. A new model can pass every unit test, load cleanly and serve fast while answering 4% worse, and a one-line prompt edit can do the same. This chapter builds the pipeline that catches both: versioned model artifacts, CI that measures behaviour rather than just correctness, and rollouts that promote or roll back on live metrics without a human watching.

After this chapter you can

  • Explain what makes shipping models and prompts different from shipping code
  • Version a model as a full artifact bundle in a registry, with aliases and lineage
  • Design CI gates for models: evals, performance benchmarks and safety checks
  • Choose between shadow, canary, blue-green and A/B rollouts and write promotion and rollback criteria
  • Apply GitOps and progressive delivery to model serving with Argo CD and Argo Rollouts
  • Treat prompts and generation configs as versioned, gated deployments

Shipping models is not shipping code

In ordinary software, behaviour lives in source code, a diff shows what changed, and tests are deterministic pass or fail. A model's behaviour lives in billions of learned numbers, the diff between two checkpoints is unreadable, and quality is a statistic measured on a dataset. The deployment pipeline has to compensate for all three.

ConcernCodeModel
What changedReadable diffOpaque weights; only evals show the change
Test resultPass or failA score with variance, compared with a baseline
Artifact sizeMegabytesGigabytes to terabytes
Failure modeCrash or exceptionSilently worse answers, still HTTP 200
ReproducibilitySame commit, same binaryNeeds data, code, seeds, library versions and hardware notes
Who changes itEngineersEngineers, ML researchers, and prompt authors

The consequence is that evals replace tests as the gate, and the rollout itself becomes part of the testing. Evaluation infrastructure covered how to build the eval suites; this chapter is about wiring them into delivery.

Registries and versioned artifacts

A model registry is the system of record for deployable models: each registered model has numbered versions, metadata, lineage links and named pointers. A model version is not just a weights file. Anything that changes behaviour must be versioned together, or a "rollback" will restore weights while keeping a new tokenizer or prompt.

Registries use aliases (MLflow's term) or stages to say which version plays which role. Serving resolves models:/support-bot@champion rather than a hard-coded version number, so promotion and rollback are a pointer move, not a rebuild.

MLflow 3 registry basics
import mlflow
from mlflow import MlflowClient
 
info = mlflow.sklearn.log_model(model, name="model")          # log artifact to the run
mv = mlflow.register_model(info.model_uri, "topic-clf")         # new version, e.g. 7
client = MlflowClient()
client.set_registered_model_alias("topic-clf", "candidate", mv.version)
client.set_model_version_tag("topic-clf", mv.version, "eval.accuracy", "0.947")
model = mlflow.sklearn.load_model("models:/topic-clf@champion")  # resolve by role

For large language models the weights often live in object storage or a model hub, and the registry stores a reference plus a content hash. Pin by hash, not by a mutable name like "latest". A hosted API model is also an artifact: pin the dated model version the provider exposes, because an alias that points to "the newest" can change behaviour under you.

CI for models

Model CI runs on every candidate: a new checkpoint, a fine-tune, a quantized variant, a serving engine upgrade or a prompt change. Each gate compares the candidate with the current champion on fixed, versioned datasets and produces a pass, a fail or a needs-human-review.

GateMeasuresTypical rule
Quality evalTask accuracy, judge scores, regression suiteNo metric drops more than its noise band versus champion; key slices must not regress
Performance benchmarkTTFT and inter-token latency at target concurrency, throughput, GPU memoryp95 TTFT within 10% of champion at the same load
SafetyRefusal on harmful prompts, jailbreak suite, PII leakageZero critical failures; over-refusal on benign prompts below a set rate
CompatibilityTokenizer, chat template, API schema, structured output parse rateByte-identical template or an explicit migration
CostTokens per answer, cost per request on the eval setWithin budget, or flagged for approval

Two details separate real gates from theatre. First, evals have noise: compute confidence intervals or rerun with several seeds so a 0.3-point dip does not block a release and a 3-point drop always does. Second, gate on slices, not only averages, because a model can improve overall while getting much worse on one language or customer segment.

Packaging models for serving

Packaging decides how weights reach a serving pod. The two common patterns trade image size against startup time and coupling.

Weights baked into the image

  • One immutable artifact: image digest pins everything
  • Simple rollback and provenance
  • Images of many gigabytes; slow pulls and node disk pressure
  • Good for small models and the lab below

Weights pulled at startup

  • Small serving image, weights from object storage or a hub
  • Same image serves many models and versions
  • Startup depends on storage bandwidth; cache on node disk
  • Version pinning moves into config, so pin by hash

A middle path stores weights as their own OCI artifact or image layer that the node caches; KServe calls this pattern Modelcars. Whichever you choose, record the training run ID and weight hash as image labels or config, and sign the image as described in Software supply chain security. The serving image should also pin the serving engine version, because a vLLM upgrade can change output and performance as much as a new checkpoint.

GitOps for model serving

GitOps means the desired state of your clusters lives in a Git repository, and an agent in the cluster continuously reconciles reality to match it. Argo CD and Flux are the widely used open-source agents. A deployment becomes a commit that changes a model version or image tag, which gives you review, audit history and rollback by git revert.

Argo CD applies the manifest; Argo Rollouts replaces the Kubernetes Deployment with a Rollout resource that performs canary or blue-green steps and runs analysis between them. Analysis queries a metrics provider and decides to continue or abort. KServe, a model-serving layer on Kubernetes, has its own canary percentage field; either works, as long as promotion is driven by metrics rather than by a timer.

Rollout strategies

Offline evals predict behaviour on yesterday's data. Rollouts measure it on today's traffic while limiting how many users are exposed to a bad version.

StrategyHow it worksBest forCost
ShadowCopy live requests to the candidate, discard its responses, compare offlineRisky model swaps; measuring latency and judge scores on real traffic with zero user impactDouble inference for mirrored traffic
CanarySend a small share (1 to 20%) to the candidate, widen in steps while metrics holdMost model and serving changesBrief exposure of a few users
Blue-greenStand up the full new version, switch all traffic at once, keep old for instant switch-backServing engine or infrastructure changes needing a clean cutoverDouble capacity during the switch
A/B testSplit users randomly and measure product outcomes over daysDeciding whether a model is better for users, not just safeWeeks of traffic for significance

Canaries answer "is it safe?" and A/B tests answer "is it better?". Use both: canary to 100% if safe, or hold at a 50/50 split while the experiment runs.

Promotion criteria must be written before the rollout starts, as numbers. Compare canary with stable over the same window, because both see the same traffic mix.

analysis-template.yaml (production style, Prometheus provider)
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: llm-canary
spec:
  args:
    - name: canary-hash
  metrics:
    - name: error-rate
      interval: 1m
      count: 10
      failureLimit: 1
      successCondition: result[0] <= 0.02
      provider:
        prometheus:
          address: http://prometheus.monitoring:9090
          query: |
            sum(rate(llm_requests_total{status="error",rollouts_pod_template_hash="{{args.canary-hash}}"}[2m]))
            / sum(rate(llm_requests_total{rollouts_pod_template_hash="{{args.canary-hash}}"}[2m]))
    - name: p95-ttft
      interval: 1m
      count: 10
      failureLimit: 1
      successCondition: result[0] <= 1.5
      provider:
        prometheus:
          address: http://prometheus.monitoring:9090
          query: |
            histogram_quantile(0.95, sum by (le) (rate(
              llm_ttft_seconds_bucket{rollouts_pod_template_hash="{{args.canary-hash}}"}[2m])))

The Rollout passes the canary's pod template hash as the argument, so the queries see only canary pods. Add a quality metric too: a sampled judge score, a thumbs-down rate or a structured-output parse rate on canary traffic.

Prompt and config rollouts

A system prompt, a retrieval setting, a temperature or a tool list changes behaviour as much as new weights, and it changes far more often. Treat each as a versioned artifact with the same gates.

  • Store prompts in version control or a prompt registry, with an ID and version referenced by the service, never pasted inline.
  • Run the eval and safety gates on every prompt change, against the model versions it will run with.
  • Roll out with feature flags or the gateway's traffic split: 5% of users get prompt v42, with the same canary metrics and automatic rollback.
  • Log the prompt version on every request and trace, so a quality incident can be tied to the change that caused it.

Lineage, reproducibility and governance

Lineage is the recorded chain from a production model back to everything that produced it: training data snapshot, code commit, base model, hyperparameters, environment and eval results. When a regulator, customer or incident review asks "why did the model say this?", lineage is how you answer.

RecordWhereWhy
Dataset version and hashData catalog or registry tagRebuild the training set and investigate data issues
Code commit and container digestTraining run metadataRerun the exact training code
Base model and its licenseRegistry metadataLegal review and supply-chain checks
Eval and safety resultsRegistry version tags or attached reportEvidence for the promotion decision
ApprovalsPipeline log or PR reviewWho signed off, when, on what evidence
Deployment historyGitOps repo historyWhat served when, for incident timelines

Governance sign-off is a required human approval before high-risk changes reach users, such as a new base model, a new data source or a change in a regulated use case. Implement it as a protected environment or required PR review in the pipeline, with the eval report attached, so approval is quick and leaves an audit trail. Automate everything except the judgement.

Key terms

Model registry
The system of record for model versions, their metadata, lineage and role aliases.
Alias
A named, movable pointer to a model version, such as champion or candidate.
Eval gate
A pipeline step that blocks a candidate unless its eval scores meet thresholds relative to the champion.
Shadow deployment
Mirroring live traffic to a candidate whose responses are recorded but never returned to users.
Canary
Releasing a version to a small share of traffic and widening only while metrics stay within limits.
Blue-green deployment
Running old and new versions side by side and switching all traffic between them at once.
GitOps
Managing deployments by committing desired state to Git and letting an in-cluster agent reconcile to it.
Lineage
The recorded chain of data, code, configuration and runs that produced a model version.
Lab

Build a model pipeline with an MLflow registry, an eval gate and an auto-rollback canary

Advanced, 120 min

Goal: register models in MLflow, block a bad model with an eval gate, canary a good one on a local Kubernetes cluster with Argo Rollouts, and watch the canary roll back automatically when a serving bug slips past offline evals. Then drive it from GitHub Actions.

You need: Docker, kind, kubectl, the Argo Rollouts kubectl plugin (brew install argoproj/tap/kubectl-argo-rollouts, or the binary from the Argo Rollouts releases page), and Python 3.11 to 3.13. The model is a small scikit-learn text classifier, so everything runs on CPU. The pattern is identical for LLM weights and prompts.

  1. Set up the environment and start the long-lived services:
mkdir model-pipeline && cd model-pipeline
python3 -m venv .venv && . .venv/bin/activate
printf 'mlflow>=3,<4\nscikit-learn==1.6.1\n' > requirements.txt && pip install -r requirements.txt
mlflow server --host 127.0.0.1 --port 5000 --backend-store-uri sqlite:///mlflow.db > mlflow.log 2>&1 &
export MLFLOW_TRACKING_URI=http://127.0.0.1:5000
kind create cluster --name ml
kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
kubectl -n argo-rollouts rollout status deploy/argo-rollouts

Open http://127.0.0.1:5000 to see the MLflow UI. The scripts download a small public dataset on first run; if Python on macOS reports CERTIFICATE_VERIFY_FAILED, run export SSL_CERT_FILE=$(python -m certifi) in the venv and retry.

  1. Write the training script. It logs a run, registers a new version and points the candidate alias at it. The --label-noise flag lets you produce a deliberately bad model:
train.py
import argparse, random
import mlflow
from mlflow import MlflowClient
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
 
CATS = ["rec.autos", "sci.space"]
ap = argparse.ArgumentParser()
ap.add_argument("--C", type=float, default=1.0)
ap.add_argument("--label-noise", type=float, default=0.0)
args = ap.parse_args()
 
data = fetch_20newsgroups(subset="train", categories=CATS, remove=("headers", "footers", "quotes"))
random.seed(0)
y = [1 - t if random.random() < args.label_noise else t for t in data.target]
 
mlflow.set_experiment("topic-clf")
with mlflow.start_run():
    model = make_pipeline(TfidfVectorizer(min_df=2), LogisticRegression(C=args.C, max_iter=1000))
    model.fit(data.data, y)
    mlflow.log_params({"C": args.C, "label_noise": args.label_noise,
                       "dataset": "20newsgroups-train:" + ",".join(CATS)})
    info = mlflow.sklearn.log_model(model, name="model")
    mv = mlflow.register_model(info.model_uri, "topic-clf")
    MlflowClient().set_registered_model_alias("topic-clf", "candidate", mv.version)
    print(f"registered topic-clf version {mv.version} as candidate")
  1. Write the eval gate. It scores the candidate and the champion on the same fixed test set, records results as version tags, and exits non-zero on failure:
gate.py
import os, sys, time
import mlflow
from mlflow import MlflowClient
from sklearn.datasets import fetch_20newsgroups
from sklearn.metrics import accuracy_score
 
CATS, NAME = ["rec.autos", "sci.space"], "topic-clf"
test = fetch_20newsgroups(subset="test", categories=CATS, remove=("headers", "footers", "quotes"))
client = MlflowClient()
 
def score(alias):
    try:
        mv = client.get_model_version_by_alias(NAME, alias)
    except Exception:
        return None, None, None
    model = mlflow.sklearn.load_model(f"models:/{NAME}@{alias}")
    t = time.perf_counter()
    acc = accuracy_score(test.target, model.predict(test.data))
    ms = (time.perf_counter() - t) / len(test.data) * 1000
    return acc, ms, mv
 
cand_acc, cand_ms, cand = score("candidate")
champ_acc, _, champ = score("champion")
checks = {
    "accuracy >= 0.85": cand_acc >= 0.85,
    "no regression vs champion beyond 0.01": champ_acc is None or cand_acc >= champ_acc - 0.01,
    "scoring time per item < 2 ms": cand_ms < 2.0,
}
client.set_model_version_tag(NAME, cand.version, "eval.accuracy", f"{cand_acc:.4f}")
client.set_model_version_tag(NAME, cand.version, "eval.passed", str(all(checks.values())))
 
lines = [f"candidate v{cand.version}: accuracy {cand_acc:.4f}, {cand_ms:.3f} ms/item",
         f"champion: {'none' if champ is None else f'v{champ.version} accuracy {champ_acc:.4f}'}"]
lines += [f"{'PASS' if ok else 'FAIL'}  {name}" for name, ok in checks.items()]
print("\n".join(lines))
if os.getenv("GITHUB_STEP_SUMMARY"):
    with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as f:
        f.write("### Eval gate\n```\n" + "\n".join(lines) + "\n```\n")
sys.exit(0 if all(checks.values()) else 1)
  1. Write the serving app and the canary probe. FAULT_RATE simulates a serving bug that offline evals cannot see:
serve/serve.py
import os, random
import joblib
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
 
CATS = ["rec.autos", "sci.space"]
model = joblib.load("/app/model.joblib")
FAULT_RATE = float(os.getenv("FAULT_RATE", "0"))
VERSION = os.getenv("MODEL_VERSION", "unknown")
app = FastAPI()
 
class In(BaseModel):
    text: str
 
@app.get("/healthz")
def healthz():
    return {"ok": True, "version": VERSION}
 
@app.post("/predict")
def predict(body: In):
    if random.random() < FAULT_RATE:
        raise HTTPException(500, "simulated serving bug")
    return {"label": CATS[int(model.predict([body.text])[0])], "version": VERSION}
serve/Dockerfile
FROM python:3.12-slim
RUN pip install --no-cache-dir scikit-learn==1.6.1 fastapi uvicorn
ARG MODEL_VERSION=unknown
ARG FAULT_RATE=0
ENV MODEL_VERSION=$MODEL_VERSION FAULT_RATE=$FAULT_RATE
COPY model.joblib serve.py /app/
WORKDIR /app
CMD ["uvicorn", "serve:app", "--host", "0.0.0.0", "--port", "8080"]
probe/probe.py
import argparse, json, sys, urllib.request
 
SAMPLES = [
    ("The rocket reached orbit and the satellite deployed its solar panels.", "sci.space"),
    ("NASA plans a crewed mission to the Moon and later to Mars.", "sci.space"),
    ("The telescope observed a distant galaxy and a comet.", "sci.space"),
    ("Astronauts on the space station ran experiments in microgravity.", "sci.space"),
    ("My sedan needs new brakes and the engine makes a noise.", "rec.autos"),
    ("The dealer offered a good price on the used Toyota.", "rec.autos"),
    ("Changing the oil and tires keeps the car running well.", "rec.autos"),
    ("This V8 truck has a manual transmission and great torque.", "rec.autos"),
]
ap = argparse.ArgumentParser()
ap.add_argument("--url", required=True)
ap.add_argument("--n", type=int, default=60)
ap.add_argument("--max-error-rate", type=float, default=0.05)
ap.add_argument("--min-accuracy", type=float, default=0.8)
a = ap.parse_args()
 
errors = correct = 0
for i in range(a.n):
    text, label = SAMPLES[i % len(SAMPLES)]
    req = urllib.request.Request(a.url, json.dumps({"text": text}).encode(),
                                 {"content-type": "application/json"})
    try:
        with urllib.request.urlopen(req, timeout=5) as r:
            correct += json.load(r)["label"] == label
    except Exception:
        errors += 1
ok_n = a.n - errors
result = {"error_rate": errors / a.n, "accuracy": correct / ok_n if ok_n else 0.0}
print(json.dumps(result))
sys.exit(0 if result["error_rate"] <= a.max_error_rate and result["accuracy"] >= a.min_accuracy else 1)
probe/Dockerfile
FROM python:3.12-slim
COPY probe.py /probe.py
ENTRYPOINT ["python", "/probe.py"]
  1. Write the Kubernetes manifests: two Services, an AnalysisTemplate that runs the probe as a Job against the canary only, and the Rollout:
k8s/rollout.yaml
apiVersion: v1
kind: Service
metadata: { name: topic-clf-stable }
spec: { selector: { app: topic-clf }, ports: [{ port: 80, targetPort: 8080 }] }
---
apiVersion: v1
kind: Service
metadata: { name: topic-clf-canary }
spec: { selector: { app: topic-clf }, ports: [{ port: 80, targetPort: 8080 }] }
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata: { name: canary-probe }
spec:
  metrics:
    - name: canary-probe
      provider:
        job:
          spec:
            backoffLimit: 0
            template:
              spec:
                restartPolicy: Never
                containers:
                  - name: probe
                    image: probe:1
                    imagePullPolicy: IfNotPresent
                    args: ["--url", "http://topic-clf-canary/predict", "--n", "60",
                           "--max-error-rate", "0.05", "--min-accuracy", "0.8"]
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata: { name: topic-clf }
spec:
  replicas: 5
  selector: { matchLabels: { app: topic-clf } }
  template:
    metadata: { labels: { app: topic-clf } }
    spec:
      containers:
        - name: topic-clf
          image: topic-clf:v1
          imagePullPolicy: IfNotPresent
          ports: [{ containerPort: 8080 }]
          readinessProbe: { httpGet: { path: /healthz, port: 8080 } }
  strategy:
    canary:
      canaryService: topic-clf-canary
      stableService: topic-clf-stable
      steps:
        - setWeight: 20
        - pause: { duration: 10s }
        - analysis: { templates: [{ templateName: canary-probe }] }
        - setWeight: 60
        - pause: { duration: 20s }
  1. Write the release script. It packages the candidate alias into an image labelled with its lineage, starts the canary, and moves the champion alias only if the rollout succeeds:
release.sh
#!/usr/bin/env bash
set -euo pipefail
NAME=topic-clf
read -r VERSION RUN_ID < <(python -c "
from mlflow import MlflowClient
mv = MlflowClient().get_model_version_by_alias('$NAME', 'candidate')
print(mv.version, mv.run_id)")
python -c "import joblib, mlflow; joblib.dump(mlflow.sklearn.load_model('models:/$NAME@candidate'), 'serve/model.joblib')"
docker build -q -t "$NAME:v$VERSION" --build-arg MODEL_VERSION="$VERSION" \
  --build-arg FAULT_RATE="${FAULT_RATE:-0}" --label "mlflow.run_id=$RUN_ID" serve/
kind load docker-image "$NAME:v$VERSION" --name ml
 
if ! kubectl get rollout "$NAME" >/dev/null 2>&1; then
  kubectl apply -f k8s/rollout.yaml          # first deploy of v1: no canary steps
fi
kubectl argo rollouts set image "$NAME" "$NAME=$NAME:v$VERSION"
if kubectl argo rollouts status "$NAME" --timeout 300s; then
  python -c "from mlflow import MlflowClient; MlflowClient().set_registered_model_alias('$NAME', 'champion', $VERSION)"
  echo "promoted v$VERSION to champion"
else
  echo "canary failed: Argo Rollouts aborted v$VERSION, stable version still serving" >&2
  exit 1
fi
  1. Bootstrap version 1 and build the probe image:
chmod +x release.sh
docker build -q -t probe:1 probe/ && kind load docker-image probe:1 --name ml
python train.py && python gate.py && ./release.sh
kubectl argo rollouts get rollout topic-clf

Expect the gate to print accuracy around 0.90 with three PASS lines, and the rollout to show 5 healthy pods on topic-clf:v1. In MLflow, version 1 carries both aliases.

  1. Ship a good candidate and watch the canary. In a second terminal run kubectl argo rollouts get rollout topic-clf --watch:
python train.py --C 4.0 && python gate.py && ./release.sh

You should see one canary pod at 20%, an AnalysisRun whose Job prints "error_rate": 0.0, then 60%, then 100%, and promoted v2 to champion.

  1. Try to ship a bad model. The gate must stop it before anything is built:
python train.py --label-noise 0.5 && python gate.py && ./release.sh

Expect FAIL accuracy >= 0.85 and a non-zero exit, so release.sh never runs.

  1. Ship a model that passes offline evals but has a serving bug:
python train.py --C 2.0 && python gate.py && FAULT_RATE=0.3 ./release.sh

The gate passes. The canary pod starts, the probe Job sees about 30% errors and fails, the AnalysisRun is marked Failed, and Argo Rollouts aborts: the canary scales down, the status reads Degraded, and release.sh exits with the failure message. Confirm curl through a port-forward to topic-clf-stable still returns version 2, and that champion still points at version 2 in MLflow.

  1. Automate it with GitHub Actions. Because the registry and cluster live on your laptop, run the workflow on a self-hosted runner registered from the repository's Settings, Actions, Runners page. Use a private repository: a self-hosted runner on a public repo would let anyone's pull request run code on your machine.
.github/workflows/model-release.yaml
name: model-release
on:
  workflow_dispatch:
    inputs:
      C: { description: "Regularisation strength", default: "1.0" }
      label_noise: { description: "Set 0.5 to test the eval gate", default: "0.0" }
      fault_rate: { description: "Set 0.3 to test canary rollback", default: "0" }
concurrency: model-release
jobs:
  release:
    runs-on: self-hosted
    env:
      MLFLOW_TRACKING_URI: http://127.0.0.1:5000
      C: ${{ inputs.C }}                  # pass inputs via env, never inline in scripts
      LABEL_NOISE: ${{ inputs.label_noise }}
      FAULT_RATE: ${{ inputs.fault_rate }}
    steps:
      - uses: actions/checkout@v4
      - name: Python environment
        run: |
          python3 -m venv .venv
          .venv/bin/pip install -q -r requirements.txt
          echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
      - name: Train and register candidate
        run: python train.py --C "$C" --label-noise "$LABEL_NOISE"
      - name: Eval gate
        run: python gate.py
      - name: Canary release with automatic rollback
        run: ./release.sh

Run it three times from the Actions tab with the defaults, with label_noise 0.5, and with fault_rate 0.3.

Check your work: the MLflow UI shows every version with eval.accuracy and eval.passed tags, and the champion alias only ever points at versions that passed both the gate and the canary. The Actions history shows one green run, one red at the eval gate, and one red at the canary step with the stable version still serving. That repository, with its run history, is a portfolio piece.

Stretch: replace the Job-based analysis with the Prometheus-based template from this chapter by installing kube-prometheus-stack in kind and exposing /metrics from the serving app. Then add a version-controlled prompt.txt that the serving app reads, and make a prompt change go through the same gate and canary.

Check yourself

A team rolls back a chat model after a quality incident by restoring the previous weights, but answers stay degraded. Which mistake is the most likely cause?

You need to know whether a new model is safe to serve and whether it improves user retention. Which combination fits?

A candidate scores 0.4 points lower than the champion on the eval gate, within the run-to-run noise band, while a key customer slice dropped 6 points. What should the gate do?

In the lab, the model with FAULT_RATE set passes the eval gate but is rolled back during the canary. What does this demonstrate?

Recap

  • Models fail silently and are judged by statistics, so evals replace tests as the release gate.
  • Version the whole bundle (weights, config, tokenizer, template, prompt, eval data) and use aliases so promotion and rollback are pointer moves.
  • Model CI gates quality against the champion with noise bands and slices, plus performance, safety, compatibility and cost.
  • GitOps makes every deployment a reviewed commit, and Argo Rollouts turns a rollout into metric-driven steps with automatic abort.
  • Canary answers whether a version is safe; A/B testing answers whether it is better; shadow measures with zero user exposure.
  • Prompts and configs are deployments too, and lineage plus recorded sign-off makes every production model explainable.

Go deeper