Part XIII: Trust, Safety, Evaluation, and Operations
Chapter 69: MLOps for Sensor Fleets

Proxy monitoring under delayed ground truth

"They asked me for my accuracy. The labels that would tell me my accuracy arrive in three weeks, for one batch in ten, and only when a human bothered to look. So I told them about my confidence instead, and I told them how much I trusted my confidence, and that turned out to be the honest answer."

A Provisionally Correct AI Agent

Prerequisites

This section leans on calibration and confidence as measurable quantities, the reliability diagram, and conformal scores, from Chapter 18, and on the distribution-shift vocabulary, covariate shift, label shift, and importance weighting, from Chapter 66. It is the companion to Section 69.3, which monitored the inputs for drift and data quality; here we monitor the outputs and outcomes when the labels that would score them are late, biased, or missing. We assume the leakage-safe evaluation discipline of Chapter 65.

The Big Picture

In a lab you compute accuracy the instant a prediction is made, because the label is sitting next to it. In a deployed sensor fleet the label almost never sits next to the prediction. Did the turbine that the model flagged actually fail? You find out at the next teardown, months later, if ever. Was that flagged heart rhythm truly atrial fibrillation? A cardiologist confirms it two weeks after the patch is mailed back. Was the pedestrian really there? You only learn when there was not one and someone complains. Ground truth is delayed (it comes late), censored (it comes for only some cases), and biased (the cases it comes for are exactly the ones a human decided to check). You cannot wait for it to run a monitor. Proxy monitoring is the discipline of tracking label-free signals that move before the true metric moves, then validating those proxies against ground truth as it slowly backfills. This section teaches you which proxies to trust, how to calibrate a proxy into an estimate of the real metric, and how to keep the trickle of late labels from lying to you.

The three ways ground truth fails to show up on time

It is worth being precise, because each failure mode calls for a different remedy. Latency is the gap between a prediction at time \(t\) and the label at time \(t + \Delta\). For a maintenance model \(\Delta\) can be months; for a clinical over-read, weeks; for a click on a recommended action, minutes. A monitor that reports accuracy is always reporting the accuracy of predictions made \(\Delta\) ago, which is useless for catching a regression that started yesterday. Censoring means labels arrive for only a subset of predictions: a device is retired before its failure is observed, a patient never returns, a flagged event is never adjudicated. The label is not late; it is absent, and treating absent as negative silently corrupts every rate you compute. Verification bias is the sharpest trap: the labels that do arrive are not a random sample. A human investigates the alarms the model raised, so you learn the true state of positives far more often than negatives. Compute precision on that trickle and it looks plausible; compute recall and it is a fantasy, because the false negatives were never looked at. A proxy-monitoring system has to be designed around all three at once.

Key Insight

A proxy is only useful if it is a leading indicator: it must move before the true metric, and its movement must be predictive of the true metric's movement. Average prediction confidence, output-class balance, and ensemble disagreement all satisfy this when the model is well calibrated, because a model that is losing accuracy under shift almost always becomes less confident, more evenly split, or more internally inconsistent first. The discipline is not "watch some numbers"; it is "watch numbers whose relationship to accuracy you have measured on backfilled labels, and re-measure that relationship as the world drifts." An uncalibrated confidence is a proxy you have not earned the right to trust yet.

A taxonomy of proxy signals

Proxies fall into four families, ordered from cheapest to most trustworthy. Confidence-based proxies read the model's own output distribution: mean maximum-softmax probability, predictive entropy, or conformal set size (Chapter 18). If the model is calibrated, average confidence is a direct, if noisy, estimate of average accuracy. Distributional proxies watch the prediction distribution rather than the input: the flagged-anomaly rate, the class mix, the score histogram. A silent doubling of the positive rate is a five-alarm signal even with zero labels, because the base rate of real failures did not double overnight. Consistency proxies exploit redundancy: agreement between an ensemble's members, between two sensors that should see the same event (the fusion redundancy of Chapter 48), or between the current model and the previous version run in shadow. Disagreement needs no ground truth and rises sharply under shift. Behavioral and downstream-outcome proxies are the most trustworthy because they touch reality: the human-override rate (how often an operator dismisses the model's alarm), the intervention outcome (did the dispatched crew find a real fault), the complaint rate. These carry real signal about correctness but arrive with their own latency, so they close the loop slowly. A mature fleet monitor tracks one or two proxies from each family and cross-checks them, because any single proxy can be fooled.

Step-Through: the ambulatory ECG patch that could not wait for the cardiologist

A cardiac-monitoring company ships adhesive ECG patches that record for fourteen days; an on-device model flags suspected atrial fibrillation in real time (the clinical modeling is the subject of Chapter 29). The definitive label is a cardiologist's over-read, which happens only after the patch is mailed back, uploaded, and queued: a median of nineteen days after the prediction, and only for the roughly one recording in eight that gets escalated. Waiting nineteen days to notice a bad deploy is not acceptable when a firmware change to the patch's analog front end can shift the signal baseline overnight. So the team runs proxy monitoring. They track mean confidence on flagged beats, the AF-flag rate per patient-day, and the disagreement between the deployed model and a heavier reference model run in the cloud on the same uploaded strips. When a lead-adhesive supplier change subtly raised baseline wander, the confidence proxy sagged and the deployed-versus-reference disagreement jumped within a day, on every patch, long before a single over-read confirmed the accuracy drop. The proxies triggered a rollback nineteen days before ground truth would have. When the over-reads finally arrived, they confirmed a real six-point sensitivity loss on the affected batch, validating the alarm after the fact and calibrating exactly how much confidence-sag maps to how much sensitivity loss.

Turning a proxy into an estimate of the real metric

Watching a proxy wiggle is monitoring; turning it into a number you can put a threshold on is estimation. The workhorse for classification is Average Thresholded Confidence (ATC). The idea: on a labeled reference set, find a threshold \(t\) on a confidence score \(s(x)\) (for example the maximum softmax probability, or negative entropy) such that the fraction of reference points scoring below \(t\) equals the reference error rate. Formally, choose \(t\) so that

$$ \Pr_{\text{ref}}\big[\, s(x) < t \,\big] \;=\; \Pr_{\text{ref}}\big[\, \hat{y}(x) \neq y \,\big]. $$

Then, on a fresh unlabeled batch from the fleet, estimate the error as simply the fraction of points scoring below that same \(t\). This works because a calibrated score orders points by correctness the same way in the reference and target distributions under a broad shift assumption; it converts a whole confidence histogram into one accuracy number without a single target label. Direct-loss-estimation and importance-weighted variants extend the same trick to AUC and to regression. Critically, ATC must be re-validated whenever backfilled labels arrive: each time a batch of ground truth lands, you compare the estimate the proxy produced weeks ago against the truth, and if the residual is growing you re-fit \(t\) or retire the proxy. That backfill loop is what keeps the estimate honest as the fleet drifts.

import numpy as np

def fit_atc_threshold(conf_ref, correct_ref):
    """Pick threshold t so P(conf < t) equals the reference error rate."""
    err_rate = 1.0 - correct_ref.mean()          # measured on labeled reference
    t = np.quantile(conf_ref, err_rate)          # the err_rate-quantile of confidence
    return t

def estimate_error(conf_target, t):
    """Label-free error estimate on an unlabeled fleet batch."""
    return float(np.mean(conf_target < t))

rng = np.random.default_rng(0)
# Reference: calibrated model, ~12% error. Confidence higher when correct.
correct_ref = rng.random(5000) > 0.12
conf_ref = np.clip(rng.normal(np.where(correct_ref, 0.85, 0.55), 0.12), 0, 1)
t = fit_atc_threshold(conf_ref, correct_ref)

# Fleet batch after a drift that pushed true error to ~22% (labels unavailable).
correct_true = rng.random(5000) > 0.22
conf_tgt = np.clip(rng.normal(np.where(correct_true, 0.80, 0.50), 0.14), 0, 1)
print(f"threshold t          = {t:.3f}")
print(f"estimated error      = {estimate_error(conf_tgt, t):.3f}")
print(f"true error (oracle)  = {1 - correct_true.mean():.3f}")
Average Thresholded Confidence in twelve lines: fit_atc_threshold calibrates one number on a labeled reference set, and estimate_error then predicts the fleet's error rate on an unlabeled batch. The printed estimate tracks the oracle error (which the monitor never actually sees) to within a couple of points, catching the drift from 12% to 22% with no target labels.

Library Shortcut

The hand-rolled ATC above is the teaching version. Production libraries do label-free performance estimation with drift-aware confidence bands and multiple metrics out of the box. nannyml's CBPE (Confidence-Based Performance Estimation) and DLE (Direct Loss Estimation) estimators fit on a labeled reference and then predict ROC AUC, F1, or accuracy on unlabeled production data in about five lines: estimator = nannyml.CBPE(...); estimator.fit(reference_df); estimator.estimate(production_df). That replaces roughly 150 to 250 lines of your own thresholding, per-chunk aggregation, calibration checks, and confidence-interval bookkeeping, and it handles the re-calibration and alerting hooks you would otherwise have to write and test yourself.

Correcting the labels you do get

Eventually some ground truth backfills, and it is tempting to just score against it. Do not, before you correct for how it was selected. If humans only adjudicate model-flagged positives, the labeled set is a biased sample and naive recall is uncomputable, since the false negatives are invisible. Three practices help. First, deliberate label sampling: budget for a small random audit of unflagged cases so you can estimate the false-negative rate, not just the false-positive rate; a stratified draw of a few hundred negatives per month often costs less than one missed failure. Second, importance weighting: when the probability of a case being labeled depends on measurable features, weight each label by the inverse of its selection probability to recover an unbiased metric (the same reweighting machinery as label shift in Chapter 66). Third, delayed and prequential evaluation: report metrics on a lagged window whose labels are now mature, sliding forward as more arrive, and always show the fraction of a window's predictions that are still unlabeled so a reader knows how provisional the number is. A metric on 12% resolved labels is a rumor; the dashboard should say so.

Exercise

You run a fleet of leak detectors on a gas network. The model raises 400 alarms per week; field crews investigate every alarm (so every positive gets a true label after about three days) but almost never inspect a non-alarm site. (a) Which standard metrics can you compute reliably from this feedback, and which cannot be computed at all? (b) Design a minimal labeling budget that makes recall estimable, and write the formula that turns your audit sample into a fleet-wide false-negative-rate estimate. (c) Propose two label-free proxies from different families in the taxonomy that would flag a sudden drop in recall days before the audit could, and state what could fool each one.

Self-Check

1. Explain why average model confidence is a usable accuracy proxy only after calibration, and what goes wrong if you skip the calibration step.
2. Give a concrete scenario in which the flagged-positive rate stays flat while true accuracy collapses, defeating a distributional proxy. Which other proxy family would still catch it?
3. Verification bias inflates one of precision or recall and hides the other. Which is which when only model-flagged positives get adjudicated, and why?

Wiring it into the fleet monitor

Operationally, proxy monitoring is a second track running alongside the input-drift monitor of Section 69.3. Each batch emits its proxy vector (mean confidence, entropy, positive rate, ensemble disagreement, override rate) and an ATC-style error estimate with a confidence band. A regression fires when the estimate crosses a threshold and at least one independent proxy family agrees, which suppresses the false alarms that any single noisy proxy throws. Separately, a slow reconciliation job ingests backfilled labels, recomputes bias-corrected true metrics on now-mature windows, and audits every past proxy estimate against the truth; when the proxy-to-truth residual drifts, it schedules a re-fit or opens a ticket. That reconciliation is precisely the evidence a retraining trigger needs, which is where we turn next.

What's Next

In Section 69.5, we turn these proxy estimates and backfilled metrics into decisions: the retraining triggers that decide when a drift signal or a confirmed accuracy drop justifies retraining, and the fleet-management machinery that rolls a new model out across thousands of heterogeneous devices without taking the whole fleet down at once.