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
- Design your training pipeline around label delay from day one — decide the label cutoff window empirically and build a consistent data split that respects it. Models trained with inconsistent label windows give unreliable offline metrics. If chargebacks arrive over 7 days, your training data from the last 7 days has systematically under-labeled positives. Either exclude that window entirely or weight labels by expected completeness at training time. The completeness curve — fraction of expected labels received as a function of days since the event — tells you exactly where to draw the line.
- Trap: using processing time instead of event time for feature windows produces features that drift with pipeline latency. "Transactions in the last hour" computed from processing time expands and contracts as pipeline throughput varies. Use event timestamps for all business logic. This requires watermarks that account for the actual lateness distribution of your data source — measure the 99th percentile of event arrival lag and set your watermark tolerance accordingly.
- Diagnostic: plot the distribution of event arrival lag (event time vs processing time) for your specific data source. Set your watermark tolerance to that measured 99th-percentile lag itself, not a flat round number — a p99 lag of 45 minutes needs roughly a 45-minute tolerance, not 5. If that tolerance is longer than your feature windows, either widen the windows or accept that the slowest stragglers get dropped. Re-measure this distribution whenever upstream systems change — a new mobile OS version, a new attribution pipeline, or a new data collection method can shift the completeness curve significantly.
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
- Label delay: truth arrives after the event — chargeback filed 7 days on. Recent week looks fraud-free because evidence hasn't shown up.
- Don't guess the wait, measure it: the completeness curve = fraction of labels in by day 1/3/7. Set incubation at the 99th percentile.
- Late data wrecks features too: "txns last 5 min" at 14:02 misses a phone uploading at 14:04. Bias, not noise — undercounts flaky connectivity.
- Watermark = "everything up to T is in." Too tight drops real events, too loose waits on stragglers.
- Use event time (when it happened), never processing time (when received).
- Events always arrive out of order — retries, clock skew, delayed uploads. Design for it from the start.
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.
- A) Mobile devices batch-upload events when reconnected, so clicks arrive 2-12 hours after the 1-hour cutoff and are labeled as no-clicks
- B) Mobile users inherently have lower CTR than desktop users because smaller touch targets reduce tap accuracy by roughly 30%
- C) The fix is to measure click lateness by platform and extend the mobile label incubation window to 24-48 hours
- D) The correct fix is to always use an infinite label window and retrain only once every event in history has arrived
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?
- A) The watermark automatically widens its tolerance to 8 minutes for this one event and includes it in the window anyway
- B) The event arrived past the watermark's tolerance, so it is treated as too late — dropped or handled separately — and the feature undercounts by at least one event
- C) The pipeline falls back to processing time for this event only, since it missed its event-time cutoff
- D) The window stays open indefinitely until every late event has arrived, however long that takes, so the count stays fully accurate
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?
- A) Fraud rates are genuinely lower in recent data because the model's production deployment 6 weeks ago has already reduced the underlying fraud rate by roughly 15%
- B) This is delayed feedback bias — recent transactions haven't yet received chargebacks, so they show near-zero positive labels; fix by excluding data newer than the resolution time
- C) Recent data is lower quality because the Spark ingestion pipeline has a 3-day processing backlog; exclude the last 7 days from all features, not just labels
- D) The lower fraud rate in recent data is correct — fraudsters adapt to detection models within a 2-3 week cycle and become less detectable over time, which the training set accurately reflects
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).
- A) Wait a full 30 days for all signals before generating any label at all, since a fixed engineering rule holds that incomplete data always corrupts a model more severely than training delay costs ever could
- B) Use only watch completion as the label since it arrives within 2 hours and correlates at r=0.9 with long-term satisfaction; discard likes and shares entirely
- C) Define per-signal incubation periods (watch at t+4h, like at t+10d, share at t+35d) and use completeness-weighted multi-stage labels, monitoring the completeness curves quarterly
- D) Use a single fixed 24-hour cutoff for all three signal types and apply equal weight of 0.33 each — this balances recency against completeness
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 →