ML Systems Lab Open interactive version →
Advanced 29 min read late datastreamingwatermarklabel quality

Late-Arriving Data

Watermarking, streaming late data handling, impact on labels, remediation

A fraud system scores an order the instant it is placed — call that T+0. The truth about that order arrives much later: a fraudulent chargeback gets filed 7 days on. That chargeback *is* the label. But your training job runs daily and can only trust labels that have had time to settle. So the most recent week of your training data shows almost no fraud — not because fraud stopped, but because the evidence hasn't shown up yet. This is label delay, and it is everywhere that the truth arrives after the thing you're predicting.


Don't guess the wait — measure it

The lazy fix is "just wait longer before training." It works, but it throws away recency. The real fix is to learn the *shape* of the delay: for your data, what fraction of chargebacks are in by day 1, day 3, day 7? That's the completeness curve. At 50% completeness you have half the labels; at 95%, nearly all. Set your incubation period — how long before you call a label final — at the 99th percentile of that curve, not at some round number that felt about right.


Late data wrecks features too, not just labels

"Transactions in the last 5 minutes," computed at 14:02, should cover 13:57–14:02. But a phone that dropped signal for three minutes uploads its events at 14:04 — after the window closed. The feature was computed on incomplete data. And the miss isn't random: it systematically undercounts users with flaky connectivity, which tracks with geography and device. Bias, not noise.


Watermarks and event time

A *watermark* is how a streaming system announces "every event up to time T is now in." You set it by measuring the real lateness of your source: too tight and you throw away real events, too loose and every result waits on stragglers that may never come. The deeper rule underneath all of this: use event time (when it happened), never processing time (when your system received it). In real distributed systems — retries, clock skew, phones uploading hours later — events *always* arrive out of order. Design for out-of-order arrival from the start, because assuming order silently distorts every aggregate, every label, and every model built on them.

Key points

Takeaway

Label delay and late-arriving events are not edge cases — they are structural properties of asynchronous systems, and the only safe design measures the actual completeness curve for your specific data source rather than assuming any default.

Recap

Check your understanding

Q1. You are training a click model for mobile ads. Labels are generated 1 hour after impression, and precision is much lower on mobile than desktop. Select the two accurate statements.

Q2. A streaming pipeline sets a watermark tolerance of 5 minutes for a "transactions in the last hour" feature, based on event time. An event's timestamp falls 8 minutes behind where the watermark has already advanced. What happens to that event, and what does it do to the feature?

Q3. Your fraud model trains on features at transaction time with labels available 7 days later (when chargebacks are processed). The last 7 days of data in your training set have systematically lower fraud rates than older data. Why?

Q4. Design a label generation system for a recommender model where user engagement signals arrive with varying latency (watch completion: 0-2h, like: 0-7d, share: 0-30d).

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →