KAIST's Membrane Cuts AI Jailbreaks to 0% Without Blocking Legitimate Requests
Membrane's contrastive memory pairs every blocked attack with a permitted benign twin, slashing false refusals while topping safety benchmarks across six jailbreak types
Takeaways
- Membrane is a new LLM guardrail that stores safety knowledge as contrastive pairs: each cell encodes both what to block and what similar-looking benign requests to allow. [Paper]
- It achieves the highest F1 on all six jailbreak attacks across HarmBench (model safety) and AgentHarm (agent safety) benchmarks, with no retraining required.
- False refusal rate on AgentHarm is 7-14%, versus 28-85% for prior memory-based and prompt-level guards, solving the over-refusal problem.
- Memory cells trained on one attack type transfer to unseen attacks at 87-88% F1 retention, because cells are indexed by attack mechanism, not topic.
- A lite mode (Retrieval Critic disabled) runs at ~2.4 seconds per query while still outperforming all baselines, making real-time deployment feasible.
- The system is robust to memory poisoning at 20% injection rates, with ASR drift below 0.4 points, due to low retrieval rates for poisoned cells and critic filtering.
Every safety team building on top of an LLM faces the same uncomfortable tradeoff: tighten the guardrail and watch it start refusing legitimate requests; loosen it and watch jailbreaks slip through. A new paper from KAIST AI and KakaoBank's Financial Tech Lab argues this tradeoff is not fundamental. It is a consequence of how safety knowledge has been stored, and a different storage format can break the deadlock.
The system is called Membrane, and its core insight is deceptively simple. Most existing guardrails store only one side of the safety boundary: what to block. Membrane stores both sides simultaneously, pairing every blocked attack pattern with an explicit description of the superficially similar benign requests that must still be allowed through. The authors call this a Contrastive Safety Memory (CSM).
The problem no one was solving
LLM jailbreaks have evolved from simple prompt tricks into a sophisticated, continuously shifting attack surface. Modern attacks span feedback-driven prompt-refinement search, persuasion-based rewriting, and self-adapting attack policies. The standard response has been to fine-tune dedicated safety classifiers like LlamaGuard or WildGuard. But traditional defenses encode safety behavior in fixed model parameters, making their decision boundaries difficult to revise after deployment.
Memory-based guardrails tried to fix the rigidity problem by storing safety knowledge in an external pool that grows without retraining. But they introduced a new failure mode. Existing memory designs store safety knowledge in a one-sided form, capturing attacks or refusal rules without paired conditions for permitting benign queries. This creates two coupled failure modes: coverage remains tied to the surface forms already stored, while expanding the memory can push the guard toward rejecting benign queries that resemble known attacks.

What a memory cell actually looks like
The fundamental unit in Membrane is a CSM cell, a structured record with three components:
- Attack Profile: classifies the attack by its underlying mechanism (persuasion, role injection, payload splitting, obfuscation, etc.) rather than by topic. A request for chemical synthesis routes and one for financial fraud can both be tagged as
persuasionif they use the same rhetorical framing. - Decision Criteria: a contrastive pair. The
d_unsafeside lists conditions sufficient to block a query. Thed_safeside explicitly describes superficially similar benign requests that must be allowed through, the anti-over-refusal channel. - Tool-Action Context: activated only in agent settings, this field anchors the boundary to specific tool calls and adds a
safe_vetocondition that can override a block when the benign twin matches.
Indexing cells by attack mechanism rather than topic is the key architectural choice. Motivated by evidence that adversarial mechanisms are largely recompositions of a finite repertoire, CSM indexes cells by their underlying attack strategies, letting a single cell generalize across topical variants of the same mechanism. A cell trained on a persuasion-framed request for ivory trafficking locations will also catch a persuasion-framed request for weapons synthesis, because the mechanism is the same.
How the memory evolves
Membrane operates in two phases. During the Paired Self-Evolution phase, every interaction produces an evolution signal. The system processes a harmful query alongside its benign counterpart and classifies the outcome as one of three verdicts: jailbroken (the guard let the harmful query through), over-refusal (the guard blocked the benign query), or correct. That verdict, combined with what was already in memory, drives one of four actions:
- Create: no existing cell covers this attack pattern, so a new contrastive cell is written.
- Update: an existing cell covers the pattern but needs sharpening, broadening the safe side on an over-refusal, or tightening the unsafe side on a jailbreak.
- Delete: a retrieved cell actively misled the guard and should be removed.
- Skip: the existing cell already handles this case adequately.
Crucially, the Memory Planner selects the action based on retrieval coverage rather than the verdict alone, so a jailbroken signal does not force a create when retrieval already covers the mechanism; an update suffices. A non-LLM validator then checks every write against schema, duplicate, and capacity constraints before committing it to the store, separating content synthesis from deterministic acceptance.
During the Inference phase, incoming queries go through a two-stage retrieval pipeline. Stage 1 uses cosine similarity over cell embeddings to over-retrieve candidates with high recall. Stage 2 passes those candidates to a Retrieval Critic, an LLM that assigns each cell a verdict of applies, maybe, or does_not_apply, filtering out irrelevant matches before the final guard decision.
Benchmarks and baselines
The evaluation covers two distinct safety layers. HarmBench is a standardized red-teaming benchmark that formalizes evaluation through a clearly specified threat model, behavior taxonomy, and reproducible scoring pipeline, with its primary focus on measuring a model's ability to robustly refuse harmful requests under adversarial pressure. AgentHarm evaluates the capacity of LLM-based agents to resist harmful multi-step tasks, extending prior single-turn safety assessments into the agentic regime where LLMs orchestrate tool use and multi-stage workflows.
Six jailbreak attacks were tested against each benchmark:
- PAIR: iterative prompt refinement using attacker-model feedback
- PAP: persuasion-based rewriting using a taxonomy of rhetorical techniques
- TAP: tree-of-thought beam search over jailbreak prompts
- ReNeLLM: rewriting plus embedding the payload inside benign-looking scenarios
- FlipAttack: character/word flipping to evade surface-level pattern matching
- AutoDAN-Turbo: a lifelong agent that self-explores and accumulates jailbreak strategies
The protected model throughout is Qwen3-8B, chosen to match the scale of fine-tuned classifier baselines like LlamaGuard3. Baselines span prompt-level guards (Self-Reminder, SmoothLLM, SelfDefend), fine-tuned classifiers (LlamaGuard3, WildGuard, GuardReasoner), and memory-augmented guards (RAD for model safety; GuardAgent, AGrail for agent safety).

The numbers are hard to argue with
Membrane achieves the highest F1 score on every attack and the lowest ASR on five out of six attacks on HarmBench. The gains are largest on surface-form attacks: on ReNeLLM, Membrane achieves an ASR of 0.3%, vastly outperforming the 11.3% achieved by RAD. On FlipAttack, it completely suppresses the attack with an ASR of 0.0%, compared to the best baseline score of 7.8%.
The agent safety results tell an even more striking story about over-refusal. Membrane consistently restricts the False Refusal Rate to a range of 7% to 14% across all settings, substantially lower than memory-augmented baselines such as GuardAgent (52% to 53%) and AGrail (27% to 32%), as well as prompt-level guards like TrustAgent (73% to 85%). Cutting benign refusals from 85% down to 14% while simultaneously improving attack blocking is the core result.
Two additional robustness analyses stand out. On cross-attack transfer, a cell trained on one jailbreak method was evaluated against the other five. The transfer F1 retains 87% of the same-attack F1 in model safety and 88% in agent safety, and this transfer performance remains consistently high across the board rather than relying on a few successful pairs. On memory poisoning at a 20% injection rate, the unsafe-as-safe attack causes a minimal ASR increase from 2.1% to 2.5%, with resistance stemming from a low retrieval rate of poisoned cells (2.3% to 7.5%) and the Retrieval Critic successfully eliminating 33% to 40% of poisoned cells that do surface.
Latency and practical tradeoffs
Full Membrane runs at a mean of 12.89 seconds per query on model safety and 14.59 seconds on agent safety. That is slower than lightweight prompt guards but dramatically faster than SmoothLLM at 156.93 seconds. For latency-sensitive deployments, disabling the Retrieval Critic yields Membrane-lite, which reduces average latency to 2.33 and 2.43 seconds for model and agent safety respectively, while still achieving F1 scores of 91.7% and 78.6%, decisively outperforming every baseline regardless of their latency tier.
The warmup curve is also encouraging for practitioners: most of Membrane's gain materializes in the first bin, with HarmBench picking up +20% F1 within just seven cells of an eventual +32.6% total gain. You do not need a large seed dataset to get most of the benefit.
Where it falls short
The paper is candid about its limitations. Membrane is evaluated on text-only English benchmarks, and cross-lingual, multimodal, and nested-agent deployments require separate benchmark construction and threat models. Performance also degrades on weaker backbone models: on Qwen3-4B, Membrane's F1 on PAIR drops to 62.5% versus 89.5% on the 8B variant. The system also has no defense against fully adaptive white-box adversaries who have direct access to the memory store and deployment pipeline.
There is also a latency cost that matters in real products. At ~13 seconds per query, the full system is not suitable for interactive chat applications without batching or async handling. The lite variant trades roughly 1-2 F1 points for a 5x speedup, which may be the right call for most deployments.
What this unlocks
The practical implication is that Membrane can be dropped in front of any existing LLM or tool-using agent without retraining the underlying model. The backbone sweep covers GPT-5-Mini, Gemini 3 Flash, Qwen3 at multiple scales, Nemotron-Nano-9B-v2, and OLMo-3-7B-Instruct, confirming the gains are not an artifact of a single backbone. The system is particularly compelling for agentic deployments, where the cost of a false refusal (a broken workflow) is just as real as the cost of a successful jailbreak.
No code or model weights have been released alongside the paper at the time of writing, though the implementation details, including full prompt templates for all four LLM components, are documented in the appendix. The CSM store uses ChromaDB with Google's embeddinggemma-300m encoder, and all LLM components run on Qwen3-8B served via vLLM, making the full stack reproducible from open-weight models.