arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2412.13435cs.CLcs.AIcs.LG
收藏

使用剪枝语言模型的轻量级安全分类

Lightweight Safety Classification Using Pruned Language Models

Neudesic, an IBM Company(Neudesic(IBM旗下公司));IBM(国际商业机器公司(IBM))

Mason Sawtell, Tula Masterman, Sandi Besen, Jim Brown

AI总结:

本文提出层增强分类(LEC)技术,通过在LLM最佳中间Transformer层上训练惩罚逻辑回归分类器,实现轻量级且超越GPT-4o的内容安全与提示注入分类,证明小型通用模型剪枝后可作为稳健特征提取器。

摘要:

在本文中,我们提出了一种用于大型语言模型(LLM)内容安全与提示注入分类的新技术。我们的技术称为层增强分类(LEC),在LLM最佳中间Transformer层的隐藏状态上训练一个惩罚逻辑回归(PLR)分类器。通过将精简PLR分类器的计算效率与LLM复杂的语言理解能力相结合,我们的方法表现卓越,超越了GPT-4o和针对每个任务微调的专用模型。我们发现,小型通用模型(Qwen 2.5的0.5B、1.5B和3B规模)以及DeBERTa v3等其他基于Transformer的架构是稳健的特征提取器,允许简单分类器在少于100个高质量样本上被有效训练。重要的是,这些模型的中间Transformer层通常在两项分类任务上的表现都优于最终层。我们的结果表明,单个通用LLM可用于分类内容安全、检测提示注入,并同时生成输出Token。或者,这些相对较小的LLM可以被剪枝至最佳中间层,并专门用作稳健的特征提取器。由于我们的结果在不同Transformer架构上保持一致,我们推断稳健的特征提取是大多数(即使不是全部)LLM的固有能力。

英文摘要:

In this paper, we introduce a novel technique for content safety and prompt injection classification for Large Language Models. Our technique, Layer Enhanced Classification (LEC), trains a Penalized Logistic Regression (PLR) classifier on the hidden state of an LLM's optimal intermediate transformer layer. By combining the computational efficiency of a streamlined PLR classifier with the sophisticated language understanding of an LLM, our approach delivers superior performance surpassing GPT-4o and special-purpose models fine-tuned for each task. We find that small general-purpose models (Qwen 2.5 sizes 0.5B, 1.5B, and 3B) and other transformer-based architectures like DeBERTa v3 are robust feature extractors allowing simple classifiers to be effectively trained on fewer than 100 high-quality examples. Importantly, the intermediate transformer layers of these models typically outperform the final layer across both classification tasks. Our results indicate that a single general-purpose LLM can be used to classify content safety, detect prompt injections, and simultaneously generate output tokens. Alternatively, these relatively small LLMs can be pruned to the optimal intermediate layer and used exclusively as robust feature extractors. Since our results are consistent on different transformer architectures, we infer that robust feature extraction is an inherent capability of most, if not all, LLMs.

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

↑