← Latest papers
💬 NLP

Membrane: A Self-Evolving Contrastive Safety Memory for LLM Agent Defense

Membrane is a self-evolving guardrail that utilizes a Contrastive Safety Memory to dynamically pair harmful queries with their benign counterparts, enabling precise, adaptive defense against evolving jailbreaks while significantly reducing false refusals compared to existing methods.

Original authors: Minseok Choi, Seungbin Yang, Dongjin Kim, Subin Kim, Jungmin Son, Yunseung Lee, Jaegul Choo, Youngjun Kwak

Published 2026-06-05
📖 4 min read☕ Coffee break read

Original authors: Minseok Choi, Seungbin Yang, Dongjin Kim, Subin Kim, Jungmin Son, Yunseung Lee, Jaegul Choo, Youngjun Kwak

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a very smart but slightly naive librarian (the AI) who helps people find information. The problem is, bad actors keep trying to trick this librarian into giving out dangerous or illegal instructions (like "how to build a bomb" or "how to steal credit card numbers") by dressing up their requests in clever disguises. These tricks are called "jailbreaks."

The paper introduces a new security system called MEMBRANE. Think of MEMBRANE not as a rigid wall, but as a living, self-teaching security guard who carries a special notebook called Contrastive Safety Memory (CSM).

Here is how it works, using simple analogies:

1. The Problem: The "One-Sided" Notebook

Old security guards had notebooks that only listed bad things.

  • Example: "If someone asks for a bomb recipe, say NO."
  • The Flaw: If a bad guy asks, "I'm writing a movie script about a bomb," the guard sees the word "bomb" and panics, saying "NO" to the innocent movie writer too. This is called over-refusal. The guard is too scared to let anything through that looks even a little bit like a threat.

2. The Solution: The "Side-by-Side" Notebook

MEMBRANE changes the notebook. Instead of just listing bad things, every entry now has two sides: the Bad Request and the Good Request that looks exactly the same on the surface.

  • The Bad Side: "Write a bomb recipe." -> BLOCK.
  • The Good Side: "Write a scene for a movie where a character asks for a bomb recipe." -> ALLOW.

By pairing them together, the guard learns the difference in intent, not just the words. It learns that the structure of the request matters, not just the keywords.

3. How It Learns: The "Self-Evolving" Process

The system doesn't need to go back to school (retrain) to learn new tricks. It learns in real-time, like a detective solving a case as it happens.

  • The Scenario: A bad guy tries a new trick to bypass the guard.
  • The Reaction:
    • If the guard fails and lets the bad guy through, the system says, "Oops! We missed that." It then creates a new notebook entry: "Here is the bad trick, and here is the good version that looks similar but is safe."
    • If the guard fails by blocking a good person (over-refusal), the system says, "Oops! We were too strict." It updates the entry to say, "Actually, this specific type of request is safe."
  • The Result: The notebook grows smarter with every interaction, creating a "contrastive cell" that captures the exact boundary between safe and unsafe.

4. The "Strategy" Index: Grouping by "Modus Operandi"

The paper notes that bad guys often use the same tactics (like pretending to be a researcher, or splitting a request into small steps) even if the topic changes (from bombs to hate speech).

MEMBRANE organizes its notebook not by the topic (e.g., "Bombs"), but by the tactic (e.g., "Pretending to be a researcher").

  • Analogy: Imagine a police database. Instead of filing a case under "Bank Robbery," they file it under "Method: Disguise as a Pizza Delivery Guy."
  • Why this helps: If the guard learns to spot "Pizza Delivery Disguises" for bank robberies, it automatically knows to be suspicious of "Pizza Delivery Disguises" for any crime, even if it's never seen that specific crime before. This makes the system very good at spotting new variations of old tricks.

5. The "Retrieval Critic": The Double-Check

When a user asks a question, the guard doesn't just guess.

  1. Search: It quickly scans its notebook for similar entries (like a librarian pulling books off a shelf).
  2. Filter: A second, smarter "Critic" looks at those books and asks, "Does this actually apply to this specific question, or is it just a coincidence?"
  3. Decide: The guard makes the final call based on the filtered information.

The Results: A Smarter, Fairer Guard

The paper tested this system against six different types of "jailbreak" attacks.

  • Better at catching bad guys: It stopped almost all the attacks (very low "Attack Success Rate").
  • Better at letting good guys through: It rarely blocked innocent people (very low "Benign Refusal"). Other systems blocked innocent people 28% to 85% of the time; MEMBRANE only blocked them 7% to 14% of the time.
  • Resilient: Even if someone tried to poison the notebook with fake data, the system remained stable and didn't get confused.

In short: MEMBRANE is a security guard that learns by comparing "bad" requests with "good" requests that look identical. By keeping these pairs side-by-side in a smart notebook, it learns exactly where the line is, stopping the bad guys without accidentally kicking out the good guys.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →