English

Lightweight LLMs for Network Attack Detection in IoT Networks

Cryptography and Security 2026-01-22 v1

Abstract

The rapid growth of Internet of Things (IoT) devices has increased the scale and diversity of cyberattacks, exposing limitations in traditional intrusion detection systems. Classical machine learning (ML) models such as Random Forest and Support Vector Machine perform well on known attacks but require retraining to detect unseen or zero-day threats. This study investigates lightweight decoder-only Large Language Models (LLMs) for IoT attack detection by integrating structured-to-text conversion, Quantized Low-Rank Adaptation (QLoRA) fine-tuning, and Retrieval-Augmented Generation (RAG). Network traffic features are transformed into compact natural-language prompts, enabling efficient adaptation under constrained hardware. Experiments on the CICIoT2023 dataset show that a QLoRA-tuned LLaMA-1B model achieves an F1-score of 0.7124, comparable to the Random Forest (RF) baseline (0.7159) for known attacks. With RAG, the system attains 42.63% accuracy on unseen attack types without additional training, demonstrating practical zero-shot capability. These results highlight the potential of retrieval-enhanced lightweight LLMs as adaptable and resource-efficient solutions for next-generation IoT intrusion detection.

Keywords

Cite

@article{arxiv.2601.15269,
  title  = {Lightweight LLMs for Network Attack Detection in IoT Networks},
  author = {Piyumi Bhagya Sudasinghe and Kushan Sudheera Kalupahana Liyanage and Harsha S. Gardiyawasam Pussewalage},
  journal= {arXiv preprint arXiv:2601.15269},
  year   = {2026}
}

Comments

6 pages with 2 figures, This paper was accepted and presented at the 7th Computing, Communications and IoT Applications Conference (ComComAp 2025), held in Madrid, Spain, during 14th to 17th December 2025

R2 v1 2026-07-01T09:14:37.436Z