Efficient User Sequence Learning for Online Services via Compressed Graph Neural Networks

Yucheng Wu, Liyue Chen, Yu Cheng, Shuai Chen, Jinyu Xu, Leye Wang

Introduction

In modern online services, understanding user behavior sequences—such as the path from search to purchase—is critical for tasks like fraud detection and personalized recommendations. Traditional sequence models like LSTMs and Transformers excel at capturing individual temporal patterns but often fail to account for the broader relational context across the entire user base. Graph Neural Networks (GNNs) offer a solution by modeling sequences as nodes in a graph, yet they face significant "scalability walls" in production environments. Real-world services involve millions of users, leading to massive graphs that exceed GPU memory and introduce unacceptable inference latency for real-time applications.

To bridge this gap, we introduce ECSeq (Efficient Compressed Sequence learning), a novel framework that brings the power of GNNs to real-time user behavior modeling through graph compression. By representing millions of user sequences with a small set of representative nodes, ECSeq achieves significant performance gains while maintaining the microsecond-level inference speeds required for online deployment.

The ECSeq Framework

ECSeq is designed as a two-stage, "plug-and-play" framework that can enhance existing sequence models without requiring them to be redesigned.

1. Sequence Embedding Extraction

First, a base model (such as an LSTM or Transformer) converts raw user events into a fixed-length vector embedding. This stage captures the local temporal dynamics of a single user's history.

2. Relational Modeling via Graph Compression

Instead of building a GNN on all $N$ users, ECSeq compresses the graph into $K$ representative nodes ($K \ll N$). This approach is based on the insight that in massive datasets, many user sequences are nearly identical, making it unnecessary to model every single one as a unique node.

  • Compression Techniques: The framework supports multiple methods for selecting representatives, including k-means clustering to find central patterns and Grain (a social influence-based selection method).
  • Training and Inference: The GNN is trained only on this tiny, compressed graph. To ensure the model generalizes to new data, a "bridge" mechanism is used where original sequences aggregate information from the representative nodes. When a new sequence arrives during inference, it is simply connected to the $K$ representatives, and a quick message-passing step refines its representation based on its "neighbors" in the compressed space.

Experimental Evaluation

The framework was evaluated on four datasets across two distinct tasks: fraud detection (FD1 and FD2 credit card transaction datasets) and user mobility (NYC bike-sharing and PEMS-BAY traffic speed datasets).

Key Results

  • Performance Boost: On the FD1 dataset, ECSeq improved the Recall@Precision=0.9 (a critical metric for minimizing false positives in fraud detection) of a standard LSTM by approximately 5%.
  • Resource Efficiency: While a full-graph GNN crashed due to Out-of-Memory (OOM) errors on an 11GB GPU, ECSeq operated comfortably using only ~1GB of RAM.
  • Real-Time Viability: Training on over 100,000 sequences took only tens of seconds. Most importantly, inference time was kept under $10^{-4}$ seconds per sample, making it viable for high-throughput production environments.
  • Flexibility: ECSeq proved effective regardless of whether the base model was an LSTM or a Transformer, and whether the GNN architecture used was GCN, GraphSAGE, or GAT.

Strategic Insights

Beyond raw performance, ECSeq offers several strategic advantages for online service providers:

  1. Sample Balancing: In fraud detection, legitimate transactions vastly outnumber fraudulent ones. ECSeq allows for the "over-representation" of fraudulent patterns in the compressed graph, helping the GNN learn from scarce but critical positive samples.
  2. Interpretability: Because the compressed nodes correspond to real user behavior patterns, the model's output is more interpretable. If a transaction is flagged, developers can identify which "representative" fraudulent sequences it most closely resembles.
  3. Seamless Integration: ECSeq acts as an add-on module. A pre-trained LSTM already in production can be "boosted" with ECSeq’s relational modeling without the need to retrain the base sequence extractor.

Conclusion and Future Work

ECSeq demonstrates that graph compression is a powerful tool for overcoming the computational hurdles of GNNs in real-world settings. By focusing on representative behavior patterns rather than individual nodes, the framework achieves a balance of accuracy and efficiency. Future research will explore heterogeneous graph compression to incorporate multiple types of user relationships—such as shared IP addresses, devices, and social links—simultaneously into the compressed representation.

Summary updated

BibTeX
@inproceedings{wu2024efficient,
  author = {Yucheng Wu and Liyue Chen and Yu Cheng and Shuai Chen and Jinyu Xu and Leye Wang},
  title = {{Efficient User Sequence Learning for Online Services via Compressed Graph Neural Networks}},
  booktitle = {ICWS},
  year = {2024},
}
Figure