Contents
Key concepts
Training–serving skew and feature stores
Skew arises when features are computed differently offline and online: duplicated transformation code, different sources or freshness, time zones, unit or default-value bugs, and point-in-time leakage in training joins. Prevent it with one transformation definition, logging served features and training on those logs, and point-in-time-correct joins; a feature store provides an offline store for training sets and a low-latency online store backed by the same definitions.
Reproducibility and the model registry
To rebuild a model months later you need the code commit, data snapshot or query plus timestamp, feature definitions, config and hyperparameters, environment (container digest, library versions), random seeds and hardware notes. A registry stores numbered model versions with lineage to the run that produced them, evaluation results, tags and mutable aliases such as ‘champion’, which is what deployment references. For LLM applications the versioned unit is the whole app (code commit, prompts, model snapshot, tool and retrieval config); MLflow 3’s LoggedModel, for example, groups that version’s traces and evaluation results together.
CI/CD/CT for ML
Beyond unit tests, an ML pipeline validates data (schema, ranges, null rates, distribution shifts), validates the model (offline metrics against the current champion on fixed and recent sets, slice metrics, fairness, latency and size budgets) and tests the serving contract. Google’s maturity levels run from manual (level 0) to automated continuous training (level 1) to automated CI/CD of the pipeline itself (level 2).
Deployment strategies
Shadow mode scores live traffic without acting, which catches crashes, latency and skew at zero user risk but cannot measure outcomes. A canary sends a small share of real traffic with automated rollback on guardrails. An A/B or champion–challenger test measures causal business impact but needs enough traffic and time. Blue–green keeps the old version warm for instant rollback.
Monitoring with delayed or missing labels
Monitor in layers: service health (latency, errors), inputs (schema, missingness, drift via PSI or KS tests), outputs (score distribution, decline or escalation rates) and, when labels arrive, quality (AUC, calibration, precision at the operating threshold). When labels lag by weeks, as with chargebacks, output and input drift are the early warning and you backfill true performance later by cohort. LLM applications rarely get labels at all, so trace every request (model calls, retrieval, tool calls, agent steps), score a sample of production traces with validated LLM judges and human review, and watch token use, refusals, fallbacks and the topic mix of inputs as drift signals.
Stack · 5 layersLayered monitoring when labels lag
Monitor latency and errors.
Monitor schema, missingness and drift via PSI or KS tests.
Monitor score distribution, decline or escalation rates.
When labels arrive, monitor AUC, calibration and precision at the operating threshold.
Rarely labelled: trace every request and score a sample with validated LLM judges and human review.
Retraining cadence
Measure decay by backtesting performance against model age, then compare the cost of decay with the cost of a retrain-and-validate cycle. Scheduled retraining is simple; drift- or performance-triggered retraining is cheaper but needs trustworthy triggers. Every automatic retrain must pass the same gates as a manual release, with automatic rollback.
LLMOps specifics
Version prompts (in a prompt registry with rollback), tool schemas, retrieval config and model IDs together, and pin dated model snapshots. Eval-in-CI must cope with non-determinism: fixed temperature where possible, several samples per item, thresholds on pass rate with confidence intervals and per-slice regression checks, and LLM judges checked against human labels before they gate a deploy. A gateway centralises keys, routing, fallbacks, rate limits, caching and per-feature cost and token accounting; for self-hosted open models a plain round-robin Service is a poor balancer, so LLM-aware routers (the Kubernetes Gateway API Inference Extension, llm-d) pick replicas by queue depth, memory, loaded LoRA adapters and prefix-cache hits.
Incident response for model-driven failures
First stop the harm (roll back, raise or lower a threshold, fall back to rules), then diagnose by checking what changed: deploys, upstream data, feature pipelines, traffic mix and seasonality. Hold a blameless postmortem and turn the root cause into a new test, monitor or gate.
Worked examples
Population stability index for a drifting feature
A credit model’s ‘months at address’ feature was binned into quartiles on training data (25% each). This week’s traffic falls into the bins as 10%, 20%, 30% and 40%. Compute PSI and decide what to do.
PSI = Σ (actualᵢ − expectedᵢ) × ln(actualᵢ / expectedᵢ)
| bin | expected | actual | (a − e) × ln(a/e) |
|---|---|---|---|
| 1 | 0.25 | 0.10 | (−0.15) × ln 0.4 = 0.1374 |
| 2 | 0.25 | 0.20 | (−0.05) × ln 0.8 = 0.0112 |
| 3 | 0.25 | 0.30 | 0.05 × ln 1.2 = 0.0091 |
| 4 | 0.25 | 0.40 | 0.15 × ln 1.6 = 0.0705 |
PSI ≈ 0.228. Common credit-risk rules of thumb: below 0.1 stable, 0.1–0.25 moderate shift, above 0.25 major shift. So: investigate, do not auto-retrain blindly.
Next steps: check whether a pipeline change (new default value, unit change) caused it, which would be a bug to fix rather than real drift; if the population genuinely changed (a new marketing channel), check score distribution and early-label proxies by segment, then decide on retraining. Note PSI is a symmetrised KL divergence, so it is sensitive to sparse bins: add a small floor.
Choosing a retraining cadence from a decay backtest
Backtests show a fraud model loses about 0.003 AUC per week after training. Each 0.01 AUC is worth about £10,000 per week in fraud losses. A retrain-validate-deploy cycle costs £5,000 (compute plus review time). How often should you retrain?
With retraining every T weeks the AUC loss is a sawtooth from 0 to 0.003T, average 0.0015T.
Weekly decay cost = (0.0015T / 0.01) × £10,000 = £1,500 × T
Weekly retraining cost = £5,000 / T
Total C(T) = 1,500T + 5,000/T. Setting dC/dT = 1,500 − 5,000/T² = 0 gives T* = √(5,000 / 1,500) ≈ 1.8 weeks.
| T (weeks) | decay | retrain | total per week |
|---|---|---|---|
| 1 | £1,500 | £5,000 | £6,500 |
| 2 | £3,000 | £2,500 | £5,500 |
| 4 | £6,000 | £1,250 | £7,250 |
Retrain fortnightly. Caveats: labels for the last 30–90 days are incomplete, so the training window lags; automate the gates first, because cheaper cycles push T* down.
Sizing a canary for a new fraud model
Card traffic is 400,000 transactions a day; the canary gets 5%. The current decline rate is 0.5%. You want to catch a regression that doubles declines within about six hours, alerting when declines exceed a fixed threshold. Pick a threshold and estimate false-alarm and detection rates.
Canary volume: 5% × 400,000 = 20,000/day ≈ 833/hour → about 5,000 transactions in six hours.
Expected declines in six hours (Poisson):
- healthy: 5,000 × 0.5% = 25 (SD ≈ 5)
- regressed: 5,000 × 1.0% = 50 (SD ≈ 7)
Threshold at 35 declines (2 SD above healthy):
- false alarm: P(Poisson(25) ≥ 35) ≈ 3.4%
- detection: P(Poisson(50) ≥ 35) ≈ 99%
Six hours at 5% is adequate for doubling. To catch a 20% increase you would need far more traffic or time, which is why canaries guard against gross failures and the A/B test measures subtle effects. Compare against a concurrent control slice, not yesterday, to cancel time-of-day effects.
What changed recently
llm-d 1.0: production Kubernetes stack for open-model serving
llm-d, the Kubernetes-native distributed inference project led by Red Hat, IBM and Google and running on engines such as vLLM and SGLang, reached 1.0 with a focus on day-2 operations: prefix-cache-aware routing, KV-cache offloading, prefill/decode disaggregation, multi-tenant QoS, session pinning for multi-turn agents and zero-downtime upgrades. IBM reports its router captured 97% of the available cache reuse on an agentic coding workload. Interviewers now ask why self-hosted LLM serving needs load- and cache-aware routing rather than a plain Service, and how to upgrade models without dropping sessions.
EU Digital Omnibus pushes AI Act high-risk obligations back
The Council’s final approval at the end of June 2026 moved the high-risk obligations from 2 August 2026 to 2 December 2027 for stand-alone systems and 2 August 2028 for AI embedded in regulated products, and shortened the grace period for marking AI-generated content to 2 December 2026. The high-risk obligations include technical documentation, automatic event logging and post-market monitoring, all of which should come out of the ML pipeline rather than be written by hand. Interviewers at regulated firms that sell into the EU ask what you would build now and what the delay really changes.
OpenTelemetry GenAI conventions move to their own repository
Semantic conventions release v1.42.0 deprecated every gen_ai.* attribute, metric, event and span in the core repository and moved them to a dedicated GenAI repository covering inference, embeddings, retrieval, tool execution, agent invocation, MCP and provider-specific conventions. They are still marked Development, and capture of prompt and completion content is opt-in because it often holds personal data. Interviewers ask how you would trace agents in a vendor-neutral way while the schema still churns.
EU AI Act obligations for general-purpose model providers apply
From 2 August 2025, providers placing general-purpose AI models on the EU market must keep technical documentation, adopt a copyright policy and publish a summary of training content using the Commission’s template, with extra duties above the 10^25 FLOP systemic-risk presumption. Models already on the market have until 2 August 2027, and a voluntary Code of Practice offers a route to show compliance. Data lineage and training records therefore become regulatory artefacts, not just good engineering hygiene.
MLflow 3 rebuilds the registry around GenAI applications
MLflow 3 introduced LoggedModel as a first-class version of an application, linked to its prompts, traces and evaluation runs, along with OpenTelemetry-based tracing for over 20 GenAI libraries, LLM judges, expert review of traces and a prompt registry with diffs and rollback. It made eval-driven development and trace-level monitoring standard features of a mainstream open-source MLOps tool, so interviewers expect candidates to describe LLM release gates in those terms.
Pitfalls
- Using shadow mode to claim business impact; shadow traffic cannot measure outcomes the model would have changed.
- Retraining on a fixed schedule with no validation gate, or letting an automatic retrain bypass the champion comparison.
- Monitoring only aggregate accuracy, which arrives weeks late and hides failures in small slices.
- Reimplementing feature logic separately in the online service, the classic source of training–serving skew.
- Calling a model reproducible because the code is in git while the data snapshot and environment are not versioned.
- Treating LLM prompts as configuration outside CI, so a one-line prompt edit ships with no regression eval.
How interviewers probe it
- Walk through a 9 am incident: what do you check first, how do you stop the bleeding, who do you tell?
- Design dashboards and alerts for a new model with delayed labels; which alerts page someone at night?
- Compare shadow, canary and A/B for a specific model and justify the rollout plan with traffic numbers.
- What exactly is versioned and stored in a registry; how would you reproduce last March’s model?
- LLMOps: eval-in-CI with non-deterministic outputs, validating LLM judges against human labels, pinning provider model versions, tracing agents with OpenTelemetry GenAI spans, cost per feature.
- Lead angle: minimum engineering bar before production, how to fund platform work against feature requests, and which EU AI Act evidence (technical documentation, logs, post-market monitoring) the pipeline should produce automatically.
Quiz
Three questions from this guide. Answer each in your head or out loud, show the model answer, then rate yourself. The cards join your practice deck and come back when they are due.
What causes training–serving skew and how do you prevent and detect it?
Model answer, written in a candidate's voice
- Causes: duplicated transformation code, different data sources or freshness, timezone/unit bugs, missing-value handling.
- Prevention: one shared transformation path; log served features and train on those logs; parity tests for any second implementation.
- Detection: schema and distribution checks between training and serving, e.g. daily comparisons of served vs training statistics (TensorFlow Data Validation or similar) with drift alerts.
- Launch safety: shadow scoring before rollout and gradual rollout.
What problems does a feature store solve? Describe its offline and online parts and how features flow between them.
Model answer, written in a candidate's voice
- Solves duplicated feature logic, training/serving skew and slow reuse.
- Offline store: warehouse/lakehouse for point-in-time training sets.
- Online store: low-latency KV such as Cassandra/Redis for serving.
- Materialisation jobs, freshness SLAs and backfills move features between stores.
- Streaming features support real-time signals.
- Lineage, monitoring and access control keep features trustworthy.
- Common split: batch features computed in the warehouse and loaded online on a schedule; request-dependent operational features computed live.
What must you version to reproduce a model six months later, and what does a model registry store?
Model answer, written in a candidate's voice
- Code commit, training script, dependencies/container or lockfile, and environment
- Data snapshot or query plus time, feature definitions/transforms, labels and splits
- Config/hyperparameters, seeds, framework/hardware context
- Registry stores artefact, metrics, lineage, validation status, owner, stage and approval history
- GPU training is not guaranteed bitwise deterministic; record seeds/config but validate outputs
You have finished this topic.
Reading
- Rules of Machine Learning: Best Practices for ML EngineeringZinkevich’s pragmatic rules, including logging served features and measuring training–serving skew.
- MLflow for Agents and LLMsOpen-source MLflow docs with quickstarts for OpenTelemetry-compatible tracing, LLM-judge evaluation and prompt versioning.
- MLOps: Continuous delivery and automation pipelines in machine learningThe level 0/1/2 maturity model and what continuous training adds to CI/CD.
- Data Distribution Shifts and MonitoringClear taxonomy of covariate, label and concept shift, plus what to monitor when labels are delayed.
- Hidden Technical Debt in Machine Learning SystemsClassic catalogue of ML-specific debt: entanglement, feedback loops, glue code, configuration.
- The ML Test Score: A Rubric for ML Production Readiness and Technical Debt ReductionA concrete checklist of data, model, infrastructure and monitoring tests to quote as a production bar.
- OpenTelemetry semantic conventions for generative AIThe vendor-neutral span, metric and event vocabulary for model calls, retrieval, tool execution, agents and MCP (moved to its own repository in 2026, still in Development).
- Operationalizing Machine Learning: An Interview StudyInterviews with 18 ML engineers; the velocity–validation–versioning framing is useful in lead interviews.
Practise this topic
- What causes training–serving skew and how do you prevent and detect it?
- What problems does a feature store solve? Describe its offline and online parts and how features flow between them.
- What must you version to reproduce a model six months later, and what does a model registry store?
- How do you decide how often to retrain, and what safeguards gate an automatically retrained model?
- What does a CI/CD pipeline for an ML service test that a normal service pipeline does not?
- Compare shadow deployment, canary and an A/B champion/challenger test for a new fraud model. When is each appropriate?
- At 9 am, false declines on card payments triple. Walk through your response.
- Design the dashboards and alerts for a newly launched credit-risk model.
- How do you stop prompt or model changes from silently breaking things? Describe eval-in-CI that copes with non-deterministic outputs.
- What is your minimum engineering bar before an ML model goes to production?
- Design a system that monitors a production ML model’s performance in real time.
- Chargebacks arrive 30–90 days after a transaction, and some never arrive. How does this affect training, evaluation and monitoring?
- You are instrumenting a production agent with a planner, retrieval, tool calls and two model providers, and you want vendor-neutral traces. How would you use the OpenTelemetry GenAI semantic conventions, and what would you do about the fact that they are still marked Development?
- The EU’s Digital Omnibus on AI moved the AI Act’s high-risk obligations to December 2027 for stand-alone systems, while duties for general-purpose model providers have applied since August 2025. You lead the ML platform at a London fintech that sells a credit-scoring model to EU lenders and fine-tunes an open-weight LLM for customer support. What do you build now, and what can safely wait?
- You are moving about 3,000 concurrent coding agents from a managed API to a self-hosted open model served with vLLM on Kubernetes. Why does a standard Kubernetes Service balance this traffic badly, and what would your routing, scheduling and model-upgrade design look like?
- Anthropic’s September 2025 postmortem described routing, configuration and compiler bugs that degraded answer quality for weeks without raising error rates. Design the monitoring that would catch a model that is up but subtly wrong in your own serving stack.