BiTA: Bidirectional Gated Recurrent Unit-Transformer Aggregator in a Temporal Graph Network Framework for Alert Prediction in Computer Networks
Organizations: Faculty of Computer Engineering, Shahrood University of Technology, Shahrood, Iran
Abstract
Proactive alert prediction in computer networks is critical for mitigating evolving cyber threats and enabling timely defensive actions. Temporal Graph Neural Networks (TGNs) provide a principled framework for modeling time-evolving interactions; however, existing TGN-based methods predominantly rely on unidirectional or single-mechanism temporal aggregation, which limits their ability to capture recursive, multi-scale temporal patterns commonly observed in real-world attack behaviors. In this paper, we propose BiTA, a Bidirectional Gated Recurrent Unit-Transformer Aggregator for temporal graph learning. Rather than introducing a deeper or higher-capacity model, BiTA redesigns the temporal aggregation function within the TGN framework by jointly encoding bidirectional sequential dependencies and long-range contextual relations over each node's temporal neighborhood. This aggregation strategy enables complementary temporal reasoning at different scales while preserving the original TGN memory and message-passing structure. We evaluate BiTA on real-world alert datasets, demonstrating significant improvements in key performance metrics such as area under the curve, average precision, mean reciprocal rank, and per-category prediction accuracy when compared to state-of-the-art temporal graph models. BiTA outperforms baseline methods under both transductive and inductive settings, highlighting its robustness and generalization capabilities in dynamic network environments. BiTA is a scalable and interpretable framework for real-time cyber threat anticipation, paving the way toward more intelligent and adaptive intrusion detection systems.
Figures & tables
| Symbol | Description |
|---|---|
| Node indices in the temporal graph | |
| Feature vector of the edge | |
| Timestamp of an interaction event | |
| Temporal interaction tuple | |
| Raw message constructed from interaction at time | |
| Time encoding function |
| Detect Time | Flow Count | Source IP | Target IP | Port | Protocol | Category |
|---|---|---|---|---|---|---|
| 2019-03-11T00:05:00+02:00 | 17094 | 185.192.59.136 | 142.252.135.136 | 22 | TCP | Recon scan |
| 2019-03-12T00:45:00+02:00 | 5113 | 78.234.46.141 | 142.252.32.63 | 443 | TCP | Availability Dos |
| 2019-03-14T00:25:00+02:00 | 39 | 78.234.46.141 | 142.252.32.63 | 22 | UDP | Anomaly.Traffic |
| Event | Attacker | Victim | Time | Edge Feature | Attack Category |
|---|---|---|---|---|---|
| 1 | A | B | 0.2 | DoS | |
| 2 | C | D | 0.5 | Scan | |
| 3 | A | D | ? | ? |
| Aggregator | Class | Transductive | Inductive | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Accuracy | Precision | AUC | Recall | Accuracy | Precision | AUC | Recall | ||
| BiGRU Transformer | Anomaly.Traffic | 0.9761 | 0.9522 | 0.9974 | 0.9639 | 0.9703 | 0.9389 | 0.9839 | 0.9541 |
| Availability.DDoS | 1.0 | 0.9992 | 1.0 | 0.9976 | 1.0 | 1.0 | 1.0 | 1.0 | |
| Availability.DoS | 1.0 | 1.0 | 1.0 | 1.0 | N/A | N/A | N/A | N/A | |
| Recon.Scanning | 0.9505 | 0.9714 | 0.9974 | 0.9635 | 0.8645 | 0.8859 | 0.9730 | 0.8516 | |
| BiTransformer | Anomaly.Traffic | 0.9761 | 0.8559 | 0.9964 | 0.9761 | 0.9649 | 0.8483 | 0.9802 | 0.9649 |
| Aggregator | Recursive | Temporal-Aware | Architecture Type |
|---|---|---|---|
| LastMessageAggregator | ✗ | ✗ | Simple / Baseline |
| MeanMessageAggregator | ✗ | ✗ | Pooling-based |
| BiGRUTransformerAggregator | ✓ | ✓ | BiGRU + Transformer |
| BiTransformerAggregator | ✗ | ✓ | Transformer-based |
| BiTransformerTemporalAggregator | ✗ | ✓ | Transformer + Temporal Encoding |
| RelativeTransformerAggregator | ✗ | ✓ | Transformer + Relative Bias |
| Aggregator | Transductive | Inductive | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| AUC | AP | F1 | MRR | Recall | AUC | AP | F1 | MRR | Recall | |
| BiGRUTransformerAggregator | 0.9511 | 0.9509 | 0.9809 | 0.9895 | 0.9812 | 0.7689 | 0.7722 | 0.9383 | 0.9707 | 0.9352 |
| BiTransformerAggregator | 0.9321 | 0.9316 | 0.9580 | 0.9764 | 0.9612 | 0.7414 | 0.7558 | 0.8665 | 0.9423 | 0.8485 |
| BiTransformerTemporalAggregator | 0.9341 | 0.9392 | 0.9761 | 0.9868 | 0.9772 | 0.7391 | 0.7511 | 0.9296 | 0.9668 | 0.9232 |
| RelativeTransformerAggregator | 0.9268 | 0.9240 | 0.9599 | 0.9777 | 0.9645 | 0.7444 | 0.7547 | 0.8783 | 0.9485 | 0.8570 |
| StackedBiTransformerAggregator | 0.9280 | 0.9271 | 0.8644 | 0.9403 | 0.8655 | 0.7228 | 0.7237 | 0.5435 | 0.8757 | 0.4941 |
| Aggregator | Transductive | Inductive | ||||||
|---|---|---|---|---|---|---|---|---|
| FPR | FNR | TPR | TNR | FPR | FNR | TPR | TNR | |
| BiGRUTransformerAggregator | 0.0069 | 0.0208 | 0.9791 | 0.9930 | 0.0194 | 0.0584 | 0.9415 | 0.9805 |
| BiTransformerAggregator | 0.0154 | 0.0464 | 0.9535 | 0.9845 | 0.0380 | 0.1140 | 0.8859 | 0.9619 |
| BiTransformerTemporalAggregator | 0.0087 | 0.0261 | 0.9738 | 0.9912 | 0.0219 | 0.0657 | 0.9342 | 0.9780 |
| RelativeTransformerAggregator | 0.0147 | 0.0442 | 0.9557 | 0.9852 | 0.0341 | 0.1023 | 0.8976 | 0.9658 |
| StackedBiTransformerAggregator | 0.0392 | 0.1178 | 0.8821 | 0.9607 | 0.0808 | 0.2426 | 0.7573 | 0.9191 |
| Aggregator | Transductive | Inductive | ||||
|---|---|---|---|---|---|---|
| Hits@1 | Binary Loss | Edge Loss | Hits@1 | Binary Loss | Edge Loss | |
| BiGRUTransformerAggregator | 0.9791 | 0.0140 | 1.1364 | 0.9415 | 0.0580 | 1.2947 |
| BiTransformerAggregator | 0.9535 | 0.0277 | 1.1483 | 0.8859 | 0.0959 | 1.2868 |
| BiTransformerTemporalAggregator | 0.9738 | 0.0139 | 1.1380 | 0.9342 | 0.0545 | 1.2989 |
| RelativeTransformerAggregator | 0.9557 | 0.0274 | 1.1615 | 0.8976 | 0.0767 | 1.2866 |
| StackedBiTransformerAggregator | 0.8821 | 0.0419 | 1.1662 | 0.7573 | 0.0970 | 1.3135 |
| Configuration | Aggregator | Test AP | Test AUC | Test Acc. | Test F1 | New Node AP | New Node AUC | New Node Acc. | New Node F1 |
|---|---|---|---|---|---|---|---|---|---|
| Only GRU | GRU | 0.8944 | 0.9285 | 0.9776 | 0.8809 | 0.7541 | 0.7581 | 0.9357 | 0.7265 |
| Only BiGRU | BiGRU | 0.9459 | 0.9493 | 0.9842 | 0.8634 | 0.7580 | 0.7597 | 0.9518 | 0.6681 |
| Only Transformer | Transformer | 0.8875 | 0.9026 | 0.9650 | 0.8394 | 0.6240 | 0.7054 | 0.9123 | 0.6873 |
| GRU + Transformer | GRU+Trans. | 0.8784 | 0.8585 | 0.9851 | 0.7821 | 0.7094 | 0.6681 | 0.9576 | 0.6667 |
| BiGRU + Transformer | BiGRU+Trans. | 0.9323 | 0.9414 | 0.9875 | 0.8741 | 0.7429 | 0.7461 | 0.9620 | 0.7160 |
| Hyperparameters | |||
| Batch Size | 128 | Learning Rate | 0.0001 |
| Epochs | 50 | Patience | 5 |
| Dropout | 0.1 | Attention Heads | 2 |
| Node Dim. | 100 | Time Dim. | 100 |
| Message Dim. | 100 | Memory Dim. | 9 |
| Dataset Statistics | |||
| Model Capacity | Computational Cost | |||
|---|---|---|---|---|
| Method | Params | Train (s) | Infer. (s) | Memory |
| TGN-Vanilla (Last) | 2,381 | 122.68 | 0.48 | 583.03 MB |
| TGN-Vanilla (Mean) | 2,381 | 128.80 | 0.65 | 604.98 MB |
| BiTA | 2,381 | 188.18 | 0.62 | 583.73 MB |