Source-linked AI summary
PlugMem: A Task-Agnostic Plugin Memory Module for LLM Agents
Ke Yang, Zixi Chen, Xuan He, Jize Jiang, Michel Galley, Chenglong Wang, Jianfeng Gao, Jiawei Han, ChengXiang Zhai
TL;DR
LLM agents need long-term memory that remains useful without the cost and poor transferability of raw or task-specific designs. PlugMem organizes experience into a knowledge-centric graph of propositional and prescriptive knowledge, then retrieves and reasons over relevant knowledge. Across three heterogeneous benchmarks, the same module consistently improves performance over task-agnostic and task-specific alternatives while reducing memory cost and achieving high information density.
Problem
Existing memory designs are either task-specific and difficult to transfer or task-agnostic systems that retrieve verbose, low-relevance raw memories.
Method
PlugMem abstracts episodic experience into propositional and prescriptive knowledge graphs, retrieves relevant subgraphs, and compresses them into actionable guidance.
Results
PlugMem consistently improves performance over task-agnostic baselines and task-specific memory modules while reducing agent-side memory cost across three heterogeneous benchmarks.
Takeaways & Limitations
Knowledge-centric memory provides a transferable and efficient foundation for long-term decision-making in LLM agents.
Takeaways & Limitations
The evaluated episodic sources are heterogeneous interactions, factual documents, and complex-environment trajectories, defining the demonstrated scope of the method.
Abstract
from arXiv · showhide
Long-term memory is essential for large language model (LLM) agents operating in complex environments, yet existing memory designs are either task-specific and non-transferable, or task-agnostic but less effective due to low task-relevance and context explosion from raw memory retrieval. We propose PlugMem, a task-agnostic plugin memory module that can be attached to arbitrary LLM agents without task-specific redesign. Motivated by the fact that decision-relevant information is concentrated as abstract knowledge rather than raw experience, we draw on cognitive science to structure episodic memories into a compact, extensible knowledge-centric memory graph that explicitly represents propositional and prescriptive knowledge. This representation enables efficient memory retrieval and reasoning over task-relevant knowledge, rather than verbose raw trajectories, and departs from other graph-based methods like GraphRAG by treating knowledge as the unit of memory access and organization instead of entities or text chunks. We evaluate PlugMem unchanged across three heterogeneous benchmarks (long-horizon conversational question answering, multi-hop knowledge retrieval, and web agent tasks). The results show that PlugMem consistently outperforms task-agnostic baselines and exceeds task-specific memory designs, while also achieving the highest information density under a unified information-theoretic analysis. Code and data are available at https://github.com/TIMAN-group/PlugMem.
1. Introduction
LLM agents need reusable long-term memory, but raw retrieval is costly and task-specific designs transfer poorly. PlugMem addresses this by organizing experience into knowledge-centric memory and evaluating utility alongside memory cost across heterogeneous tasks.
- Raw interaction histories cause unbounded memory growth, high computational cost, and degraded performance when retained as context.
- Task-specific memory modules rely on benchmark-specific storage and retrieval heuristics, limiting transfer across conversational, web, and other agent tasks.
- Decision-relevant information is often compact abstract knowledge, whereas raw memories are verbose episodic records dominated by low-level information.
- PlugMem structures heterogeneous memories into a graph of propositional and prescriptive knowledge, then retrieves task-relevant subgraphs for reasoning.
- PlugMem uses the same memory implementation across LongMemEval, HotpotQA, and WebArena, with an information-density framework measuring decision-relevant information gain per memory token.
- The paper reports consistent gains over task-agnostic baselines and task-specific modules while reducing agent-side memory cost.
2. Related Work
Prior agent-memory research spans episodic retrieval, structured representations, and multiple memory types, but most systems remain task-specific. PlugMem instead organizes reusable knowledge units to support cross-task generalization.
- Cognitive accounts distinguish episodic, semantic, and procedural memory, corresponding to experience, factual propositions, and action-oriented strategies.
- Recent systems support long-context understanding, long-term interaction, structured organization, or strategy refinement, but generally do not jointly support multiple memory types.
- Representative memory systems differ in knowledge abstraction, memory-unit choice, structuring, retrieval, reasoning, supported memory types, and task agnosticism.
- Flat retrieval methods store episodic interactions, while task-specific systems transform experience into higher-level representations such as temporal graphs or workflow memories.
- The paper frames cross-task generalization as requiring reusable knowledge, and PLUGMEM therefore uses propositional and prescriptive knowledge units while retaining episodic traces as evidence.
3. Methodology
PlugMem converts heterogeneous experience into structured knowledge graphs, retrieves relevant knowledge, and compresses it into actionable guidance. Its design separates episodic evidence from reusable propositional and procedural knowledge.
- PlugMem has structuring, retrieval, and reasoning modules that standardize episodic memory, extract knowledge, select relevant graph content, and produce actionable guidance.
- The structuring process first standardizes heterogeneous interaction traces and then induces independently indexed propositional and prescriptive knowledge.
- Episodic memory is treated as the substrate for semantic and procedural memories and must accommodate interactions, documents, and action trajectories.
- A raw interaction is represented as a structured tuple whose state, subgoal, and reward capture context, objective, and action evaluation.
- The memory graph aligns its core nodes with complete, self-contained, and verifiable propositions or prescriptions to improve downstream graph operations.
- Semantic memory stores atomic factual propositions with concept links and provenance edges back to source episodic units.
- Procedural memory extracts reusable action strategies from segmented trajectories as compact intent–prescription pairs.
- At system level, PlugMem supports create, retrieve, update, and delete operations, while the main benchmark evaluations focus primarily on create and retrieve.
4. Experiments
PLUGMEM is evaluated unchanged across LongMemEval, HotpotQA, and WebArena using standard task metrics and a unified information-density framework. Across these heterogeneous tasks, it improves performance while reducing memory tokens, with retrieval, structuring, and reasoning contributing distinct roles.
- Evaluation framework: Memory Information Density measures decision-relevant information gain per memory token, enabling task-agnostic comparison of utility and agent-side cost.The analysis reports point-wise mutual information between memory-augmented and base-agent beliefs, normalized by memory length and aggregated across datasets.
- Evaluation setup: The evaluation covers LongMemEval, HotpotQA, and WebArena with fixed retrieval budgets and standardized comparisons across vanilla, task-agnostic, and task-specific baselines.PLUGMEM uses standard benchmark metrics alongside an information-theoretic utility–cost analysis.
- RQ1: Performance and efficiency: PLUGMEM consistently improves end-task performance over task-agnostic and task-specific baselines while injecting substantially fewer memory tokens across the three benchmarks.It attains the highest information-gain density, and Figure 5 places it at higher utility and lower agent-side cost across benchmarks.
- RQ2: Component roles: Ablations identify retrieval as the defining bottleneck, while structuring determines what knowledge is retrievable and reasoning controls how efficiently retrieved knowledge is consumed.Removing retrieval causes the most severe degradation; structuring improves access to task-relevant abstractions, and reasoning primarily affects memory efficiency.
- RQ3: Knowledge transfer and reuse: PLUGMEM supports knowledge reuse across WebArena domains, significantly improving offline success rates with particularly strong gains on Multi-site tasks.The results are attributed to reuse of accumulated procedural and semantic knowledge, mitigating cold-start issues and supporting compositional generalization.
- Discussion: Task-specific heuristics can be layered onto PLUGMEM, and the framework treats them as complementary adaptations rather than alternatives to its task-agnostic backbone.The discussion identifies retrieval and knowledge-centric structuring as shared foundations for task-specific extensions.
5. Conclusions
PLUGMEM organizes agent experience into knowledge-centric representations for retrieving decision-relevant memory across diverse tasks. Experiments show consistent performance gains with lower memory cost, while task-specific adaptations can further improve the general memory backbone.
- Contribution: PLUGMEM is a task-agnostic plugin memory module that organizes agent experience into knowledge-centric representations for diverse agentic tasks.Its design targets effective retrieval of decision-relevant memory across heterogeneous settings.
- Main conclusion: PLUGMEM consistently improves end-task performance while reducing agent-side memory cost under a unified utility–cost evaluation framework.The framework evaluates both task performance and memory efficiency rather than performance alone.
- Extensions: Task-specific heuristics can augment PLUGMEM, with task-adaptation experiments showing further gains beyond standalone use.This positions PLUGMEM as a general memory backbone that can support transferable and extensible memory systems.
A. Real Benchmark Cases Illustrating Why PLUGMEM Outperforms Task-Agnostic and Task-Specific Baselines
PLUGMEM outperforms task-agnostic memory by retrieving knowledge to locate relevant episodic evidence, bridge distant facts, and construct compact, actionable guidance. Its knowledge-centric organization supports cross-task reuse beyond task-specific workflows and raw trajectory retrieval.
- LongMemEval: PLUGMEM retrieves semantic memories first, then selects source episodic sessions containing enough related knowledge for LongMemEval questions.This contrasts with methods that retrieve only semantic entities, facts, or entity-linked dialogue chunks.
- HotpotQA: PLUGMEM uses abstract concepts to route from initial propositions toward distant evidence, rather than relying on narrow local graph expansion.The bipartite graph connects high-level concepts or intents to low-level propositions and prescriptions.
- HotpotQA: The reasoning module compresses retrieved evidence into a minimal sufficient set, improving token efficiency while supporting deeper multi-hop evidence chaining.The examples typically reduce the retrieved pool to two propositions.
- WebArena: PLUGMEM constructs compact, step-adaptive WebArena guidance from procedural knowledge instead of static workflows or verbose episodic recall.This addresses retrieval granularity: raw trajectories may be too page-specific or verbose to act on directly.
- Cross-task rationale: Across prior memory designs, transforming episodic experience into propositional and prescriptive knowledge is the basis for cross-task generalization, while episodic traces remain verifiable evidence.PLUGMEM therefore organizes retrieval and reasoning around knowledge units rather than episodic traces.
B.3. Memory Benchmarks and Evaluation Scope
Memory benchmarks cover different behaviors, but no single benchmark comprehensively evaluates accumulation, abstraction, organization, and reuse in agent decision-making. PLUGMEM therefore evaluates three complementary, established benchmarks spanning episodic, semantic, and procedural memory.
- Evaluation gap: Existing benchmarks probe only limited slices of memory behavior, leaving evaluation fragmented across accumulation, abstraction, organization, and reuse.No single benchmark provides comprehensive coverage of these memory operations in agent decision-making.
- Evaluation dimensions: The benchmark landscape includes episodic accumulation, semantic organization with multi-hop retrieval, and procedural reuse of learned skills or workflows.These categories differ in how memory is constructed, organized, and reused.
- Benchmark selection: LongMemEval, HotpotQA, and WebArena are selected to probe complementary memory behaviors across conversational, static-knowledge, and interactive-web settings.They target long-horizon conversational memory, semantic multi-hop retrieval, and web-based decision-making, respectively.
- Benchmark selection: Their established adoption supports reproducible comparisons with existing memory and agent baselines under consistent evaluation protocols.The benchmarks already have broad prior usage and many evaluated baselines.
C. Implementation Details
PLUGMEM standardizes heterogeneous trajectories into episodic units, derives structured knowledge, and stores propositions with concept tags and episodic provenance. Its implementation uses LLM-based prompts to infer states, subgoals, rewards, and semantic memories.
- Memory construction: PLUGMEM first formalizes raw interactions into uniform episodic memory before inducing semantic and procedural knowledge blocks through a universal API.The layered construction separates trajectory standardization from knowledge structuring.
- Episodic standardization: State derivation uses the previous state, previous action, current observation, and initial goal to produce an updated natural-language state.The goal keeps the inferred state grounded in the agent’s original objective.
- Trajectory interpretation: Prompted subgoal, reward, and state procedures convert action trajectories and observations into intermediate objectives, outcome evaluations, and coherent updated context.The prompts explicitly relate actions and observations to progress toward the overall goal.
- Knowledge extraction: Semantic extraction returns up to Nmax = 10 proposition–tag pairs from each standardized episodic unit.Each proposition is parsed with its associated concept set.
- Knowledge graph: The semantic graph links proposition nodes to concept tags and back to their source episodic units through membership and provenance edges.These links preserve both abstract organization and verifiable episodic origin.
C.5. Full Operations on Memory Graph
PLUGMEM’s memory-graph operations discover related semantic nodes, merge near-duplicates, and evaluate the resulting trade-off between graph compactness and downstream QA performance. The information framework measures decision-relevant utility relative to memory cost.
- Semantic updates: Candidate discovery collects semantic nodes sharing tags, ranks them by embedding similarity, and selects candidates above threshold τ.The default retrieves only the most similar qualifying candidate.
- Semantic updates: Merging synthesizes a combined semantic memory and applies explicit deactivation rules for duplicate, well-merged, or weakly related information.Conflicting information prioritizes the later item as more up-to-date.
- Update evaluation: 63.00/73.97 EM/F1 at τ=0.6 and 62.00/74.65 at τ=0.7 remain within normal fluctuation of the 61.00/74.39 unupdated baseline.The reported comparison suggests graph updating does not materially degrade HotpotQA performance on this subset.
- Graph quality: At τ=0.7, active semantic nodes decrease from 3413 to 3242 (−5.0%), used tags from 12501 to 11812 (−5.5%), and bipartite edges from 23230 to 20604 (−11.3%).The stricter threshold reduces redundancy in semantic memories and tag attachments.
- Utility-cost analysis: Memory Information Density normalizes decision-relevant information gain by the generated memory’s token length, evaluating utility together with processing cost.The framework distinguishes whether memory helps from whether it helps efficiently.
D.1.5. CONTROL AND FILTERING: DEFINING THE EVALUATION SCOPE
The evaluation scope excludes cases where memory adds negligible utility or has zero length, then analyzes utility–cost trade-offs through information gain per token. The framework characterizes performance, efficiency, compression, enhancement, and frontier shifts under baseline-invariant comparisons.
- Evaluation scope: The active evaluation subset excludes instances where the baseline is already highly confident in the optimal action, isolating cases that can benefit from memory.A confidence threshold such as τ_conf = 0.8 or 0.9 defines the filter.
- Evaluation scope: Empty memories are excluded from density calculations because their zero length makes the denominator undefined, but tracked separately for recall rate.This separates efficiency measurement from effectiveness measurement.
- Utility–cost analysis: Memory information density is interpreted geometrically as information gain divided by memory length, represented by the secant slope from the origin to the operating point.The framework uses memory length as cost and PMI-based information gain as utility.
- Utility–cost analysis: The utility curve is modeled as a balance between increasing signal accumulation and noise toxicity, producing under-fitting, sweet-spot, and toxicity regions.Beyond the peak, additional irrelevant tokens can reduce the probability of the correct action.
- Trade-offs: Maximum efficiency and maximum performance are distinct: the efficiency point maximizes information per token, while the performance point maximizes total information.The efficiency point typically occurs earlier, so pursuing peak performance can require disproportionately more tokens.
- Trade-offs: A north-west shift indicates hybrid gains that reduce memory cost while increasing accuracy, whereas a Pareto-frontier shift raises the attainable utility ceiling.The framework also claims relative landscape features remain invariant to constant baseline-confidence offsets.
D.3. Distributional Metric: Certainty and Calibration
The distributional metric complements pointwise accuracy by measuring how memory changes uncertainty across the action space. It distinguishes useful sharpening and corrective calibration from confusion and confident hallucination.
- Motivation: Pointwise mutual information can miss cases where memory slightly raises the correct action’s probability but leaves the agent uncertain among many alternatives.Distributional information density is introduced to measure global uncertainty reduction.
- Metric: Distributional information density measures uncertainty reduction per unit of memory-processing cost using entropy before and after memory.The prior distribution depends on state s, while the posterior additionally conditions on memory m.
- Metric: Positive ΔH denotes sharpening that prunes invalid options, whereas negative ΔH denotes confusion caused by conflicting information.The framework interprets these signs as changes in effective search-space size.
- Regimes: The confidence–validity projection combines entropy change with PMI to classify memory interactions into four regimes.Its axes are action-space compression on x and decision information gain on y.
- Regimes: Corrective calibration occurs when memory increases uncertainty but raises the probability of the true action, rescuing agents from confident errors.This regime is described as breaking false confidence.
- Regimes: The hallucination trap occurs when memory reduces uncertainty while lowering accuracy, making the agent confidently wrong.This is identified as a particularly dangerous failure mode because certainty points away from the ground truth.
D.3.3. VALIDITY-ADJUSTED DISTRIBUTIONAL INFORMATION DENSITY
The validity-adjusted distributional density combines uncertainty change, memory cost, and correctness direction into one metric. The broader framework relates this diagnostic to divergence reduction, with PMI serving as a tractable special case under a one-hot oracle.
- Metric definition: Validity-adjusted distributional information density rewards useful uncertainty shifts and penalizes shifts that reduce accuracy.It is designed to synthesize distributional change with the direction of accuracy gain.
- Interpretation: The metric is positive for both efficient correct sharpening and corrective calibration, including cases where entropy rises while accuracy improves.The sign of PMI validates whether the distributional shift is beneficial.
- Interpretation: The metric becomes negative for hallucination and destructive noise, penalizing confident wrong answers more strongly as their certainty increases.It treats distracting processing as negative work when memory both confuses the agent and lowers accuracy.
- Oracle-Divergence Principle: The Oracle-Divergence Principle defines memory utility as reducing the KL divergence between the agent’s posterior policy and an ideal policy.Memory transforms the baseline belief toward an oracle distribution for the current state.
- PMI special case: Under a deterministic one-hot oracle, PMI is mathematically equivalent to minimizing KL divergence while requiring only the ground-truth action probability.This makes PMI computationally tractable and theoretically sufficient in that regime.
- Unified interpretation: The framework treats accuracy and certainty as coupled, using PMI as the primary efficiency proxy and validity-adjusted density as a diagnostic against off-target confidence.Together they approximate movement toward the ideal policy while monitoring whether certainty points in the correct direction.
E.1. LongMemEval
LongMemEval evaluates PLUGMEM on long-horizon conversational question answering using historical conversations, with comparisons against vanilla, task-agnostic, and task-specific memory baselines. PLUGMEM achieves the strongest reported performance and information-gain density while incurring comparable token usage and relying on lower-cost open-source models.
- Setup: LongMemEvalS uses 115K-token conversation contexts to test answering from historical user–agent interactions.The evaluation uses the LongMemEvalS subset and Qwen2.5 models for PLUGMEM’s structuring and retrieval modules.
- Baselines: The comparison includes vanilla, task-agnostic, and task-specific memory baselines, including Zep and LiCoMemory.Zep results are taken from its paper, while A-Mem and LiCoMemory are evaluated on shuffled LongMemEval cases.
- Main Results: PLUGMEM outperforms all baselines on LongMemEval and attains the highest global information-gain density.It also delivers the top performance on the challenging multi-session subset requiring retrieval and counting across multiple sessions.
- Ablations: Removing PLUGMEM’s structuring, retrieval, and reasoning components consistently degrades task performance and global information density.The ablation removes structured indexing or retrieval and evaluates the resulting reductions.
- Cost Analysis: PLUGMEM’s token consumption is comparable in scale to competing methods, while its open-source inference models can reduce deployment cost relative to closed-source alternatives.The paper distinguishes token usage from actual pricing and notes that PLUGMEM’s additional processing supports broader memory organization.
E.2. HotpotQA
HotpotQA evaluates PLUGMEM for multi-hop retrieval and reasoning over a 1,000-example subset. Its structured memory construction and two-channel retrieval support performance and information-density gains, while the upfront construction cost can be reused across tasks and time.
- Setup: HotpotQA is a multi-hop question-answering benchmark evaluated here on a preprocessed subset of 1,000 examples.All methods use Qwen2.5-32B-Instruct as the backbone and NV-Embed-v2 for embeddings.
- Memory Construction: PLUGMEM indexes corpus text as single-step episodic items and represents each item within its standardized memory framework.For passive HotpotQA indexing, each text unit is treated as a trajectory with T = 1.
- Retrieval: At each hop, PLUGMEM combines abstract-node link expansion with direct embedding retrieval, then uses an LLM controller to decide whether to stop or continue.The controller can select up to two candidates to form the next-hop query.
- Metrics: The evaluation reports Exact Match, F1, and information-theoretic memory density based on answer overlap and memory-token usage.Global density aggregates PMI across instances using a ratio of summed information gain to summed memory tokens.
- Ablations: Removing any single PLUGMEM component consistently degrades task performance and global information-gain density.The ablations replace structured indexing with chunking and structured retrieval with randomly sampled memory items.
- Cost Analysis: PLUGMEM’s token usage remains comparable to strong baselines, while joint memory construction can be reused and amortized in multi-task or continual settings.The paper describes this as a one-time investment supporting heterogeneous memory operations without separate extraction pipelines.
E.3. WebArena
WebArena tests PLUGMEM on procedural and cross-site web tasks using online learning and offline reuse. PLUGMEM incurs higher token usage than baselines, but its structured procedural memories can be reused and its open-source-model costs remain practical.
- Setup: WebArena contains 812 web-navigation tasks across five domains, with this study focusing on Shopping, GitLab, and Multi-site subsets.The online/offline split places one instantiation from each intent template online and related instantiations offline.
- Evaluation Protocol: During online evaluation PLUGMEM inserts and retrieves memories, while offline evaluation permits retrieval only after memory augmentation.The setup also adds a small number of high-quality human demonstrations before offline testing.
- Integration: PLUGMEM retrieves guidance for the current objective, records actions as episodic memories, and inserts completed task sequences into its memory graph.The reasoning module’s response is supplied to AgentOccam before action execution.
- Metrics: WebArena performance is measured by functional task success rates on online and offline sets, with PMI computed per task sample.Additive smoothing uses 1% of AgentOccam’s average success rate.
- Cost Analysis: PLUGMEM uses more tokens than task-agnostic and task-specific baselines on WebArena because memory-to-knowledge abstraction requires additional computation.The extra processing standardizes long trajectories into subgoal-aligned procedural memory units.
- Cost Analysis: PLUGMEM’s additional tokens are mostly generated with open-source models, and its procedural memory graph can be reused across similar task instances.The paper reports that reuse can reduce effective cost as task horizon and diversity increase.
F. Task Adaptation via Integrating Task-Specific Heuristics on Top of PLUGMEM
The paper studies task adaptation by adding targeted heuristics and retrieval refinements on top of PLUGMEM. These adaptations improve controllability while preserving PLUGMEM’s general task-agnostic operation in the main WebArena setting.
- LongMemEval Adaptation: LongMemEval task adaptation incorporates RMM’s Prospective Reflection mechanism for semantic-memory extraction and node updating.The adapted prompts emphasize user-specific personal information and experiences.
- LongMemEval Adaptation: The multi-session LongMemEval subset tests retrieval of multiple similar events and accurate counting across dialogue sessions.This setting stresses both retrieval of multiple gold memories and precise memory extraction.
- HotpotQA Scaling: On HotpotQA, increasing the retrieval hop limit from 2 to 4 raises Exact Match/F1 from 66.00/74.73 to 69.00/78.11.The hop limit is a test-time control over retrieval computation.
- HotpotQA Scaling: Query synthesis can replace naive query–fact concatenation to reduce lexical drift and redundancy during later retrieval hops.The synthesized query is intended to help the embedding channel retrieve more targeted evidence.
- WebArena Adaptation: PLUGMEM’s main WebArena experiments avoid handcrafted domain instructions and instead reuse agent-generated and human demonstration trajectories as structured memory.This contrasts with task-specific agents that inject manually engineered navigation guidance.
- WebArena Adaptation: A targeted WebArena case study adds search-bar guidance to address cases where PLUGMEM recommends category-dropdown navigation.The case study reports that this manual instruction resolves several challenging tasks while leaving general operation task-agnostic.