advanced24 min studyLesson 827 in Engineering

Build graph state from information available at prediction time

Separate event time, arrival time, tie policy and state-update order.

On this page

What you’ll understand

  • Filter historical events by both occurrence and availability.
  • Predict before applying the event being predicted.
  • Handle late arrivals and temporal identity without silently rewriting history.

A temporal graph is more than a static adjacency matrix with a timestamp column. Edges, features and node states become available over time, and a prediction must use only the information its deployed system could have known then. Event occurrence time and system availability time can differ. Treating those timestamps as interchangeable can leak late or future information into training and produce an evaluation that no online implementation can reproduce.

Define the information boundary

Let an event have an occurrence timestamp and a timestamp when its usable record became available. For a query at time q, this lesson admits events strictly earlier than q that were available no later than q. A different application can choose an inclusive event-time boundary, but it must resolve simultaneous events consistently. A timestamp alone may not order events with equal times, so use a declared tie key or a simultaneous-batch rule. Features and corrections need the same availability discipline as edges.

An offline warehouse can contain late records whose event times precede a historical query even though the records arrived afterward. Filtering only event time would grant the historical predictor knowledge it lacked. Conversely, a very recent available event can still be disallowed by a task’s strict event-time rule. PyTorch Geometric 2.7.0 NeighborLoader documents a timestamp constraint with earlier-or-equal neighbors; that API condition alone does not establish an application’s ingestion-time availability or implement the stricter boundary adopted here.

E(q)={e:tevent(e)<q ∧ tavailable(e)≤q}\mathcal E(q)=\{e:t_{\rm event}(e)<q\ \land\ t_{\rm available}(e)\le q\}
All timestamps use the same declared time unit and reference clock. This is an application information-set rule, not a claim that one graph loader automatically enforces both fields or a strict event-time inequality.↔ Scroll wide equations horizontally.

Prediction and memory update have an order

A temporal encoder can maintain node memory updated by prior interactions. When predicting an interaction, compute its score from the eligible prior state and only then update memory with the observed interaction under the chosen protocol. Updating first can expose the target itself. Temporal Graph Networks make memory and event-driven updates explicit, but their architecture does not excuse a pipeline from enforcing the evaluation’s information boundary. Batching several events together also needs a policy preventing later batch events from influencing earlier predictions.

Late arrivals pose a state-reconstruction question. An additive state can sometimes incorporate a delayed event directly; an order-sensitive recurrent update may require replay from a checkpoint in event order or a deliberately different arrival-order model. Replaying with newly arrived history can improve a current prediction but must not overwrite what an earlier prediction was allowed to see. Preserve state or event-log versions for reproducibility. Two requests for the same node at different cutoffs can therefore require different representations and cannot be merged solely by node ID.

sj=U ⁣(sj−1,eπ(j)),eπ(j)∈E(q)s_j=U\!\left(s_{j-1},e_{\pi(j)}\right),\qquad e_{\pi(j)}\in\mathcal E(q)
pi orders the eligible events by the application’s declared event/tie policy and U is its state update. State units depend on the model. A different order need not give the same state unless U has the required algebraic properties.↔ Scroll wide equations horizontally.

Keep historical evaluation reproducible

Version the event log, availability timestamps, feature snapshots, state initialization and ordering policy. Report whether validation or test events update memory after being scored; online adaptation and a frozen-state evaluation answer different questions. Ensure negative candidates and derived degree features obey the same cutoff. A future-computed aggregate can leak even when the raw target edge is removed. Audit small timelines by hand before trusting a large temporal sampler, including late arrivals, tied timestamps and repeated interactions between the same nodes.

The Markov lab illustrates ordered state transitions in a deliberately simple family. Reset and set both p=1 and q=1. Predict probability one in state 0 initially, probability one in state 1 after one Step, then probability one in state 0 after a second Step. Each Step advances one transition. This exact alternating chain is neither a sampled event stream nor a temporal GNN. It makes before-update and after-update states visibly different without claiming to enforce real event-time or availability rules.

A late event is unavailable to an earlier query

An additive toy node state starts at zero. Event A occurs at t=2, becomes available at 2 and adds 3. B occurs at 5, becomes available at 8 and adds 7. C occurs at 7, becomes available at 7 and adds 4. Use strict earlier event time and availability no later than the query.

  1. At query time q=6, only A qualifies. B occurred earlier but is not available until 8, while C has not occurred. The permitted state is therefore 3, not the sum of every event with occurrence time below 6.

  2. An event-time-only reconstruction would include B and produce 3+7=10 at q=6. Its extra seven units are leakage from a record the system could not yet access, even though B’s occurrence timestamp is in the past.

  3. At q=9, A, B and C all qualify, so this explicitly additive state is 3+7+4=14. A noncommutative recurrent updater would additionally need a justified replay or arrival-order policy; this additive example does not remove that requirement.

The result

The correct historical state depends on availability as well as occurrence. Saving only the final state 14 would not reconstruct the information permitted at q=6.

Explore the model

Interactive lab

Interactive lab · markov

Read the state before advancing it

Reset → set p=1 and q=1 → predict initial (1,0), first Step (0,1), second Step (1,0). The half-second Step corresponds to one discrete transition.

Read the state before advancing itExact finite-step probabilities for a two-state chain starting in state 0, not sampled trajectories. Playback advances two transitions per second. When p = q = 0 every distribution is stationary; when p = q = 1 the chain alternates forever. A single zero transition creates an absorbing state. Current readings: P(state 1) at step 0: 0%; Stationary P(state 1): 60%; Chain behavior: Monotone convergence. All parameters are adjustable with the labeled controls below.Two-state Markov distribution after 0 steps: state zero probability 1, state one probability 0.Initial distribution (1, 0) · step 0p = 0.3q = 0.201100%0%1−p1−qP(0)P(1)Monotone convergence
P(state 0)P(state 1)Stationary distribution
P(state 1) at step 0
0%
Stationary P(state 1)
60%
Chain behavior
Monotone convergence
t = 0 s

Exact finite-step probabilities for a two-state chain starting in state 0, not sampled trajectories. Playback advances two transitions per second. When p = q = 0 every distribution is stationary; when p = q = 1 the chain alternates forever. A single zero transition creates an absorbing state. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forThis exact two-state alternating chain highlights update order. It has no graph events, late arrivals, learned memory or causal sampling filter.

Check your understanding

An event occurred before a historical query but became available afterward. Under this lesson’s rule, may it influence that query?

Try it yourself

An additive state starts at zero. Event D occurs at 1, arrives at 4 and adds 2. E occurs at 3, arrives at 3 and adds 5. Find permitted states at q=3.5 and q=5. Would sorting solely by arrival time necessarily reproduce a noncommutative event-time updater?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Test both timestamp conditions at each query. The additive total can hide an ordering issue that a general update function would expose.

Compare with the solution

At q=3.5, only E is available, so state is 5. At q=5, both events qualify and the additive total is 7. Arrival order is E then D, whereas event-time order is D then E. A noncommutative updater need not agree across those orders and would require a declared arrival-order interpretation or appropriate replay.

Take it with you

  • Historical eligibility includes availability, not just occurrence time.
  • Score an event before letting that target update predictive memory.
  • Temporal cutoffs and ordering belong in the identity of reconstructed state.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.