Bridging the Divide: End-to-End Sequence–Graph Learning

Yuen Chen, Yulun Wu, Samuel Sharpe, Igor Melnyk, Nam H Nguyen, Furong Huang, C. Bayan Bruss, Rizal Fathony

TL;DR

Real-world systems frequently involve entities that produce time-ordered event histories while embedded in relational networks (e.g., users browsing items while linked to friends). BRIDGE unifies sequence encoders and Graph Neural Networks (GNNs) into an end-to-end architecture, eliminating the performance bottleneck of frozen representations. Coupled with TOKENXATTN, a novel token-level cross-attention layer, it enables individual events within neighboring sequences to attend directly to one another across the graph.

What Problem Does This Paper Address?

Many machine learning applications operate in a "sequence-on-graph" regime. For instance, in social networks or e-commerce platforms, users generate private event streams (logins, item views, ratings), while also maintaining relational connections (friendships, co-reviews).

Existing approaches usually fall short when handling this multimodal interplay:

  • Static GNNs condense entire event histories into a single static feature vector per node, throwing away temporal ordering and fine-grained event dynamics.
  • Temporal Graph Networks (TGNs) model temporal sequences as timestamped edges between entities. However, personal intransitive actions (e.g., "login", "view item") involve only a single user; forcing them into a graph structure requires adding dummy event nodes (creating artificial high-degree hubs) or self-loops.
  • Spatio-Temporal GNNs typically assume synchronized, fixed-interval time steps across all nodes, which fails on asynchronous, variable-length event streams.
  • Two-stage pipelines pre-train a sequence model, freeze its representations, and feed them into a GNN, preventing the sequence encoder from learning task-specific relational signals.

Methods

The authors introduce a dual-level solution:

  1. BRIDGE (Model-Level Framework): An end-to-end framework where a sequential encoder (such as BERT) first maps each node's event sequence $S_i$ into embedding matrices $X_i \in \mathbb{R}^{M_i \times d}$. These representations are passed directly into a GNN module, allowing end-to-end gradient flow across both sequential and relational parameters under a single task objective.
  2. TOKENXATTN (Layer-Level Message Passing): Rather than compressing sequence $X_i$ into a single node vector via pooling before graph propagation, TOKENXATTN computes token-wise cross-attention between connected nodes: $$Q_i = X_i W_Q, \quad K_j = X_j W_K, \quad V_j = X_j W_V$$ $$A_{i \leftarrow j} = \text{softmax}\left(\frac{Q_i K_j^\top}{\sqrt{d_h}}\right), \quad H_{i \leftarrow j} = A_{i \leftarrow j} V_j$$ Messages $H_{i \leftarrow j}$ from neighbor $j$ preserve sequence length $M_i$. They are aggregated across all neighbors $j \in \mathcal{N}(i)$ using standard graph weighting schemes (e.g., GCN, GAT, or mean pooling), followed by a residual connection. Standard GNN layers are stacked on top to capture multi-hop relational dependencies.
Individual Event Sequences           Token-Level Cross-Attention          Relational Graph
[User A: Login -> Search -> Buy]  <-------- TOKENXATTN -------->  [User B: Login -> Review]
               \                                                       /
                \=========> End-to-End Task-Aligned Updates <=========/

Datasets

The authors evaluate BRIDGE across two distinct tasks:

  • Friendship Prediction (Link Ranking):
  • Brightkite: Location-based social network check-ins. Check-in coordinates are converted to Geohash-8 format and broken down into 4 hierarchical resolution tokens.
  • Amazon (Clothing, Electronics, Musical): Sequences of product interactions and ratings; relational graphs are formed by co-review links (users connected if they co-reviewed $\ge 3$ products).
  • Fraud Detection (Node Classification):
  • Amazon (Movies, Electronics, Clothing): Sequences consist of product IDs, ratings, and review texts encoded via Sentence-BERT. Users with $\ge 5$ reviews where $>70\%$ of reviews received unhelpful votes are labeled as fraudulent.

Key Insights and Ideas

  • End-to-end learning avoids semantic drift: End-to-end optimization (BRIDGE-GCN) consistently beats two-stage pipelines (GCN + S) where sequence representations are pre-trained with masked language modeling and frozen. Relational gradients help the sequence encoder extract task-relevant features.
  • Cross-sequence event alignment matters: Pooling a sequence into a single node vector destroys temporal correspondence. TOKENXATTN allows specific events (e.g., a specific product purchase or check-in location) to interact directly with related events in a neighbor's history.
  • Graph reification can backfire: Modeling personal user events as edges to global event nodes (as required by temporal graph models like TGN or DyRep) introduces artificial graph hubs (e.g., thousands of users connected to a generic "login" node), resulting in inferior performance.

Key Results

  • Link Prediction / Friendship Ranking (MRR & Hits@k):
  • On Brightkite, BRIDGE-TOKENXATTN achieved 92.9 MRR, substantially outperforming temporal graph baselines (TGN: 38.7 MRR) and two-stage TransformerConv + S (72.7 MRR).
  • Across Amazon-Clothing, BRIDGE-TOKENXATTN scored 70.3 MRR, compared to 31.7 for the strongest dynamic baseline (TNCN) and 18.8 for standard TransformerConv.
  • On Amazon-Electronics and Amazon-Musical, BRIDGE-TOKENXATTN reached 76.6 and 54.7 MRR, maintaining clear margins over static and temporal baselines.
  • Fraud Detection (Max F1 & PR-AUC):
  • Across all categories, performance followed a strict hierarchy: Graph-Only < Temporal Graph < Sequence-Only (SBERT) < BRIDGE.
  • On Amazon-Electronics, BRIDGE-TOKENXATTN achieved 51.6 PR-AUC and 49.2 Max F1, outperforming pure text SBERT (38.7 PR-AUC) and TGN (9.0 PR-AUC).

Limitations and Future Work

  • Absence of continuous timestamps: BRIDGE preserves the relative sequence order of events but does not explicitly incorporate absolute timestamps or variable inter-event elapsed times into the attention mechanisms.
  • Attention complexity: Cross-attending between all tokens of neighboring nodes incurs a computational complexity of $\mathcal{O}(M_i M_j)$ per edge, which scales quadratically with sequence length. The authors note that linear attention approximations or token-patching mechanisms will be necessary for extremely long histories.

Summary updated

BibTeX
@inproceedings{chen2025bridging,
  author = {Yuen Chen and Yulun Wu and Samuel Sharpe and Igor Melnyk and Nam H Nguyen and Furong Huang and C. Bayan Bruss and Rizal Fathony},
  title = {{Bridging the Divide: End-to-End Sequence–Graph Learning}},
  booktitle = {NPGML @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=xa7WxSc08h},
}
Figure