Threat-Aware Adaptive Representation Learning Network for Intelligent Intrusion Detection
A research-oriented implementation of TARL-Net, a hybrid deep learning framework for intelligent intrusion detection, zero-day attack recognition, self-supervised representation learning, open-set recognition, continual learning, and explainable cyber threat intelligence.
TARL-Net is a unified deep learning framework designed to address several major limitations of modern Intrusion Detection Systems (IDSs).
Unlike conventional IDS models that rely on fully supervised closed-set learning, TARL-Net integrates multiple state-of-the-art AI techniques into a single end-to-end architecture capable of:
- Detecting known attacks
- Identifying previously unseen (Zero-Day) attacks
- Learning from unlabeled network traffic
- Adapting to concept drift
- Producing explainable security decisions
- Supporting early attack prediction
The framework was developed as part of a PhD research project in Artificial Intelligence for Cybersecurity.
✔ Hybrid Transformer–BiLSTM Architecture
✔ Threat-Aware Adaptive Vector Fusion
✔ Self-Supervised Representation Learning
✔ Open-Set Recognition (Zero-Day Detection)
✔ Explainable AI (Attention Rollout + Integrated Gradients)
✔ Confidence Calibration
✔ Continual Learning (Replay + EWC)
✔ Early Threat Prediction
✔ Multi-Seed Evaluation
✔ Cross-Dataset Zero-Shot Transfer
✔ Robust Experimental Protocol
This repository currently contains the complete implementation inside:
TARL_NET_extended_v3.ipynb
The notebook includes the entire research pipeline from data preprocessing to evaluation.
Raw Network Traffic
│
▼
Data Preprocessing
│
▼
Feature Engineering
│
▼
Self-Supervised Pretraining
│
▼
Hybrid Encoder
┌─────────────────┐
│ Transformer │
└─────────────────┘
+
┌─────────────────┐
│ BiLSTM │
└─────────────────┘
│
▼
Threat-Aware Adaptive Fusion
│
▼
Open-Set Recognition
│
▼
Threat Classification
│
▼
Explainability
│
▼
Threat Intelligence Report
The proposed architecture combines
- Transformer
- Bidirectional LSTM
to simultaneously model
- long-range dependencies
- sequential temporal behavior
- contextual traffic relationships
Instead of static feature concatenation, TARL-Net dynamically learns the contribution of each representation using a threat-aware adaptive vector gate.
To reduce dependency on expensive labeled datasets, the model performs
- Masked Traffic Modeling
- Contrastive Learning
before supervised fine-tuning.
Unknown attacks are identified using a class-conditional Deep SVDD framework capable of distinguishing
- Known attacks
- Unknown attacks
- Benign traffic
without forcing all samples into predefined classes.
The framework provides
- Attention Rollout
- Integrated Gradients
- Confidence Calibration
to improve operational trust.
Replay Memory and Elastic Weight Consolidation (EWC) are employed to reduce catastrophic forgetting under concept drift.
The current notebook includes the final reviewer-requested additions:
- Independent-dataset Zero-Shot Transfer
- Multi-seed Ablation Analysis
- MCC
- Cohen's Kappa
- Balanced Accuracy
- Continual Learning Evaluation
- Wall-clock Runtime Analysis
- Multi-horizon Prediction
- Thesis Figure Export Utilities
.
├── CITATION.cff
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── SECURITY.md
└── TARL_NET_extended_v3.ipynb
Python 3.10+
Recommended libraries:
torch
numpy
pandas
scikit-learn
matplotlib
scipy
shap
captum
jupyter
Clone the repository
git clone https://github.com/rezahamzeh69/TARL-Net-ZeroDay-IDS.gitEnter the project
cd TARL_NET_extended_v3Install dependencies
pip install -r requirements.txtLaunch Jupyter Notebook
jupyter notebookOpen
TARL_NET_extended_v3.ipynb
Execute notebook cells sequentially.
The final experiment can be launched using
main_full_v3(ConfigX(seeds=(1337,)))The notebook reports
- Accuracy
- Precision
- Recall
- F1-score
- Macro F1
- AUROC
- MCC
- Cohen's κ
- Balanced Accuracy
- False Positive Rate
- Open-Set AUROC
- Early Warning Score
- Runtime
- Memory Usage
The implementation is designed for benchmark intrusion detection datasets including
- UNSW-NB15
and supports cross-dataset transfer evaluation.
The proposed framework introduces
- Threat-aware adaptive representation fusion
- Self-supervised traffic representation learning
- Open-set Zero-Day detection
- Explainable cyber threat intelligence
- Continual learning under concept drift
- Early attack prediction
- Robust evaluation protocol
within a unified architecture.
If you use this repository in your research, please cite:
@misc{hamzeh2026tarlnet,
title={TARL-Net: Threat-Aware Adaptive Representation Learning Network},
author={Reza Hamzeh},
year={2026},
note={Research implementation}
}This project is intended for academic and research purposes.
This repository accompanies doctoral research on intelligent cyber threat detection, trustworthy artificial intelligence, and next-generation intrusion detection systems.