Introduction
Temporal Graph Neural Networks (TGNNs) have emerged as the state-of-the-art for modeling dynamic systems such as social networks, financial transaction logs, and recommendation engines. Unlike static graphs, TGNNs capture the evolution of relationships over time, making them indispensable for real-time predictive tasks. However, deploying these models in production environments is often hindered by high inference latency on general-purpose hardware. This paper presents a hardware-software co-design approach to accelerate TGNN inference on FPGAs, achieving significant speedups while maintaining high accuracy.
The Bottlenecks of Temporal GNNs
Despite their predictive power, TGNNs face two primary bottlenecks that make them difficult to scale on standard CPU or GPU architectures:
- Computational Complexity: Most TGNNs rely on Temporal Attention mechanisms (similar to Transformers). This requires calculating "keys" and "queries" for every neighbor in a graph, a process that is computationally expensive when dealing with high-velocity streaming data.
- Sequential Dependencies: Temporal graphs require nodes to be updated in strict chronological order to maintain causality. This "temporal data dependency" makes it difficult to parallelize tasks on GPUs, which are optimized for large, independent batches rather than the small, frequent updates typical of real-time environments.
Methods: A Co-Design Approach
The authors address these challenges through a dual-pronged strategy involving algorithmic simplification and custom hardware architecture.
Algorithmic Optimizations
To reduce the computational burden, the researchers introduced several model-level optimizations:
- Simplified Temporal Attention: Instead of standard Transformer-style attention, the model uses a lightweight version where attention scores are primarily computed based on the time difference ($\Delta t$) between events. This shifts the heavy lifting to a time-based heuristic.
- Temporal Neighbor Pruning: Because the simplified attention is cheaper to compute, the system can identify and "prune" less important neighbors before fetching their full feature vectors from memory, saving significant bandwidth.
- Knowledge Distillation: To ensure the simplified "Student" model does not lose accuracy, it is trained using a "Teacher-Student" approach, where the original, complex TGNN (the Teacher) guides the learning process.
- LUT-based Time Encoding: Expensive trigonometric functions used for time encoding are replaced with hardware-native Look-Up Tables (LUTs).
Hardware Architecture
The FPGA architecture was designed to handle the specific data flow of TGNNs:
- The Updater: A custom hardware module that utilizes a fully-associative cache with rotating pointers. This ensures that node memories are updated in the correct chronological order even when processing multiple edges in parallel.
- On-chip Sampler: A high-speed, FIFO-based hardware sampler replaces traditional software-based sampling, reducing the overhead of neighbor discovery.
- Pipelining and Prefetching: The architecture overlaps memory access with computation. While the system calculates attention scores for one batch, it simultaneously prefetches features for the next set of likely neighbors, hiding the latency of external DDR memory access.
Experimental Results
The proposed design was evaluated on three real-world dynamic graph datasets: Wikipedia (user-page edits), Reddit (user posts), and GDELT (global events).
Performance and Efficiency
On a Xilinx Alveo U200 FPGA, the co-designed system demonstrated remarkable efficiency gains:
- Latency Speedup: The accelerator achieved a 16.4× speedup compared to a CPU and a 2.3× speedup over a high-end GPU (Titan Xp).
- Resource Reduction: The model reduced computational complexity by 84% and memory accesses by 67%.
- Accuracy Preservation: Despite the massive simplifications, the accuracy loss was negligible, remaining under 0.33% across all datasets.
Conclusion and Future Work
This research demonstrates that by shifting the heavy lifting of attention to time-based heuristics and utilizing custom hardware to manage temporal dependencies, TGNNs can achieve the sub-10ms latency required for millisecond-scale fraud detection and recommendation systems.
Future work will focus on scaling the design to handle "trillion-edge" graphs through multi-FPGA clusters and refining performance models to better account for unpredictable DDR refresh cycles and compiler-driven stalls.
Summary updated