跳到正文
DEV Community· Suresh Kumar Pallapothu·· 3 小時前AI 評分45

第 29 天:企業 IT 如何管理技術債、模型漂移與模型治理

Day 29: Managing Technical Debt, Drift and Model Governance in Enterprise IT

AI 導讀

AI 系統即使沒有修改程式碼,也可能因數據分佈或輸入與正確答案之間的關係改變而逐漸失準,分別稱為數據漂移和概念漂移。企業可用 PSI 或 Kullback-Leibler divergence 持續比較生產數據與基準,並建立模型清單,記錄訓練數據版本、量化設定、授權責任及業務負責人。安排重新訓練和退役流程,有助避免過時模型及未維護的整合累積成技術債。

正文

Shipping a model is not the finish line. Ordinary software stays exactly as correct as it was on release day until someone changes the code. An AI system can get worse without anyone touching it, because the world feeding it keeps moving. That slow decay is called drift, and managing it is the heart of long-term AI maintenance.

In plain terms: A map is accurate the day it is printed. A year later new roads exist, and the map still looks confident while sending you down a closed street.

Diagram: Data drift happens when the distribution of production inputs moves away from the training data, for example when a firmware update changes the units a device reports. The model was never trained on the new range, so its accuracy degrades quietly. See the animated version.

1. Two kinds of drift

  • Data drift (covariate shift): the statistics of the production inputs move away from the training data. For example, a firmware update makes switches report a value in new units, and a model that parses that telemetry suddenly sees numbers in a range it never learned.
  • Concept drift: the relationship between inputs and the correct answer changes. A fraud model trained on old spending patterns starts misclassifying transactions after procurement policy changes. The inputs look normal, but the right answer is different.

Diagram: Data drift means the inputs change, such as new units or formats. Concept drift means the relationship between inputs and the correct answer changes, such as a fraud model facing a new procurement policy. Both cause silent decay without raising an error. See the animated version.

2. Governance controls

  • Automated drift detection. Continuously compare production data with the baseline using a statistic such as the Population Stability Index (PSI) or Kullback-Leibler divergence, and alert when it crosses a limit.
  • Model inventory and lineage. Keep one registry of every active model: its training data version, quantization settings, licence obligations (for example Apache 2.0 versus a non-commercial licence) and business owner.
  • Retraining and retirement. Set schedules for retraining and a clear path for retiring old models, so obsolete weights and unmaintained integrations do not pile up as technical debt.

Diagram: Population Stability Index compares production data with the baseline, feature by feature. A common rule of thumb treats under 0.1 as stable, 0.1 to 0.25 as worth watching and above 0.25 as needing action. Kullback-Leibler divergence is another option, and the thresholds should be tuned to your data. See the animated version.

Diagram: Governance means keeping a central registry of every active model with its training data version, quantization, licence obligations and business owner, and defining a path from registration through monitoring and retraining to retirement. The example entry is illustrative. See the animated version.

Here is a PSI check in Python. It assumes baseline and current are NumPy arrays of one numeric feature. The 0.1 and 0.25 limits are common rules of thumb, not laws, so tune them to your data.

import numpy as np

def psi(baseline, current, bins: int = 10) -> float:
    edges = np.quantile(baseline, np.linspace(0, 1, bins + 1))      # bins from the training data
    edges[0], edges[-1] = -np.inf, np.inf
    b = np.histogram(baseline, edges)[0] / len(baseline)
    c = np.histogram(current, edges)[0] / len(current)
    b, c = np.clip(b, 1e-6, None), np.clip(c, 1e-6, None)           # avoid log(0)
    return float(np.sum((c - b) * np.log(c / b)))

score = psi(train_latency_ms, last_week_latency_ms)
if score > 0.25:
    print(f"PSI {score:.2f}: significant drift, investigate or retrain")
elif score > 0.10:
    print(f"PSI {score:.2f}: moderate drift, watch closely")
else:
    print(f"PSI {score:.2f}: stable")

Run a check like this per feature on a schedule, send the results to your monitoring system, and tie alerts to an owner listed in the inventory. Proactive governance catches silent failures before your users do.

Coming Up Next

Day 30: The 10-year horizon: architecting IT strategy for the AI-native enterprise.

ModelGovernance #TechnicalDebt #MLOps #DataDrift #EnterpriseIT


Originally published at https://sureshpallapothu.in/blog/day-29-drift-and-governance, where this post includes animated diagrams.

來源:DEV Community · dev.to