Year: 2026
Type: conference-paper
Abstract: Current defenses for Large Language Models (LLMs) often suffer from a "memory gap": parameter-modifying methods are computationally rigid, while inference-time filters cannot retain or reuse defense knowledge across interactions.To address this, we propose Safet-yMem, a novel framework that secures LLMs through a dual-component safety memory system.SafetyMem consists of Semantic Safety Memory (SSM), which consolidates diverse jailbreak attempts into a structured knowledge base of attack patterns, and Episodic Safety Memory (ESM), which maintains an evolving set of procedural rules refined from historical detection failures.Unlike static defenses, Safe-tyMem allows the model to "remember" and adapt to emerging adversarial strategies without parameter retraining.To further enhance robustness, we introduce an adversarial memory expansion mechanism that proactively generates challenging variants to solidify these memories.Experiments on standard and stealthy jailbreak benchmarks show that SafetyMem substantially reduces attack success rates while preserving efficiency and interpretability, consistently outperforming state-of-the-art baselines across multiple LLMs.
Authors: Hao Wang, Ziyi Ni, Huacan Wang, Pin Lyu, Lei Sha
Institutions: University of Chinese Academy of Sciences, Beihang University
Language: English
Subfield: Artificial Intelligence
Field: Computer Science
Domain: Physical Sciences
Open Access status: hybrid
Awards: G4458316040, G5831522889
OpenAlex ID: W7166802255
