A Training-Free Security Detection Method Based on Hidden State Space Activation
-
Abstract
Large Language Models (LLMs) are transforming the paradigm of human-computer interaction, but these systems are also facing increasingly serious and evolving threats from jailbreak attacks. Existing defense solutions predominantly rely on computationally expensive security-oriented fine-tuning strategies or external interception mechanisms with limited generalization capability, making it difficult to thoroughly and systematically characterize the intrinsic geometric evolution patterns within the model’s internal hidden state space. To address these limitations, this study proposes a novel, training-free security detection method based on Hidden State Space Activation (TSSA). First, TSSA demonstrates that security and risk queries follow a highly separable statistical distribution pattern in the model’s deep activation manifold, providing a theoretical foundation for constructing an intrinsic security defense mechanism. Second, through a key-segment-aware adaptive selection strategy, the most discriminative neural layer for security semantics is precisely identified. Furthermore, a security direction vector calibration algorithm is developed, utilizing a Mahalanobis distance-based metric to eliminate feature-space anisotropy, thereby extracting the optimal discriminative direction. Finally, an adaptive threshold calibration strategy is introduced to dynamically establish the decision boundary by quantitatively measuring the query conflict intensity, achieving robust and precise detection of deep semantic spoofing attacks. Experimental results on mainstream models such as DeepSeek-R1 and Qwen2.5 demonstrate that TSSA substantially enhances the defense success rate and cross-model generalization ability without introducing significant inference latency, providing a new perspective for understanding the internal security boundary of large models and enabling the development of a lightweight, real-time defense framework.
-
-