Curriculum

LLMOps · Production Health

Model Monitoring & Drift

Production ML systems degrade silently. Data drift, concept drift, and LLM hallucination tracking are essential monitoring dimensions to maintain model quality over time.

The idea

Models trained on historical data encounter distribution shift in production. Data drift: the input distribution changes (e.g., a new product category with unseen vocabulary). Concept drift: the relationship between inputs and correct outputs changes (e.g., customer sentiment about a feature reverses after a PR crisis).

Detection methods: statistical tests (KS test, Population Stability Index) compare feature distributions between training and production windows. Embedding drift: track the centroid and variance of input embeddings over time.

For LLMs, hallucination tracking is the primary quality signal: do outputs contradict retrieved context? Faithfulness scores from a reference LLM-as-judge or fact-checking pipeline provide ongoing measurement. Token cost optimisation: profile prompts for redundant tokens, use caching (prompt caching, KV cache), and route cheap queries to smaller models.

PSI = Σᵢ (Aᵢ − Eᵢ)·ln(Aᵢ/Eᵢ)

Population Stability Index. Aᵢ is the actual proportion in bucket i; Eᵢ is the expected (baseline) proportion.

What to hold onto

  • PSIPopulation Stability Index = Σ(actual% − expected%)·ln(actual%/expected%). PSI < 0.1: stable; 0.1–0.2: investigate; > 0.2: retrain.
  • Shadow ModeDeploy the new model in parallel, route a fraction of traffic, compare outputs without serving them. Catches regressions before cutover.
  • Retraining TriggersSchedule-based (weekly), performance-based (accuracy drops below threshold), or drift-based (PSI threshold breached). Automated retraining pipelines use MLflow or Vertex AI Pipelines.

Live: Population Stability Index (PSI) Drift Monitor

Inject covariate shift into production inference distributions and track real-time divergence against baseline.

PSI: 0.02 (Stable)

Quick answers

What is data drift in machine learning?

Data drift occurs when the statistical distribution of production inputs diverges from the distribution the model was trained on. This degrades performance without any change to the model itself. It is detected by comparing feature statistics over time using tests like the Kolmogorov-Smirnov test or Population Stability Index.

How is hallucination tracked in LLM production systems?

Hallucination tracking in LLMs typically involves faithfulness scoring: an evaluator model checks whether the LLM's output is grounded in its retrieved context or stated premises. Systems like RAGas, TruLens, and LangSmith's evaluations automate this at scale, flagging responses that contradict source documents.