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.
CSSBench: Evaluating the Safety of Lightweight LLMs against Chinese-Specific Adversarial Patterns
Nanyang Technological University(南洋理工大学);Beijing University of Posts and Telecommunications(北京邮电大学);Huazhong University of Science and Technology(华中科技大学)
Light Alignment Improves LLM Safety via Model Self-Reflection with a Single Neuron
Beijing Institute of AI Safety and Governance(北京人工智能安全与治理研究院);Beijing Key Laboratory of Safe AI and Superalignment(北京安全人工智能与超对齐重点实验室);Ant Group Co., Ltd.(蚂蚁集团有限公司);BrainCog Lab., CASIA(CASIA脑认知实验室);Zhongguancun Academy(中关村学院)
Router Sensitivity Under Lightweight Fine-Tuning Identifies Prunable Experts in Mixture-of-Experts Models
Columbia University(哥伦比亚大学);Data Science Institute, Columbia University(哥伦比亚大学数据科学研究所);Department of Computer Science, Columbia University(哥伦比亚大学计算机科学系)
Advancing LLM Safe Alignment with Safety Representation Ranking
State Key Lab of General Artificial Intelligence, School of Intelligence Science and Technology, Peking University(通用人工智能国家重点实验室,智能科学与技术学院,北京大学);School of Mathematical Sciences, Peking University(数学科学学院,北京大学);Institute for Artificial Intelligence, Peking University(人工智能研究院,北京大学)
A Granular Study of Safety Pretraining under Model Abliteration
Data and Web Science Group, University of Mannheim(曼海姆大学数据与网络科学组);Vision and AI Lab, Indian Institute of Science(印度科学院视觉与人工智能实验室);Carnegie Mellon University(卡内基梅隆大学);Max-Planck-Institute for Informatics, Saarland Informatics Campus(马克斯·普朗克信息研究所,萨尔兰信息校园)
LookAhead Tuning: Safer Language Models via Partial Answer Previews
Zhejiang University(浙江大学);Zhejiang University - Ant Group Joint Laboratory of Knowledge Graph(浙江大学-蚂蚁集团知识图谱联合实验室);Ant Group(蚂蚁集团);National University of Singapore(新加坡国立大学)
CLEAR: Continuous Latent Adapter Routing for Utility-Preserving LLM Safety Alignment
Stanford University(斯坦福大学);University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Siebel School of Computing and Data Science, University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校西贝尔计算与数据科学学院);Computer Science, Stanford University(斯坦福大学计算机科学系)
ReFrame: Evidence-Guided Test-Time Safety Alignment in Multimodal Large Language Models
College of Computer Science and Technology, National University of Defense Technology(国防科技大学计算机学院);State Key Laboratory of Complex & Critical Software Environment(复杂与关键软件环境国家重点实验室);School of Computer Science, Wuhan University(武汉大学计算机学院)
Aligned but Fragile: Enhancing LLM Safety Robustness via Zeroth-Order Optimization
The State Key Laboratory of Blockchain and Data Security(区块链与数据安全国家重点实验室);Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security(杭州高科技园区(滨江)区块链与数据安全研究院);Sun Yat-sen University(中山大学);KAUST(卡塔尔大学)