Data and Knowledge SystemsIngestion and freshnessStaff
How do you prevent late-arriving data from leaking into historical training features?
By Amit Kumar4 min readWorked answer includedReviewed 27 Sept 2026
The question
Interview question
A fraud model uses a customer’s payment count from the previous 24 hours. A delayed payment occurred before yesterday’s prediction but became available to the scoring path only today. An offline join filters by event time and includes it in yesterday’s feature row. Explain the information leak, design a reproducible historical join, and retain useful late data for future predictions. Address feature-store timestamp options and missing historical availability records.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
We need two clocks. The payment's event time says when it happened. Its availability time says when the scoring system could have known it. At 10:00 yesterday, the live model might have seen four payments. Today's reconstructed table shows five payments with event times before 10:00. A join that only checks event time has made yesterday's model clairvoyant.
This is a subtle distinction because a normal point-in-time join does prevent one kind of leakage, where it takes a feature event from after the decision. It does not necessarily prevent a backfill written later with an earlier event timestamp from entering the historical result. Feast's point-in-time join documentation explicitly distinguishes this case. Its created timestamp can break ties between records with the same event timestamp without generally limiting the join to what had arrived by the decision time. Do not infer availability filtering from a column name. In the documentation checked for this review, Feast also exposes an explicit filter_by_created_timestamp=True option, with support and behavior depending on the offline store and timestamp configuration. Verify that its created timestamp represents real serving availability, not merely a later warehouse-copy timestamp.
I would reconstruct the actual serving view for a sampled decision. Store the decision ID and timestamp, feature definition version, materialization or stream watermark, value returned, missing-value fallback and, where permitted, the feature record's observed-at revision. Compare that with the offline row for the same decision. If the count differs, work backward through late arrivals, corrections, TTL, timezone boundaries and duplicate event handling. A model-quality dashboard by itself will not tell us which join changed.
For a reproducible training set, define the prediction cutoff precisely. Join records whose event time is within the intended window and whose availability is no later than the cutoff, or replay a versioned online-state log as it existed then. If ingestion time is just when a warehouse copied an already available online event, it is the wrong availability clock. We need the first time the serving path could actually use that value. Sometimes that clock was never recorded. Then we cannot claim an exact historical replay. We can use prospective shadow logging to build a clean set and label older analysis as an approximation.
A concrete historical condition has two parts. For a prediction at 10:00, the payment must fall within the selected 24-hour event-time interval and have been available by 10:00. A 09:50 payment first usable at 10:05 fails the second condition for this prediction but may qualify for a 10:10 prediction. If the feature is an aggregate computed from several payments, preserving only the final aggregate’s event timestamp may lose the availability history needed to reproduce it.
The online and offline feature definitions should share the same semantic contract: entity key, time window, inclusion rules, handling of reversals, late events, missing values and freshness limit. Sharing source code helps, but does not fix an online stream that drops late events while offline recomputation includes them. Feast feature retrieval describes the different historical and online retrieval paths. Test their outputs on the same timestamped cases, including a late event and an event corrected after the decision.
What if a late payment is genuinely useful for tomorrow's decisions? Of course we should include it when it becomes visible. The rule is about what yesterday's model knew yesterday, not whether the event must be discarded forever. Recompute current aggregates with the correction if policy permits, keep the old decision's observed feature immutable, and make any later evaluation distinguish original decisions from hindsight reconstructions.
Before restoring traffic, I would compare the new training set with logged serving values by cohort, inspect feature null rates and delayed-event rates, retrain if the leakage materially changed the target relationship, then run a shadow period and a guarded rollout. The decisive test is simple: can I take one past prediction and show the exact information that was available at that instant? Three data sources are current and one is a day behind. Is the AI report current? asks when a report with several sources is fresh. Here the source can be historically complete yet still wrong for training a model that made decisions in real time.
Related questions
- How should ingestion scheduling protect tenant freshness under repeated edits and bulk imports?Principal
- How should an ingestion worker identify and activate the correct document revision after replay?Staff
- How do you build a search index from a snapshot and change stream without losing updates or reviving deletions?Principal
Keep practising data and knowledge systems
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux