DF-TransVAE: A Deep Fusion Network for Binary Classification-Based Anomaly Detection in Internet User Behavior
Abstract
1. Introduction
- A novel, deeply integrated DF-TransVAE framework is proposed, establishing a new paradigm for the fusion of Transformers and VAEs in distribution-based anomaly detection and overcoming the limitations of individual models.
- An inter-feature cross-attention mechanism is presented to enable deep bidirectional interaction between contextual features and latent variables, which promotes the development of representation learning for sequential anomaly detection.
- Residual connections are introduced to alleviate gradient degradation and improve training stability, providing an effective optimization strategy for deep anomaly detection models.
2. Related Work
3. Methodology
3.1. Anomaly Detection Process
3.2. DF-TransVAE Framework
- A parallelized dual-stream feature extraction mechanism is designed and adopted. To overcome the drawbacks of the sequential cascaded structures used in existing models (where the Transformer and VAE are combined sequentially), two parallel and independent feature extraction branches are constructed. Through the implementation of a dual-stream architecture where the Transformer and VAE encoder operate simultaneously and independently, the integrity of global dependency characteristics (extracted by the Transformer) and latent distribution properties (captured by the VAE encoder) is maintained via source-level separation. This design avoids information loss caused by sequential processing and ensures the completeness of both types of core features.
- A cross-attention-based feature deep fusion strategy is introduced and implemented. After preliminary global contextual features (from the Transformer) and latent variables (from the VAE encoder) are acquired—elements that are usually directly transferred or merely aggregated in existing approaches—a cross-attention mechanism is employed to facilitate in-depth, bidirectional interplay between temporal contextual features and latent distribution variables. This mechanism dynamically calculates the correlation weights between the two types of features, thereby adaptively enhancing the latent patterns most relevant to the current context. For this reason, a fusion depth significantly exceeding that achieved by the simple concatenation or unidirectional transmission used in existing methods is realized, which effectively improves the discriminative ability of the fused features.
- The classifier architecture is enhanced via the embedding of residual connections. In the final classification decision stage, standard feedforward networks (commonly adopted in existing studies) are not used; instead, a residual connection structure is embedded into the fully connected layer classifier for the first time. This structural optimization effectively mitigates gradient degradation in deep networks during the training process, enhances training stability, and further improves the overall classification performance and robustness of the model.
3.2.1. Transformer
3.2.2. VAE
3.2.3. Interactive Module
3.2.4. Residual Connections
3.2.5. Residual Connection—Fully Connected Layer Classifier
3.3. Loss Function
4. Experimental Results and Analysis
4.1. Dataset and Its Preprocessing
4.2. Experimental Environment
4.3. Evaluation Indicators
4.4. Experimental Setup and Comparative Model
4.5. Ablation Experiment
4.6. Hyperparameter Analysis
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Jiao, Y.; Yang, K.; Song, D.; Tao, D. TimeAutoAD: Autonomous Anomaly Detection with Self-Supervised Contrastive Loss for Multivariate Time Series. IEEE Trans. Netw. Sci. Eng. 2022, 9, 1604–1619. [Google Scholar] [CrossRef]
- Hou, J.; Zhou, H.; Grifoll, M.; Zhou, Y.; Liu, J.; Ye, Y.; Zheng, P. A Transformer–VAE Approach for Detecting Ship Trajectory Anomalies in Cross-Sea Bridge Areas. J. Mar. Sci. Eng. 2025, 13, 849. [Google Scholar] [CrossRef]
- Zeng, L.; Yang, X. Spatial-temporal attention model based on transformer architecture for anomaly detection in multivariate time series data. J. Comput. 2024, 35, 193–207. [Google Scholar] [CrossRef]
- Dao, T.-T.; Pham, Q.-V.; Huynh-The, T.; Hwang, W.-J. Transformer Model Embedding Dual Stream for Modulation Classification of Short Signal Samples. ACM Trans. Intell. Syst. Technol. 2025. just accepted. [Google Scholar] [CrossRef]
- Li, Y.; Peng, X.; Zhang, J.; Li, Z.; Wen, M. DCT-GAN: Dilated Convolutional Transformer-Based GAN for Time Series Anomaly Detection. IEEE Trans. Knowl. Data Eng. 2023, 35, 3632–3644. [Google Scholar] [CrossRef]
- Gan, H.; Zheng, H.; Wu, Z.; Ma, C.; Liu, J. TFD-Net: Transformer Deviation Network for Weakly Supervised Anomaly Detection. IEEE Trans. Netw. Serv. Manag. 2025, 22, 941–954. [Google Scholar] [CrossRef]
- Yu, X.; Zhang, K.; Liu, Y.; Zou, B.; Wang, J.; Wang, W.; Qian, R. Adversarial Transformer-Based Anomaly Detection for Multivariate Time Series. IEEE Trans. Ind. Inform. 2025, 21, 2471–2480. [Google Scholar] [CrossRef]
- Qin, S.; Luo, Y.; Tao, G. Memory-Augmented U-Transformer for Multivariate Time Series Anomaly Detection. In Proceedings of the ICASSP 2023—2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Rhodes Island, Greece, 4–10 June 2023; pp. 1–5. [Google Scholar] [CrossRef]
- Guan, W.; Cao, J.; Yao, Y.; Gu, Y.; Qian, S. COMB: Interconnected Transformers-Based Autoencoder for Multi-Perspective Business Process Anomaly Detection. In Proceedings of the 2024 IEEE International Conference on Web Services (ICWS), Shenzhen, China, 7–13 July 2024; pp. 1115–1124. [Google Scholar] [CrossRef]
- Chen, L.; You, Z.; Zhang, N.; Xi, J.; Le, X. UTRAD: Anomaly detection and localization with U-Transformer. Neural Netw. 2022, 147, 53–62. [Google Scholar] [CrossRef]
- Cai, X.; Xiao, R.; Zeng, Z.; Gong, P.; Ni, Y. ITran: A novel transformer-based approach for industrial anomaly detection and localization. Eng. Appl. Artif. Intell. 2023, 125, 106677. [Google Scholar] [CrossRef]
- Kim, J.; Kang, H.; Kang, P. Time-series anomaly detection with stacked Transformer representations and 1D convolutional network. Eng. Appl. Artif. Intell. 2023, 120, 105964. [Google Scholar] [CrossRef]
- You, Z.; Wang, X.; Xu, J.; Wang, H.; Yan, R. Signal generation for bolt loosening detection with unbalanced datasets based on the CBAM-VAE. Measurement 2025, 240, 115589. [Google Scholar] [CrossRef]
- Song, A.; Seo, E.; Kim, H. Anomaly VAE-Transformer: A Deep Learning Approach for Anomaly Detection in Decentralized Finance. IEEE Access 2023, 11, 98115–98131. [Google Scholar] [CrossRef]
- Huo, W.; Liang, R.; Li, Y. Anomaly detection model for multivariate time series based on stochastic Transformer. J. Commun. 2023, 44, 94–103. [Google Scholar] [CrossRef]
- Wang, J.; Li, J.; Wang, R.; Zhou, X. VAE-driven multimodal fusion for early cardiac disease detection. IEEE Access 2024, 12, 90535–90551. [Google Scholar] [CrossRef]
- Zhang, C.; Xie, B.; Huo, Z. Unsupervised Anomaly Detection in Time Series Data via Enhanced VAE-Transformer Framework. Comput. Mater. Contin. 2025, 84, 843. [Google Scholar] [CrossRef]
- Chen, N.; Tu, H.; Duan, X.; Hu, L.; Guo, C. Semisupervised anomaly detection of multivariate time series based on a variational autoencoder. Appl. Intell. 2023, 53, 6074–6098. [Google Scholar] [CrossRef]
- Shang, W.; Qiu, J.; Shi, H.; Wang, S.; Ding, L.; Xiao, Y. An efficient anomaly detection method for industrial control systems: Deep convolutional autoencoding transformer network. Int. J. Intell. Syst. 2024, 2024, 5459452. [Google Scholar] [CrossRef]
- Li, C.; Kiat, Y.C.; Jing, J.; Long, C. T-VAE: Transformer-Based Variational AutoEncoder for Perceiving Anomalies in Multivariate Time Series Data. Expert Syst. 2025, 42, e70078. [Google Scholar]
- Li, X.; Min, W.; Chen, J.; Wu, J.; Wang, S. TransVCOX: Bridging transformer encoder and pre-trained VAE for robust cancer multi-omics survival analysis. In 2023 IEEE International Conference on Bioinformatics and Biomedicine (BIBM); IEEE: Piscataway, NJ, USA, 2023. [Google Scholar]
- Wang, X.; Pi, D.; Zhang, X.; Liu, H.; Guo, C. Variational transformer-based anomaly detection approach for multivariate time series. Measurement 2022, 191, 110791. [Google Scholar] [CrossRef]
- Jiang, Y.; Zhang, H.; Li, B.; Yang, J.; Zhang, Y. Anomaly detection based on spatiotemporal LSTM with Transformer-AE generative adversarial networks. In International Conference on Computer Vision and Augmented Reality (CVAR 2025); SPIE: Bellingham, WA, USA, 2025; Volume 13801, p. 1380107. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.M.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention is All you Need. Neural Inf. Process. Syst. 2017, 30. [Google Scholar] [CrossRef]
- Subakan, C.; Ravanelli, M.; Cornell, S.; Bronzi, M.; Zhong, J. Attention Is All You Need in Speech Separation. In Proceedings of the ICASSP 2021—2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Toronto, ON, Canada, 6–11 June 2021; pp. 21–25. [Google Scholar] [CrossRef]
- Cai, W.; Wei, Z. Remote Sensing Image Classification Based on a Cross-Attention Mechanism and Graph Convolution. IEEE Geosci. Remote Sens. Lett. 2022, 19, 8002005. [Google Scholar] [CrossRef]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition 2016; IEEE: Piscataway, NJ, USA, 2016; pp. 770–778. [Google Scholar]
- Elsayed, S.; Mohamed, K.; Madkour, M.A. A Comparative Study of Using Deep Learning Algorithms in Network Intrusion Detection. IEEE Access 2024, 12, 58851–58870. [Google Scholar] [CrossRef]
- Basaran, O.T.; Dressler, F. XAInomaly: Explainable and interpretable Deep Contractive Autoencoder for O-RAN traffic anomaly detection. Comput. Netw. 2025, 261, 111145. [Google Scholar] [CrossRef]
- Katib, I.; Albassam, E.; Sharaf, S.A.; Ragab, M. Safeguarding IoT consumer devices: Deep learning with TinyML driven real-time anomaly detection for predictive maintenance. Ain Shams Eng. J. 2025, 16, 103281. [Google Scholar] [CrossRef]
- Chen, T.-C. Deep Belief-MobileNet1D: A novel deep learning approach for anomaly detection in industrial big data. Internet Things 2025, 31, 101593. [Google Scholar] [CrossRef]












| Datasets | Redraw | Fill | Coding | Normalization | Feature Engineering |
|---|---|---|---|---|---|
| Cybersecurity | Y | Y | Y | Y | N |
| UGRansome | Y | N | Y | Y | N |
| Hyperparameter | Numerical Value |
|---|---|
| d_model | 256 |
| nhead | 8 |
| num_layers | 4 |
| latent_dim | 64 |
| num_heads | 4 |
| β | 0.1 |
| lr | 0.0001 |
| threshold | 0.5 |
| Model | Cybersecurity Dataset | UGRansome Dataset | ||||
|---|---|---|---|---|---|---|
| ROC-AUC% | ACC/% | F1-Score/% | ROC-AUC% | ACC/% | F1-Score/% | |
| DNN [28] | 87.86 | 86.57 | 82.66 | 99.87 | 98.45 | 98.92 |
| CNN [28] | 86.04 | 83 | 78.91 | 98.44 | 94.79 | 96.40 |
| CNN-LSTM [28] | 83.76 | 80.27 | 76.50 | 99.69 | 97.57 | 98.30 |
| SS-DeepCAE [29] | 87.50 | 86.36 | 82.09 | 99.79 | 98.30 | 98.81 |
| DLTML-RTADPM [30] | 79.20 | 76.29 | 70.65 | 82.36 | 86.54 | 90.65 |
| Deep-Belief-MobileNet 1D [31] | 83.01 | 81.32 | 76.88 | 99.93 | 98.71 | 99.09 |
| Transformer-VAE [2] | 62.98 | 61.70 | 62.25 | 74.87 | 69.34 | 76.71 |
| DF-TransVAE | 88.30 | 89.93 | 87.13 | 99.95 | 98.94 | 99.26 |
| Model | Component | Cybersecurity Dataset | ||||||
|---|---|---|---|---|---|---|---|---|
| Splicing | Transformer | VAE | Cross Attention | Classifier | ROC- AUC/% | ACC /% | F1-Score /% | |
| Model_1 | √ | √ | √ | √ | 87.33 | 85.52 | 82.58 | |
| Model_2 | √ | √ | √ | √ | 88.92 | 89.51 | 86.52 | |
| Model_3 | √ | √ | √ | √ | 88.11 | 86.99 | 83.24 | |
| Model_4 | √ | √ | √ | 88.95 | 86.15 | 82.81 | ||
| Model_5 | √ | √ | √ | 87.77 | 89.09 | 86.21 | ||
| Model_6 | √ | √ | √ | 89.23 | 88.98 | 85.91 | ||
| Model_7 | √ | √ | 85.89 | 82.06 | 78.76 | |||
| Model_8 | √ | √ | 88.10 | 89.61 | 86.82 | |||
| Model_9 | √ | √ | √ | √ | √ | 88.27 | 89.49 | 86.61 |
| DF-TransVAE | √ | √ | √ | √ | √ | 88.30 | 89.93 | 87.13 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Fan, H.; Jia, Y.; Le, W.; Jia, Z.; Zhao, H.; He, C.; Jiang, H.; Hu, Z.; Lv, X.; Yuan, J.; et al. DF-TransVAE: A Deep Fusion Network for Binary Classification-Based Anomaly Detection in Internet User Behavior. Appl. Sci. 2026, 16, 2243. https://doi.org/10.3390/app16052243
Fan H, Jia Y, Le W, Jia Z, Zhao H, He C, Jiang H, Hu Z, Lv X, Yuan J, et al. DF-TransVAE: A Deep Fusion Network for Binary Classification-Based Anomaly Detection in Internet User Behavior. Applied Sciences. 2026; 16(5):2243. https://doi.org/10.3390/app16052243
Chicago/Turabian StyleFan, Huihui, Yuan Jia, Wu Le, Zhenhong Jia, Hui Zhao, Congbing He, Hedong Jiang, Zeyu Hu, Xiaoyi Lv, Jianting Yuan, and et al. 2026. "DF-TransVAE: A Deep Fusion Network for Binary Classification-Based Anomaly Detection in Internet User Behavior" Applied Sciences 16, no. 5: 2243. https://doi.org/10.3390/app16052243
APA StyleFan, H., Jia, Y., Le, W., Jia, Z., Zhao, H., He, C., Jiang, H., Hu, Z., Lv, X., Yuan, J., & Huang, X. (2026). DF-TransVAE: A Deep Fusion Network for Binary Classification-Based Anomaly Detection in Internet User Behavior. Applied Sciences, 16(5), 2243. https://doi.org/10.3390/app16052243
