← Latest papers
💬 NLP

MemGuard: Preventing Memory Contamination in Long-Term Memory-Augmented Large Language Models

MemGuard is a type-aware memory framework that prevents heterogeneous memory contamination in long-term memory-augmented LLMs by assigning explicit functional roles to memories and selectively composing evidence, thereby significantly improving reliability and retrieval efficiency.

Original authors: Hyeonjeong Ha, Jeonghwan Kim, Cheng Qian, Jiayu Liu, William M. Campbell, Yue Wu, Yuji Zhang, Kathleen McKeown, Dilek Hakkani-Tur, Heng Ji

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

Original authors: Hyeonjeong Ha, Jeonghwan Kim, Cheng Qian, Jiayu Liu, William M. Campbell, Yue Wu, Yuji Zhang, Kathleen McKeown, Dilek Hakkani-Tur, Heng Ji

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, helpful assistant who remembers everything you've ever told them. They can recall your favorite coffee order, the name of your childhood pet, and the fact that you're allergic to peanuts. This is the promise of Memory-Augmented Large Language Models (LLMs).

However, the paper argues that current assistants are like a messy, chaotic filing cabinet. They throw all your memories into one big drawer without labels. If you say, "My friend took ibuprofen and felt better," the assistant might accidentally mix that up with the medical fact, "Ibuprofen is dangerous for people with asthma."

When the assistant tries to answer a question later, it grabs these mixed-up notes and creates a dangerous, incorrect answer: "You should take ibuprofen!" even though you have asthma. The paper calls this "Heterogeneous Memory Contamination." It's like trying to cook a meal by mixing a recipe, a grocery list, and a story about your last vacation into a single bowl of soup.

The Solution: MEMGUARD

The authors introduce MEMGUARD, a new system that acts like a strict, organized librarian for your assistant's brain. Instead of one messy drawer, MEMGUARD builds three separate, locked rooms:

  1. The Semantic Room (Facts): This holds timeless truths, like "I am allergic to peanuts" or "The sky is blue."
  2. The Episodic Room (Stories): This holds specific events, like "My friend took ibuprofen yesterday and felt better."
  3. The Procedural Room (Rules): This holds instructions, like "If someone has a headache, suggest over-the-counter pain relievers."

How It Works (The Analogy)

1. Writing Memories (The Sorting Phase)
When you talk to the assistant, MEMGUARD doesn't just dump the conversation into the database. It acts like a smart sorter.

  • If you say, "I have asthma," it puts that in the Semantic Room.
  • If you say, "I took ibuprofen once and it helped," it puts that in the Episodic Room.
  • Crucially, it draws a map (a "Relational Graph") connecting these rooms. It knows the story in the Episodic Room is related to the fact in the Semantic Room, but it keeps them in separate buildings so they don't accidentally merge.

2. Retrieving Memories (The Search Phase)
When you ask, "I have a headache; can I take ibuprofen?", the assistant doesn't just search the whole messy pile.

  • Smart Routing: MEMGUARD asks, "What kind of answer do I need?" It realizes it needs a medical rule (Procedural) and a safety constraint (Semantic). It ignores the story about your friend for a moment because that's just an anecdote, not a rule.
  • The Map: It then uses the map to find the specific safety rule in the Semantic Room that says, "No ibuprofen for asthma."
  • The Result: It combines the rule and the safety warning to give you a safe answer: "No, you should avoid ibuprofen because of your asthma."

Why This Matters

The paper tested this system against other memory systems and found two major wins:

  • Fewer Hallucinations: By keeping the "stories," "facts," and "rules" separate, the assistant stops making up dangerous facts. It reduced "memory contamination" (mixing things up) by up to 28%.
  • Efficiency: Because the assistant knows exactly which "room" to look in, it doesn't have to read through thousands of irrelevant notes. It retrieved 5.8 times fewer memory tokens (chunks of text) than previous methods, making it faster and cheaper to run.

The Bottom Line

The paper claims that for an AI to be truly reliable over the long term, it can't just be a "brain" that remembers everything equally. It needs a structured memory system that respects the difference between a one-time story, a permanent fact, and a general rule. MEMGUARD provides that structure, preventing the AI from getting confused and giving you bad advice based on mixed-up memories.

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 →