← Latest papers
💬 NLP

Beyond RAG for Agent Memory: Retrieval by Decoupling and Aggregation

This paper introduces xMemory, a novel agent memory framework that improves upon standard RAG by decoupling interaction histories into reusable components and aggregating them hierarchically to enable top-down retrieval that reduces redundancy while preserving critical details, thereby enhancing answer quality and inference efficiency.

Original authors: Zhanghao Hu, Qinglin Zhu, Runcong Zhao, Di Liang, Hanqi Yan, Yulan He, Lin Gui

Published 2026-05-13
📖 5 min read🧠 Deep dive

Original authors: Zhanghao Hu, Qinglin Zhu, Runcong Zhao, Di Liang, Hanqi Yan, Yulan He, Lin Gui

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

The Problem: The "Noisy Library" vs. The "Smart Librarian"

Imagine you are an AI assistant (an "Agent") talking to a human over many months. You have a massive memory of every conversation you've ever had.

The Old Way (Standard RAG):
Think of your memory as a giant, chaotic library where every book is just a raw transcript of a conversation. When the user asks a question, the "Librarian" (the AI) grabs the top 5 books that have the most similar words to the question.

  • The Flaw: In a long conversation, people often repeat themselves or talk about the same topic in slightly different ways. If you ask, "When did I lose my job?", the old system might grab five different pages from five different days where you mentioned losing your job. It gives you a pile of redundant, confusing information. It's like asking for a specific date, and the librarian hands you five different calendars that all say "January" but don't tell you which January.

The New Way (xMemory):
The authors argue that agent memory isn't like a library of random books; it's more like a continuous stream of events where details are tightly packed together. To fix this, they propose a new system called xMemory.

The Core Idea: "Decoupling Before Aggregation"

The paper suggests a two-step process: Decouple (separate the important bits) and then Aggregate (organize them).

1. Decoupling: The "Fact Extractor"

Instead of treating a whole conversation as one big block, xMemory acts like a skilled editor. It reads a conversation and pulls out the specific, reusable facts, updates, and details, separating them from the "fluff" (like "Hello," "How are you," or repeated greetings).

  • Analogy: Imagine you have a messy desk covered in sticky notes. Some notes say "Meeting at 2 PM," others say "Meeting at 2 PM (confirmed)," and others say "Meeting at 2 PM (cancelled)."
    • The Old Way grabs the whole pile of sticky notes.
    • xMemory peels off just the single, most accurate note: "Meeting at 2 PM." It isolates the truth from the noise.

2. Aggregation: The "Smart Filing System"

Once the facts are isolated, xMemory doesn't just throw them in a bucket. It organizes them into a hierarchy:

  • Segments: Small groups of related events (like a specific conversation topic).
  • Components: The specific facts extracted from those segments (e.g., "User lost job at DoorDash in Jan").
  • Groups: High-level folders that hold related components (e.g., "User's Employment History").

Crucially, this system is revisable. If you have a new conversation that clarifies an old fact, xMemory can go back, split a messy folder, or merge two small ones to keep the organization perfect. It's like a filing cabinet that reorganizes itself automatically when you add a new document.

How It Finds Answers: The "Top-Down Detective"

When you ask a question, xMemory doesn't just search for keywords. It uses a Top-Down approach:

  1. Stage 1: The Skeleton Search. It first looks at the high-level "Groups" and "Components" (the facts). It picks the most relevant "backbone" of evidence. It asks: "Do I have the right facts to answer this?"
  2. Stage 2: The Uncertainty Check. Only if the facts aren't clear enough does it dig deeper. It expands to the original conversation segments and raw messages only if it needs more detail to reduce its "uncertainty."
    • Analogy: Imagine a detective solving a crime.
      • Old Way: The detective grabs 20 witness statements that all sound vaguely similar and reads them all.
      • xMemory: The detective first checks the "Case File Summary" (the Group). If the summary says "Suspect was at the bank," the detective stops there. But if the summary is vague, the detective then pulls the specific transcript of the witness (the Segment) to get the exact time.

Why This Matters (The Results)

The paper tested this system on two datasets (LoCoMo and PerLTQA) using different AI models. Here is what they found:

  • Better Answers: Because xMemory separates the "decisive evidence" from the "redundant noise," the AI gives more accurate answers, especially for tricky questions about time or specific changes in a user's life.
  • Cheaper & Faster: The system uses fewer "tokens" (the currency of AI processing). Instead of feeding the AI a huge, messy block of text, it feeds it a tight, concentrated package of facts.
  • Efficiency: It retrieves "denser" evidence. Instead of finding 10 pages that say "I like pizza," it finds the one specific note that says "I like pepperoni pizza."

Summary in One Sentence

xMemory fixes the problem of AI getting confused by its own long conversations by first separating the important facts from the noise, organizing them into a self-updating hierarchy, and then retrieving only the exact amount of detail needed to answer a question, saving time and money while getting the answer right.

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 →