用微调让大模型掌握网络安全知识,效果好还省算力。
Fine-tuning of Large Language Models for Domain-Specific Cybersecurity Knowledge
- 用监督微调、低秩适配等方法注入网络安全知识
- 低秩方法性能接近全量微调,但耗时减少70%以上
- 适合想高效定制领域大模型的研究者和工程师
大型语言模型(LLM)在自然语言处理和跨领域泛化方面取得显著进展,但在需要专业知识的特定领域(如网络安全)的零样本表现通常不佳。这是因为基础模型面向通用任务设计,难以在参数空间中有效封装领域专长。为此,本文探索了将网络安全知识嵌入LLM的微调策略,以提升其在网络安全问答任务中的表现,同时注重计算效率。我们采用网络安全问答数据集,对比了监督微调(SFT)、低秩适配(LoRA)和量化低秩适配(QLoRA)三种方法。结果表明,这些微调方法显著优于基础模型;且LoRA与QLoRA在保持接近SFT性能的同时,计算成本大幅降低,为适应专业领域提供了高效路径。本研究验证了低秩微调在弥合通用模型与专用应用间差距方面的潜力。
原文摘要 · Abstract (English)
Recent advancements in training paradigms for Large Language Models (LLMs) have unlocked their remarkable capabilities in natural language processing and cross-domain generalization. While LLMs excel in tasks like programming and mathematical problem-solving, their zero-shot performance in specialized domains requiring expert knowledge, such as cybersecurity, is often suboptimal. This limitation arises because foundational LLMs are designed for general-purpose applications, constraining their ability to encapsulate domain-specific expertise within their parameter space. To address this, we explore fine-tuning strategies to embed cybersecurity knowledge into LLMs, enhancing their performance in cybersecurity question-answering (Q\&A) tasks while prioritizing computational efficiency. Specifically, we investigate Supervised Fine-Tuning (SFT), Low-Rank Adaptation (LoRA), and Quantized Low-Rank Adaptation (QLoRA) using a cybersecurity Q\&A dataset. Our results demonstrate that these fine-tuning approaches significantly outperform the foundational model in cybersecurity Q\&A tasks. Moreover, LoRA and QLoRA achieve comparable performance to SFT with substantially lower computational costs, offering an efficient pathway for adapting LLMs to specialized domains. Our work highlights the potential of low-rank fine-tuning strategies to bridge the gap between general-purpose LLMs and domain-specific applications.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。