Applied concepts

Delivery, serving, monitoring, and rollback

Learn the basics of putting a model into use and keeping it safe to run.

Images, containers, and reproducible boundaries

A Docker image is a packaged filesystem and execution configuration; a container is a running instance with isolated process and filesystem views. Containers share a host kernel and are not equivalent to separate virtual machines. An image can improve consistency across development and deployment, but does not prove application correctness, security, or statistical validity.

A Dockerfile describes how to build an image. A reliable configuration should include a deliberately selected base image, pinned application dependencies, an explicit working directory, copying only required files, and running as a non-root user. Use an approved minimal base and track updates; pinning gives repeatability but does not replace vulnerability review or patching. Keep credentials and protected datasets out of the build context and all image layers. Removing a secret in a later layer does not remove it from earlier layers.

The resulting image should have a versioned identity, preferably an immutable digest, and a documented entry point. Configuration belongs outside the image where appropriate, but environment variables must not become an excuse to expose secrets through logs or process diagnostics. Define a trusted artifact path for the model, including compatible preprocessing. Validate resource requirements and startup behavior before promoting the exact same tested image to another environment.

CI, artifacts, and controlled release

Continuous integration automatically checks proposed changes. A useful pipeline runs formatting or lint checks, unit and integration tests, a synthetic end-to-end test, and relevant policy checks. It builds a traceable artifact only after required gates pass. Build output should record the code revision and dependency identity without containing secrets. Deterministic engineering checks and slower statistical acceptance tests can have different schedules, but both need owners.

Continuous delivery prepares a releasable change; automatic production deployment is a separate policy choice. A responsible route includes staging, a representative smoke test, approved acceptance evidence, an explicit promotion decision, and a rollback plan. Separate code, model, preprocessing, and configuration versions while recording which combination was tested. Rolling back only the model may fail if a new schema is incompatible. Retain a known-good compatible combination and rehearse restoration.

GateEvidenceStop condition
BuildTests pass; immutable artifact recordedFailed contract or missing provenance
StagingSchema, latency, resource, and smoke checksServing/training mismatch
PromotionBusiness acceptance and required approvalsUnresolved material risk
OperationDashboards and rollback readinessAgreed incident trigger breached

Kubernetes concepts without a cluster

In Kubernetes, a Pod is the basic scheduling unit and can contain one or more closely related containers. A Deployment manages desired replicas and rolling updates for suitable workloads. A Service provides a stable network endpoint across changing Pods. These abstractions do not make a poorly designed application reliable automatically; the service still needs correct contracts, capacity planning, and failure handling.

Resource requests guide scheduling; limits constrain consumption. An oversized model can be killed for exceeding memory limits, while CPU throttling can harm latency. Readiness indicates whether a Pod should receive traffic; liveness indicates whether it should be restarted. A slow model-loading startup should not trigger endless restarts, so account for initialization explicitly, potentially with a startup probe. Readiness is not a model-quality metric.

Secrets need controlled provisioning, restricted access, approved encryption, and rotation. A Kubernetes Secret is not automatically secure merely because of its name or encoded representation. Prefer least-privilege identities and separate duties for promotion and operation. Logs, manifests, and dashboards must not expose credentials or raw protected inputs. Deployment mechanisms belong within the organization's approved security process.

Batch and online serving

Batch scoring processes a bounded dataset on a schedule; it can be simpler and cheaper when immediate decisions are unnecessary. Online scoring responds to requests with latency and availability commitments, adding concurrency, timeout, and scaling concerns. Both require idempotent or clearly defined retry behavior, versioned inputs and outputs, schema checks, and an explanation of what happens when scoring fails. Do not substitute an arbitrary “normal” prediction for a failed model.

Training-serving skew occurs when serving computes features differently from training. Reuse fitted preprocessing and test the same synthetic row through both paths. For example, a temperature standardized in one path but left in raw units in another may produce plausible-looking but meaningless scores. Record model version with each permitted prediction record, while minimizing stored input detail.

Monitor behavior and prepare an incident runbook

Monitor engineering measures such as latency, error rate, throughput, memory, and batch completeness alongside data quality and model measures. Data drift changes the input distribution; concept drift changes the relationship between inputs and outcomes. Drift alarms are diagnostic signals, not proof of model failure, and concept drift usually needs delayed outcome evidence. Track subgroup performance and alert workload when authorized labels arrive.

A runbook names the owner, trigger, severity, immediate containment, evidence to preserve, escalation path, fallback, rollback steps, and recovery checks. For a sudden alert surge, inspect sensor ingestion and version changes before retraining. Suspend unsafe automation if appropriate, involve domain experts, and document the decision. Re-enable only after agreed checks pass. Link operational learning back to evaluation, validation, and lifecycle ownership.

Why not retrain automatically whenever drift appears?

A sensor fault or legitimate process change may require investigation, not learning. Automatic retraining can absorb failures, violate approval controls, or worsen performance. Use reviewed evidence, versioned candidates, validation gates, and controlled promotion.

Definition

View in glossary →