Norm-Preserving Attention for Directed, Typed Event Streams

Many real systems produce a stream of timestamped, one-way interactions between entities of different kinds. A process writes a file, a paper cites an older paper, a county reports cases to a state. Graph neural networks (models that update each node's vector by mixing in its neighbors' vectors) have handled each of these properties separately. Some respect edge direction, some respect entity types, some decide how much each neighbor matters, and some consume continuous-time event streams. The methods that do several of these at once share one weakness. They weight neighbors with softmax attention, which averages incoming messages and so shrinks signal as it passes from node to node. The methods that carry signal over long distances without shrinking it are either restricted to one entity type or to static graphs. We propose one event-update rule that has all four properties and still conserves the signal's total size. Each interaction becomes a small rotation that exchanges information between its two endpoints. How much the endpoints exchange is learned from their features. Which way the edge points and what relation it carries set the rotation's phase. The time since the last event sets how far the rotation turns.

The second half of the proposal is diagnostic. On cybersecurity provenance graphs, explicitly encoding edge direction in a temporal graph network did not help (Anomaly Detection in Continuous-Time Temporal Provenance Graphs). On static directed graphs, direction-aware models win by large margins. We think the explanation is simple. In typed graphs, the relation type often already implies the direction: a "write" edge always goes from a process to a file. Direction can therefore only add information on edges where the types do not already fix it, such as process-to-process clones or paper-to-paper citations. We will measure this redundancy per dataset and test whether it predicts when direction-aware modeling pays off.

Core Claim

Neighbor weighting that depends on the input does not have to shrink the signal. Suppose an event $(u, v, r, \Delta t)$ arrives: node $u$ of one type interacts with node $v$ over relation $r$, and $\Delta t$ time units have passed since the pair was last updated. Let $h_u, h_v \in \mathbb{C}^d$ be the endpoints' complex state vectors, each produced by a type-specific encoder into a shared dimension $d$. We update them jointly with

$$ \begin{bmatrix} h_u \\ h_v \end{bmatrix} \leftarrow \exp\!\left(\Delta t \begin{bmatrix} S_u & a_{uv} e^{i\theta_r} M_r \\ -a_{uv} e^{-i\theta_r} M_r^{\dagger} & S_v \end{bmatrix}\right)\begin{bmatrix} h_u \\ h_v \end{bmatrix} + B_r x_{uv}. $$

The symbols are as follows. $S_u$ and $S_v$ are type-specific skew-Hermitian matrices, which drive each node's own evolution between events. $M_r$ is a learned coupling block for relation $r$, and $M_r^{\dagger}$ is its conjugate transpose. $\theta_r$ is a learned phase for relation $r$, and its sign flips with edge direction. $a_{uv} \ge 0$ is a coupling strength computed from the two endpoints' states, for example a sigmoid of a query–key product. $x_{uv}$ holds the event's features, and $B_r$ is a relation-specific input map.

The block matrix is skew-Hermitian by construction, so its matrix exponential is unitary. This means the update conserves the combined norm of the two states: information moves between the endpoints instead of being averaged away. The attention weight $a_{uv}$ needs no softmax normalization over neighbors, because the unitary map keeps activations bounded no matter how large the weight is. The source receives a phase-rotated copy of the target and the target receives the conjugate rotation, so initiator and recipient are treated differently. In Dune, direction likewise enters as a phase on a Hermitian operator, and our phase plays the same role. Longer gaps between events turn the rotation further, which makes time act on the geometry of the interaction, not only on the input features.

The input term $B_r x_{uv}$ is the only way new information enters. Following CTAN, we damp it with a small stability parameter so the Euler-style step stays well behaved.

Relation to Prior Work

The method draws on two lines of work on stable propagation. Anti-Symmetric DGN and CTAN write message passing as an ordinary differential equation whose weight matrix is anti-symmetric, so signals neither fade nor blow up. CTAN extends this to continuous-time event streams and reports near-perfect accuracy on T-PathGraph at path length 20, where TGN and JODIE collapse. Dune builds unitary convolutions from a Hermitian projection of the directed adjacency matrix and stays stable beyond 100 layers.

These methods supply our mechanism but leave out what we add. CTAN uses one node type, one relation type, and a coupling that does not depend on the input. Dune works on static graphs and compresses each edge into a single complex scalar. We keep their conservation property and add typed encoders, relation-specific coupling blocks, and learned coupling strengths. We also move from whole-graph operators to two-node event updates, which is what lets the method run on a stream.

A second line of work motivates the proposal. HTGNN, HGT, DHGAS and THGFM all combine entity types, neighbor attention and time. All four normalize attention with softmax. HTGNN reports that its performance degrades as depth grows. HTGNN and DHGAS also operate on discrete time slices. THGFM's rotary temporal attention rotates queries and keys by the time offset and gains +3.25% on average over prior methods. Our update is closest in spirit to THGFM, since time also acts there as a rotation. The difference is that THGFM applies the rotation only inside the attention score, while we apply it to the node state itself.

CSG-ODE also enforces anti-symmetry and weights edges dynamically. It assumes a fixed topology with a single node type, and its edge-importance computation costs $O(N^3)$. Our update costs a constant amount per event.

The provenance study (Reha et al.) constrains the design. It shows that direction flags added on top of a typed temporal network can be invisible to the model. We read that result as evidence about how much information direction carries in typed graphs, not as evidence that direction-aware models fail. Abu-El-Haija et al. separate each node into a source embedding and a target embedding and report up to 76.8% error reduction on wiki-vote. That graph is untyped, so its type information cannot already fix any edge's direction. This supports our reading.

Research Program

We will build the update rule as an event-driven module in the style of a temporal graph network. Decoders will score future links and classify nodes. The matrix exponential will use a low-order Taylor expansion as in Dune. We will re-unitarize periodically and track the numerical drift this introduces.

The analysis has three parts. First, for each dataset we compute the conditional entropy of edge direction given the triple (source type, relation, target type). This number measures how much the schema already reveals about direction. We also compute the fraction of events that fall on type-ambiguous triples. The redundancy hypothesis predicts that direction-aware gains are concentrated on those events.

Second, we measure each task's dependency horizon: how many hops, and how much elapsed time, separate an event from the evidence needed to predict it. We estimate this from gradient attribution under the model and under the baselines. The horizon tells us whether conservation matters on a task at all.

Third, we build a heterogeneous, directed version of CTAN's T-PathGraph. Its paths alternate among node types. The terminal label depends on information from the source node, and it also depends on the direction of edges that connect nodes of the same type. This design separates three abilities: carrying signal over long distances, handling types, and using direction that the types do not reveal.

Baselines

The naive reference point is a memorization rule: predict that an edge will occur if it occurred before, and use the event's position in the log as its anomaly score. Any learned model must clear this rule, because provenance logs contain many repeated benign events.

The strongest existing competitors on real continuous-time typed directed data are the Hetero-TGN and HGT-TGN variants from Reha et al.. They report that their best models reach anomaly-detection area-under-curve scores (AuCAD) "in the high 80s and low 90s" on DARPA THEIA and TRACE. The file gives no per-variant numbers, so we will rerun these models ourselves. Beating them means a higher AuCAD on both datasets across at least five seeds, with non-overlapping confidence intervals. It also means fewer false alarms on high-frequency benign processes such as firefox, which that paper names as a failure case.

On typed academic graphs, the strongest competitor is THGFM. It reports a +12.37% relative gain over HGT on OAG-CS paper–venue prediction. The file gives no absolute accuracy, so we will reproduce THGFM and HGT on identical splits.

For long-range propagation, the reference is CTAN, with its near-perfect T-PathGraph accuracy up to length 20 and its gain of up to 65% in F1 on T-PascalVOC. We will also run a typed version of CTAN, with our type encoders but its fixed anti-symmetric coupling. This typed version is the most direct competitor of all.

All models receive the same event streams, the same chronological splits, the same state dimension (counting a complex dimension as two real dimensions), and an equal hyperparameter search budget of 30 trials per model. Wall-clock time will be reported alongside accuracy.

Four ablations isolate the key ingredient. The first replaces our unitary update with a softmax-attention update that uses identical parameters, which isolates the effect of conservation. The second sets $a_{uv}$ to a constant, which isolates the effect of learned neighbor weighting and turns the model into typed CTAN. The third sets $\theta_r = 0$, which removes direction. The fourth keeps the phase only on type-ambiguous triples.

Why not just…?

Why not just add type-specific encoders to CTAN? This is the most serious threat. It inherits CTAN's long-range stability and handles types cheaply. The only thing it lacks is coupling that depends on the input. We include it as a baseline. If it matches our model on DARPA and on the typed path benchmark, then learned neighbor weighting adds nothing once conservation is in place, and we will report that result. Our expectation that it falls short rests on DeepInf (Qiu et al.) and on fraud detection under heterophily (Chikwendu et al.). Both show that attention filters out noisy edges, and provenance graphs are full of benign high-volume noise. That is a hypothesis, not evidence, and the ablation that fixes $a_{uv}$ settles it.

Why not just use HGT-TGN with residual connections and a source/target decoder? Residual connections reduce the shrinking of signal. A dual-embedding decoder in the style of Abu-El-Haija et al. captures asymmetry at the scoring stage. If the real tasks only need short dependency horizons, this combination may tie with our model. The dependency-horizon measurement is designed to reveal exactly that. We commit to reporting our gains stratified by horizon. We will claim an advantage only where the horizon is long, meaning the typed path benchmark and multi-stage attack chains in the DARPA logs.

Why not just flag direction on the type-ambiguous edges? If the redundancy hypothesis is right, this cheap fix could explain most of the direction benefit on real data. We include it as a baseline. If it matches our phase mechanism, the paradox is resolved by the diagnosis alone. The case for the unitary construction would then rest on stability and depth, not on direction.

Why not just stack more THGFM layers? THGFM normalizes attention with softmax, which averages messages and shrinks the signal. HTGNN reports degradation with depth in a similar design. We will scale both THGFM and our model from 2 to 32 effective propagation steps and report where each one stops improving.

Proposed Experiments

The datasets are DARPA E3 THEIA and TRACE, with link-prediction area under the curve (AuCLP) and AuCAD as metrics; OAG-CS and OGBN-MAG, with venue and field prediction and co-author link prediction; Aminer and Ecomm, with link-prediction AUC as in DHGAS; T-PathGraph and T-PascalVOC; and our typed-directed path benchmark.

The decisive checks come in three kinds. The first is the redundancy check: across datasets and across event strata, does the gain from direction track the fraction of type-ambiguous events? The prediction is near-zero gain on type-determined DARPA edges, and positive gain on process-to-process edges and on citations.

The second is the conservation check. On the typed path benchmark, we measure accuracy as path length grows from 5 to 40. The unitary model should stay flat. The softmax ablation should decay. Typed CTAN should stay flat only when the path's edges carry no feature-dependent relevance.

The third is the stability check. Following Ezoe et al.'s concern about embeddings drifting over time (ULSE), we measure how far embeddings drift across time for nodes whose behavior does not change. Conservation should keep their trajectories bounded.