TL;DR
As LLM assistants transition into long-term, personalized companions, they must learn what to remember across widely diverse tasks—from casual chat to complex coding. This paper introduces BEHEMOTH, a benchmark of 18 datasets to evaluate memory extraction across heterogeneous tasks, and CluE (Cluster-based Evolution), a novel framework that optimizes extraction prompts by clustering training examples by scenario to prevent diverse tasks from diluting or conflicting with prompt updates.
What Problem Does This Paper Address?
When an LLM interacts with a user over multiple sessions, it needs an explicit memory module to bypass context-window limitations and retain crucial information. However, what is "worth remembering" changes drastically depending on the context:
- In a personalization task, the model should remember user preferences (e.g., "allergic to seafood").
- In a problem-solving task, it needs to remember reusable formulas or coding constraints.
- In an agentic task, it needs to extract high-level strategies or pitfalls to avoid.
Existing systems rely on static, hand-crafted rules tailored to narrow domains. While automatic prompt optimization frameworks (like GEPA or MemEvolve) exist, they assume a homogeneous task distribution. When fed a diverse mix of tasks, these frameworks suffer from a dilemma: updating prompts too frequently causes them to overfit to the most recent task type, while updating too infrequently dilutes the feedback signal, washing out fine-grained insights.
Methods
To solve this, the authors propose CluE (Cluster-based Evolution), a self-evolving prompt optimization framework designed explicitly for heterogeneous task distributions. Instead of analyzing a batch of diverse training data all at once, CluE breaks the optimization down into four distinct steps per round:
- Summarization: An LLM acts as a Summarizer, reading the interaction logs and generating a concise summary of the extraction scenario (e.g., what type of info is needed and why it's challenging), abstracting away surface-level topic details.
- Clustering: A Cluster Manager groups these summaries into clusters based on shared extraction patterns (e.g., grouping "procedural knowledge from lengthy dialogues" regardless of whether it came from a math problem or an agent trajectory).
- Cluster-based Analysis: A Cluster Analyzer independently reviews the success and failure patterns within each cluster, generating targeted prompt recommendations that won't interfere with other scenarios.
- Cross-cluster Proposal: A Proposer synthesizes these independent insights into a single, structured prompt containing a comprehensive memory taxonomy and domain-agnostic guidelines.
Datasets
The authors introduce BEHEMOTH (Benchmark for Extracting HElpful Memory On Tasks with Heterogeneity), which repurposes 18 existing datasets into a unified single-step memory extraction protocol. The datasets are split into three macro-categories:
- Personalization (5 datasets): MemBench-High, MemBench-Low, PersonaMem-v2, PrefEval, and LongMemEval (held-out OOD).
- Problem-Solving (7 datasets): Game of 24, AIME, MMLU Pro Physics, MMLU Pro Engineering, MathEquationBalancer, BigCodeBench, and GPQA-Diamond (held-out OOD).
- Agentic (6 datasets): AlfWorld, FEVER, PDDL, BabyAI, ScienceWorld, and ToolBench (held-out OOD).
Extraction quality is measured using a downstream utility-driven metric: how effectively does the extracted memory help a generation model (LLMg) correctly answer an associated target query?
Key Insights and Ideas
- No Single Static Prompt Dominates: Category-specific prompts (like
Mem0for personalization orReasoningBankfor problem-solving) perform exceptionally well in their target domains but degrade significantly elsewhere. - Granularity $\neq$ Quality: More detailed taxonomies do not inherently guarantee better performance. For instance,
OpenMemory's five-class taxonomy failed to outperformSurvey's simpler two-class design, proving that prompt interpretability matters more than sheer granularity. - The "Gradient Cancellation" of Prompts: Standard self-evolving frameworks fail on heterogeneous tasks because feedback from completely different tasks cancels out. For example, optimization steps driven by agentic tasks often inadvertently strip away rules crucial for personalization tasks. Clustering by extraction scenario effectively isolates these conflicting signals.
Key Results
- Superior In-Distribution Performance: Starting from a minimal
Simpleseed prompt, CluE achieved a +9.04% relative gain in macro accuracy across all tasks, consistently outperforming existing frameworks like GEPA (+5.06%), ACE (+3.56%), and MemEvolve (+2.11%). - Robust Out-of-Distribution Generalization: On held-out datasets not seen during prompt evolution, CluE demonstrated strong zero-shot generalization, particularly on
LongMemEval, scoring 63.07% compared to MemEvolve's 56.82% and the baseline's 46.02%. - Backend Agnostic: When the underlying extraction model was switched from Qwen3-32B to Gemini-3-Flash, CluE maintained its lead, achieving the highest overall relative gain (+3.40%).
- Continual Memory Transfer: In a sequential, continual memory setting where memories compound over time, the prompt evolved by CluE maintained its performance advantages stably, avoiding the compounding errors seen with weaker prompts.
Limitations and Future Work
- Scale of Evaluation: While BEHEMOTH includes 18 datasets, real-world assistant deployments feature much longer conversation histories and more complex, multi-session dynamics than single-step testing captures.
- Isolation of the Extraction Phase: This work focuses strictly on the extraction phase of memory. A complete memory system requires evaluating the entire lifecycle—including storage, retrieval, and consolidation/forgetting mechanisms—under a similarly heterogeneous framework. Evolving prompts directly within a continual, stateful memory loop remains an open challenge.
Summary updated