Topic 219 / Specialist
AI/ML system architecture
Chapter 13.11 · AI/ML System Architecture
What and why
Recommendation system architecture (→ 216) is one instance of a more general pattern: a production machine learning system that moves data from source through training to a serving model other parts of the system depend on, and keeps watching that model after it ships because its accuracy can silently decay. AI/ML system architecture names and generalizes that lifecycle — data pipelines → training → model registry → serving → monitoring for drift — so any ML-powered feature, not just recommendations, follows the same shape. Builds on: → 216 (recommendation system architecture — the offline-training/online-serving split, generalized here).
Diagram
Data pipelines ─► Training ─► Model registry ─► Serving ─► Monitoring (drift)
▲ (123/124) (versions, (online or │
│ rollback) batch) │
└────────────────────── feeds back into ──────────────────────────────┘
How it works
- Data pipelines collect and prepare training data, reusing the batch/ETL pattern (→ 123) or streaming ingestion (→ 124) depending on freshness needs — feature correctness here drives model quality more than almost anything downstream.
- Training runs on prepared data to produce a model artifact; typically offline, resource-intensive, and run on a schedule or trigger rather than per request.
- Model registry stores trained model artifacts with versioning — which model is currently live, which are historical, and what data and parameters produced each — so a bad model can be identified and rolled back to a known-good prior version.
- Serving exposes the registered model for predictions in one of two modes: online (a request triggers a prediction synchronously, bounded by a latency budget) or batch (predictions are precomputed for known inputs on a schedule and simply looked up at request time) — the choice depends on whether the input is known in advance and how fresh the prediction must be.
- Monitoring for drift: a model's accuracy can degrade after deployment with no code change, because the real-world data distribution it sees shifts away from what it was trained on — monitoring tracks input distributions and prediction quality over time to catch this before it surfaces in a business metric.
- Shadow deployment and A/B evaluation: before fully switching traffic to a new model, run it alongside the current one on live traffic without affecting responses (shadow) to compare predictions, or split a fraction of real traffic to the new model (A/B) to compare outcomes directly — both let a new model be evaluated under real conditions before it fully replaces the old one.
- Feature stores (as in → 216) keep the same feature computed identically for training and serving, closing the training-serving skew gap this general lifecycle shares with the recommendation-specific case.
Practical example
(illustrative). A fraud-detection model is retrained periodically on recent transactions; the new model is registered and run in shadow mode for a period, scoring every live transaction without affecting any decision, so its predictions can be compared against the currently live model's decisions. Only once the shadow model's disagreements are reviewed and judged acceptable does it move to serving a fraction of real traffic (A/B), then full traffic.
When to use it
- Use when: a feature's correctness genuinely depends on a trained model's output, and the cost of this lifecycle — registry, monitoring, safe rollout — is justified by what a wrong or stale prediction would cost.
- Avoid when: a rule-based heuristic solves the problem as well as a model would, or the team can't commit to ongoing monitoring and retraining — a model shipped once and never watched again is a latent outage waiting for the data distribution to shift.
- Failure scenarios: deploying a new model with no shadow or A/B step and discovering a regression only once it's fully live; no drift monitoring, so a model silently degrades for a long time before anyone notices in business metrics; a feature-store mismatch between training and serving producing confidently wrong predictions.
- Simpler alternative: a rule-based or lookup-table heuristic, when it performs comparably and avoids the operational cost of the full ML lifecycle.
Practice
(Process kind — fill the template on a small real system; 20–30 min, no lab services). For an ML-powered feature you've used or can imagine (search ranking, spam detection, fraud scoring), fill out this lifecycle for it: what data feeds training, what the model registry would need to store, whether serving should be online or batch and why, and one concrete drift signal you'd monitor. Done when your drift signal is something you could actually measure, not just "accuracy dropped."
Key takeaway
Every production ML feature follows the same lifecycle — pipelines, training, a registry, serving, and drift monitoring — whether or not it looks like a recommendation system. Done when you can: fill the lifecycle template for a real feature and name a measurable drift signal. Used next in → 220 (LLM serving specializes this lifecycle's serving stage), → 223 (GPU infrastructure underlies this lifecycle's training stage).
References
None — this topic makes no external claims.
Source directory