arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.17883cs.CRcs.AIcs.LG
收藏

从流到词:零样本/少样本LLM能否检测网络入侵?——在UNSW-NB15上的语法约束与校准评估

From Flows to Words: Can Zero-/Few-Shot LLMs Detect Network Intrusions? A Grammar-Constrained, Calibrated Evaluation on UNSW-NB15

Future Data Minds Research Lab(未来数据思维研究实验室)

Mohammad Abdul Rehman, Syed Imad Ali Shah, Abbas Anwar, Noor Islam

AI总结:

本研究在UNSW-NB15上评估零/少样本LLM的入侵检测能力,通过流到文本转换和领域标志,结合语法约束与阈值校准,在平衡子集上达到约0.78的宏F1,验证了无需训练的提示方法的可行性与局限性。

摘要:

大型语言模型(LLMs)能够对自然语言输入进行推理,但它们在无需微调的情况下在入侵检测中的作用仍不确定。本研究在UNSW-NB15数据集上评估了一种纯提示(prompt-only)方法,将每条网络流转换为紧凑的文本记录,并附加轻量级、受领域启发的布尔标志(不对称性、突发速率、TTL异常、定时器异常、罕见服务/状态、短突发)。为减少输出漂移并支持测量,模型被约束为生成结构化、符合语法的响应,并在一个小的开发集上校准单一决策阈值。我们在相同的划分下,将零样本、指令引导和少样本提示与强大的表格型和神经网络基线进行比较,报告准确率、精确率、召回率、F1和宏平均分数。实验表明,无引导的提示不可靠,而指令加标志显著提高了检测质量;添加校准评分进一步稳定了结果。在两百条流的平衡子集上,一个70亿参数的指令调优模型配合标志达到了约0.78的宏F1;一个更轻量的30亿参数模型在少样本提示和校准下,在一千个样本上达到了约0.68的F1。当评估集增长到两千条流时,决策质量下降,显示出对覆盖率和提示的敏感性。表格型基线保持更稳定和更快,而纯提示流程无需梯度训练,产生可读的工件,并可通过指令和标志轻松适应。贡献包括一个带有可解释线索的流到文本协议、一种用于阈值设定的校准方法、系统的基线比较,以及一个包含提示、语法、指标和图表的可复现性包。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑