In today’s world, electronics and networked systems, such as IoT devices, embedded platforms and smart environments, are increasingly popular and widespread. As a result, these systems become more exposed to cyber threats. The malicious URL is also one of the most widespread yet perilous vectors of cyberattack, as it is widely used in phishing, malware distribution, and command-and-control communication. The security of these electronic systems necessitates real-time, lightweight and intelligent detection techniques that must be efficient in resource-constrained environments. In order to meet this requirement, we propose SwiftURL, a lightweight deep learning model to detect malicious URLs that can be specifically deployed in modern electronic environments. SwiftURL leverages knowledge distillation from a transformer-based ELECTRA-Small teacher model, transferring detection capability into a smaller and faster student model while maintaining high performance. Experimental results on a public Kaggle dataset of malicious URLs demonstrate that SwiftURL achieves an accuracy of 94.38%, reduces computational overhead by 35%, and accelerates training time by 15%. These findings highlight SwiftURL’s effectiveness as a practical solution for enhancing cybersecurity in electronic and networked systems through efficient, on-device URL threat detection.
Infected URLs are always regarded as a serious threat to cybersecurity, serving as pathways to phishing, maliciousness, and other offenses. Although transformer-based models have demonstrated good performance in malicious URL detection, their high computational cost and latency make them impractical for deployment in real-time or resource-constrained systems. Allocated on the basis of knowledge distillation (KD), lightweight models tend to be efficient but are commonly not sufficiently discriminative to distinguish between malicious and benign URLs with non-cataclysmic lexical overlaps, particularly when dealing with an imbalanced dataset. In order to address these issues, we propose Contra-KD, a lightweight transformer model that incorporates contrastive learning (CL) and KD. This proposed framework imposes structured embedding matching, allowing the student model to learn more meaningful and generalized depictions. Contra-KD uses a compact 6-layer student transformer architecture based on ELECTRA to scale parameters up and can achieve more than 90% computational fidelity with a high accuracy. In this scheme, CL improves the feature of discrimination by semantically clustering similar URLs and separating different URLs. This tendency serves to limit confusion, especially when a common lexical trait is held between two words and/or in the presence of adversarial obfuscation. Through a large-scale publicly available Kaggle dataset of 651,191 URLs in imbalanced scenarios, the proposed Contra-KD can achieve 99.05% accuracy, 99.96% ROC-AUC, and 98.18% MCC which are superior to their counterparts including lightweight models and transformer-based ones. To summarize, Contra-KD proposes an efficient transformer architecture that is both small and effective in computation while delivering stable detection performance.