From Flows to Words: Can Zero-/Few-Shot LLMs Detect Network Intrusions? A Grammar-Constrained, Calibrated Evaluation on UNSW-NB15
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) can reason over natural-language inputs, but their role in intrusion detection without fine-tuning remains uncertain. This study evaluates a prompt-only approach on UNSW-NB15 by converting each network flow to a compact textual record and augmenting it with lightweight, domain-inspired boolean flags (asymmetry, burst rate, TTL irregularities, timer anomalies, rare service/state, short bursts). To reduce output drift and support measurement, the model is constrained to produce structured, grammar-valid responses, and a single decision threshold is calibrated on a small development split. We compare zero-shot, instruction-guided, and few-shot prompting to strong tabular and neural baselines under identical splits, reporting accuracy, precision, recall, F1, and macro scores. Empirically, unguided prompting is unreliable, while instructions plus flags substantially improve detection quality; adding calibrated scoring further stabilizes results. On a balanced subset of two hundred flows, a 7B instruction-tuned model with flags reaches macro-F1 near 0.78; a lighter 3B model with few-shot cues and calibration attains F1 near 0.68 on one thousand examples. As the evaluation set grows to two thousand flows, decision quality decreases, revealing sensitivity to coverage and prompting. Tabular baselines remain more stable and faster, yet the prompt-only pipeline requires no gradient training, produces readable artifacts, and adapts easily through instructions and flags. Contributions include a flow-to-text protocol with interpretable cues, a calibration method for thresholding, a systematic baseline comparison, and a reproducibility bundle with prompts, grammar, metrics, and figures.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 12 of its 30 references that are in the map. First posted on arXiv 18 Oct 2025.
Builds on
12 of 30 references.
References · 12
- 2016XGBoost: A Scalable Tree Boosting Systemcited by 5,120
- 2017On Calibration of Modern Neural Networkscited by 4,860
- 2022TabLLM: Few-shot Classification of Tabular Data with Large Language Modelscited by 273
- 2023Efficient Guided Generation for Large Language Modelscited by 192
- 2022Prompting Is Programming: A Query Language for Large Language Modelscited by 110
- 2019A Survey of Network-based Intrusion Detection Data Setscited by 46
- 2023Interpretable Online Log Analysis Using Large Language Models with Prompt Strategiescited by 34
- 2023LogGPT: Log Anomaly Detection via GPTcited by 26
- 2024A Survey of Large Language Models in Cybersecuritycited by 8
- 2017Towards Developing Network forensic mechanism for Botnet Activities in the IoT based on Machine Learning Techniquescited by 6
- 2025Large Language Models for Network Intrusion Detection Systems: Foundations, Implementations, and Future Directionscited by 4
- 2017Privacy Preservation Intrusion Detection Technique for SCADA Systemscited by 1
Built on by
Citing papers per year: 2026: 1.
1 paper.