28/35
Part 3 of 3 · Serving and driftLearn and do

Monitor what fails without an error

A feature layer usually breaks quietly, with no error anywhere.

Five monitors catch a stale or broken feature

MonitorHow it's computedAlert when
Freshnessnow minus the newest event time, per feature groupdaily: the load hasn't landed 2 hours after its usual time, or age passes 30 hours. Streaming: p99 lag over 2 minutes
Fallback and null rateshare of requests where each feature was defaulted or missing3 times its usual rate, or a jump right after a deploy
Fetch latencyp50 and p99 per store, and the timeout ratethe stage's p99 nears its slice of the budget
Drift against trainingdistance between this hour's served values and the training set, per featureabove a threshold tuned per feature
Paritylogged served value against the value recomputed offline, on a samplemismatch rate over a small threshold

Most feature failures throw no errors. The model keeps scoring on values that are stale, defaulted or shifted. These five catch them.

Drift: how far this hour's values are from the training set

Device, an exampleShare in trainingShare in servingDifference
TV50%40%0.10
Phone30%45%0.15
Laptop20%15%0.05

TensorFlow Data Validation (TFDV) makes a fine default to name. It measures drift with L-infinity distance for categorical features, and approximate Jensen-Shannon divergence for numeric ones.

L-infinity distance is the largest difference, over all categories, between a category's share in serving and its share in training. In this example it's 0.15, from phones. Jensen-Shannon divergence is a symmetric, bounded score for how far apart two distributions are, 0 when they match.

TFDV also warns that setting the right distance is usually an iterative process, which takes domain knowledge and experiments.

In the editor, write shares(values) and l_inf(train, serve). TRAIN and SERVE are the device shares from the table, so the distance should come out at 0.15.