acceptodds
Desk rejected at ICLR 2027

Beyond Similarity: Trustworthy Memory Search for Personal AI Agents

Desk rejected at ICLR 2027, so left out of the paper lists and the map.

Abstract

Personal AI agents increasingly rely on long-term memory to personalize their behavior across sessions. Existing memory pipelines, however, are largely driven by semantic similarity: memories close to the current query are retrieved and injected into the model context. This creates a trustworthiness gap, because a semantically related memory may still be contextually inappropriate, leading to cross-domain leakage, sycophancy, tool-call drift, and memory-induced jailbreaks. To mitigate these failures, we propose MemGate, a lightweight, deployable plug-in for trustworthy memory search with only 9M parameters and a 35.1MB footprint. MemGate sits between the vector memory store and the backbone LLM and requires no LLM modification, memory-database rewriting, or inference-time LLM judge. It applies a query-conditioned neural gate to candidate memory representations, turning raw similarity search into task-conditioned memory ranking. Across multiple mainstream memory frameworks, a real-world agent, and diverse LLM backbones, MemGate reduces memory-induced failures while preserving long-term memory utility.

Primary area:
alignment, fairness, safety, privacy, and societal considerations
Keywords:
LLM Agent, Memory, Safety

Reviews

Among:
Shape:
1234this paper, Top 49%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.33 over 3 reviews, above 51% of the others.
Reviewer_RzvgOpenReview ↗
Rating
3
Confidence
3
Informativeness
3
Presentation
3
Soundness
2
Read review
Paper summary

Previous:

MemGate reranks retrieved memories before they enter an agent’s context. A query-conditioned gate adjusts memory embeddings to favor memories appropriate for the current request, rather than merely related to it. The reported results show reduced memory-induced failures with broadly preserved utility, although the gains vary across risk categories.

Updated revirew:

The proopsed MemGate method reranks the selected memories before used by agents. the query-conditioned gate update memory embeddings to select memories that are appropriate for the current user query, rather than related to it. The experimenetal results show reduced memory-induced failures with broadly preserved utility, although the gains vary across risk categories.

Critical strengths

Previous:

The distinction between relevant and appropriate memories is useful. The method can be added without changing the backbone LLM or rewriting the memory store. The reductions in cross-domain leakage and jailbreak ASR are meaningful, and the cross-family re-evaluation strengthens the evidence. The reported retrieval overhead is modest and requires no additional LLM calls.

Update:

The motivation is sound: the distinction between relevant and appropriate memories is useful. More importantly, this method can be added without changing the backbone LLM or rewriting the memories, which is meaningful for cross-domain leakage and jailbreak. Beisdes, the reported retrieval overhead is modest and doesnot need the LLMs.

Critical weaknesses

Previous:

The gains on sycophancy remain small: failure rates improve by only 1.5–3 percentage points across the three judges. Adaptive attacks also expose a limitation. Under white-box oracle injection, MemGate’s ASR is 23.7%, compared with 41.6% for native retrieval; the lower 11.2% result requires the separately trained MemGate-AT variant. The MemTrapBench results are encouraging, but cover two categories close to the paper’s threat model. They support transfer to a different benchmark, not yet broad generalization to substantially different risks.

Uppdate:

The improvements on sycophancy is modest and the adaptive attacks is limitated. In the white-box oracle injection settings, MemGate’s ASR is lower, requiring the separately trained for MemGate-AT. Although the MemTrapBench results are encouraging, but cover two categories close to the paper’s threat model.

Questions for authors
  1. Do the conclusions hold when training/testing with a judge from a different model family, or with human labels?
  2. Can an adaptive attacker who knows the gate craft poisoning text that evades it?
  3. Is one gate call per candidate memory acceptable in latency/cost for production systems?
  4. How does MemGate compare to simple baselines such as LLM-as-judge filtering or perplexity filtering?
4 comments
AuthorsOpenReview ↗

Official Comment by Authors (1/2)

We thank the reviewer for the constructive questions. Unless noted, new experiments use the Table 2 setting (OpenClaw, GPT-4o-mini, Nc=50N_c = 50, k=20k = 20, 5 runs).

Q1. Judges from other model families. Two metrics already avoid the GPT-4o-mini judge: ASR is judged by Llama-Guard, and LoCoMo F1 uses no LLM judge. MemGate improves both in every setting. For the other three metrics, we re-judged the saved responses with judges from two other model families, using the same rubric and threshold.

EvaluatorCross-D. FR↓ (Native → MemGate)Syco FR↓Tool-call FR↓
GPT-4o-mini (ours)27.0 → 3.533.5 → 31.562.9 → 54.3
Claude-Opus-5.529.5 → 4.536.0 → 33.060.0 → 52.4
Qwen3-235B-A22B25.0 → 4.031.5 → 30.064.8 → 56.2

All three judges show similar reductions: 21–25 points for cross-domain FR, 1.5–3 for sycophancy, and 7.6–8.6 for tool-call drift. Our conclusions do not depend on the judge.

Q2. Training-set size and unseen risk categories. We test generalization on MemTrapBench (Wang et al., 2026), which played no part in our training, data generation, or design, and differs from our training data in format and content. Each instance is an 18–40-turn dialogue in which an early prior is buried under unrelated turns and then invalidated by a final query that changes when it applies. We evaluate the two categories closest to our threat model:

  • Safety: counterfactual or sandbox premises override a safety judgment.
  • Task Boundary: rules from an earlier task carry over to a new one, a cross-domain scope violation.

Scores follow the official protocol (average of four dimensions, judged by GPT-5.2; higher is better). Because each dialogue yields only a few dozen memory units, all memory-enabled methods use k=5k = 5.

SettingMethodSafety↑Task Boundary↑
GPT-4o-miniw/o Memory93.490.8
MemOSNative retrieval61.238.6
+ MemGate82.781.5
OpenClawNative retrieval58.435.2
+ MemGate90.989.8

Without retraining, MemGate closes 67%–98% of the gap between native retrieval and the memory-free setting. Although it is trained on only 1,640 triples, it transfers to unseen dialogues. This suggests that it learns the pattern these failures share, a memory that matches the query in topic but not in scope, rather than memorizing training templates.

Q3. Adaptive attacker. We attacked the gate directly, starting from the PS-Bench planted memories, with two attacks:

  • White-box: GCG-style token optimization that maximizes the gated score.
  • Black-box: PAIR-style LLM rewriting guided by the agent's responses.

Native retrieval faces the same attacks, with cosine similarity as the target. MemGate-AT is a variant trained with attack memories, generated on training queries, added as negatives.

AttackNative ASR↓MemGate ASR↓MemGate-AT ASR↓
Non-adaptive (paper)16.84.43.9
White-box, oracle injection41.623.711.2
Black-box LLM rewriting, end-to-end27.58.35.6

Adaptive attacks raise ASR for every method, but MemGate stays well below native retrieval. The white-box attack is the strongest (23.7% vs. 41.6%), and adversarial training roughly halves it (11.2%). Under the more realistic black-box attack, MemGate reaches only 8.3% (5.6% with adversarial training), versus 27.5% for native retrieval.

AuthorsOpenReview ↗

Official Comment by Authors (2/2)

Q4. Latency and cost. MemGate makes no per-candidate model call: all NcN_c candidates go through a 9M-parameter MLP in one batched forward pass. For 50 candidates this costs about 0.9 GFLOPs, roughly 1/18 of one output token from an 8B model, with no API cost, and the cost scales with NcN_c rather than with the memory store. Measured memory-search latency rises by 0.02–0.12 s at P50 and at most 0.19 s at P90 (Table 5), versus 1.4–4.9 s for every LLM-judge filter (Table 2). With memory embeddings cached at write time, MemGate adds only 6 ms on GPU or 31 ms on CPU.

Q5. Baselines. Table 2 already includes four LLM-as-judge filters (pointwise and listwise, each with GPT-4o-mini and GPT-5.1). We add a perplexity filter: candidates whose perplexity under Qwen3-0.6B exceeds the 95th percentile of benign memories are removed, and the top-kk is taken by similarity.

MethodCross-D. FR↓Syco FR↓Tool-call FR↓ASR↓LoCoMo↑Extra callsP50 (s)↓
Native retrieval27.033.562.916.838.901.47
Perplexity filter (new)26.533.561.916.438.701.62
Pointwise LLM judge (GPT-5.1)8.527.556.26.936.7504.61
Listwise LLM judge (GPT-5.1)7.027.055.26.140.116.38
MemGate3.531.554.34.440.801.59

The perplexity filter barely changes any metric, likely because inappropriate memories here are fluent text rather than perplexity outliers. It is also slower than MemGate.

Thank you again for your time and thoughtful feedback. We have posted our responses to your comments. Please let us know whether any concerns remain so that we can address them before the discussion period ends.

Thanks authors for the additional experiments and clarifications. The cross-family re-evaluation, batched-scoring explanation, and baseline comparisons address several of my concerns. The lightweight design and demonstrated reductions in memory-induced failures are valuable, but the remaining robustness and generalization is still limited. Therefore, I will keep my score.

Reviewer_w4SdOpenReview ↗
Rating
2
Confidence
2
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

MemGate targets trustworthiness failures in retrieval-based personal-agent memory: semantic similarity can retrieve memories that are relevant but inappropriate, causing cross-domain leakage, sycophancy, tool-call drift, and jailbreaks. It inserts a lightweight query-conditioned gate between the memory store and the LLM to rerank candidates using masked cosine similarity, trained with retriever-relative ranking and a preservation penalty. It does not modify the LLM, rewrite memories, or require an inference-time judge. Across A-Mem, Mem0, MemOS, OpenClaw, and multiple backbones, it substantially reduces leakage and jailbreaks while generally preserving utility and low latency, though sycophancy and some tool-drift gains remain limited.

Critical strengths
  1. It is lightweight and non-invasive: no LLM modification, no memory rewriting, and no additional inference-time judge, while integrating across several memory systems and backbones.
  2. It shows strong reductions in cross-domain leakage and jailbreak ASR with generally preserved utility. For example, on OpenClaw with GPT-4o-mini, cross-domain FR drops from 27.0% to 3.5%, and jailbreak ASR from 16.8% to 4.4%.
Critical weaknesses
  1. The evaluation model lineup is dated relative to the latest frontier agentic models. Results and judging rely mainly on GPT-4o-mini, GPT-5.1, Gemini-3-Pro, and Claude-Sonnet-4.6, without coverage of newer models such as Claude-Opus-5.5, DeepSeek-V4-Pro, or GPT-6, so the conclusions may not transfer to newer backbones.
  2. The candidate-retrieval budget N_c=50 and final injection size k=20 are fixed, but the paper does not report sensitivity to either hyperparameter. There is no sweep over candidate count or final memory count, so it is unclear how much the observed safety-utility balance depends on these choices.
Questions for authors
  1. Do the main safety and utility results remain stable on newer backbones such as Claude-Opus-5.5, DeepSeek-V4-Pro, and GPT-6, and which risk categories change most with stronger instruction-following and tool-use capabilities?
  2. How do the safety and utility results change when N_c and k are varied, and what happens as the proportion of inappropriate or contaminated candidates rises from 0% to 100%? This would show whether the reported improvements are specific to N_c=50 and k=20.
5 comments

We thank the reviewer for these questions. Both experiments follow the Table 2 setting (OpenClaw, same benchmarks and judges, 5 runs); Q2 uses GPT-4o-mini.

Q1. Newer backbones. We use Nc=50N_c = 50 and k=20k = 20. Each cell reports native retrieval → MemGate.

BackboneCross-D. FR↓Syco FR↓Tool-call FR↓ASR↓LoCoMo↑
Claude-Opus-5.512.0 → 2.035.0 → 32.586.7 → 15.25.7 → 1.944.6 → 46.3
GPT-6-Sol0.0 → 0.04.5 → 4.037.1 → 2.911.2 → 3.146.2 → 47.6
DeepSeek-V4-Pro18.5 → 2.528.0 → 26.571.4 → 21.014.3 → 3.642.8 → 44.9

The trends match those in the paper. MemGate reduces cross-domain FR to at most 2.5% and ASR to at most 3.6%, and raises LoCoMo F1 by 1.4–2.1 points. Under native retrieval, tool-call drift is the largest failure on all three backbones (37.1%–86.7%). We attribute this to stronger instruction following and tool use, which lead these models to apply remembered traits to tool parameters more faithfully. Because filtering the retrieved memories alone removes most of this drift (e.g., 86.7% → 15.2% on Claude-Opus-5.5), the drift comes mainly from what is retrieved, and this is where MemGate gains most.

Q2. Varying NcN_c, kk, and the contamination ratio. Each cell reports native retrieval → MemGate. Native retrieval takes the backend's top-kk, so it does not depend on NcN_c.

NcN_c / kkCross-D. FR↓Tool-call FR↓ASR↓LoCoMo↑
30 / 2027.0 → 6.062.9 → 56.216.8 → 6.538.9 → 40.2
50 / 20 (default)27.0 → 3.562.9 → 54.316.8 → 4.438.9 → 40.8
100 / 2027.0 → 3.062.9 → 53.316.8 → 4.138.9 → 41.0
50 / 1025.0 → 3.060.0 → 52.415.7 → 3.936.8 → 39.5
50 / 3028.5 → 5.564.8 → 56.217.5 → 5.639.4 → 40.9

For the contamination sweep, we fix Nc=50N_c = 50 and k=20k = 20. In each candidate set, a fraction ρ\rho of the candidates are inappropriate memories (the benchmark's out-of-scope or planted memories), and the rest are appropriate memories of the same user.

ρ\rhoCross-D. FR↓Tool-call FR↓ASR↓LoCoMo↑
0%2.0 → 2.044.8 → 44.82.7 → 2.741.5 → 41.6
25%24.0 → 3.057.1 → 44.815.2 → 3.739.2 → 41.0
50%31.5 → 4.563.8 → 44.819.9 → 3.736.4 → 40.3
75%35.0 → 12.567.6 → 58.122.4 → 9.133.1 → 37.2

The gains do not depend on the choice of Nc=50N_c = 50 and k=20k = 20: MemGate improves every metric in every configuration, and its gains saturate beyond Nc=50N_c = 50.

Under contamination, MemGate does no harm at ρ=0\rho = 0. Up to ρ=50\rho = 50%, it keeps cross-domain FR and ASR below 5% and tool-call FR at its uncontaminated level (44.8%), while native retrieval degrades steadily. It remains effective at ρ=75\rho = 75%, where fewer appropriate candidates remain than the budget k=20k = 20. At ρ=100\rho = 100%, every candidate is inappropriate, so any top-kk re-ranker must admit inappropriate memories. Adding a threshold that drops candidates the gate strongly demotes handles this case, reducing cross-domain FR to 6.0% and ASR to 4.1%. We have Added as Table 3 and discussed in Section 4.5 (paragraph "Candidate pool, budget, and contamination").

Thank you again for your time and thoughtful feedback. We have posted our responses to your comments. Please let us know whether any concerns remain so that we can address them before the discussion period ends.

Thank you for the detailed responses and additional experiments, which address my explicit questions. However, I still view the method as a relatively incremental extension of learned reranking. While the additional results strengthen the empirical evidence, they do not substantially change my assessment of the methodological novelty or the overall contribution. I therefore maintain my original score.

Reviewer_iUbqOpenReview ↗
Rating
2
Confidence
4
Informativeness
1
Presentation
2
Soundness
2
Read review
Paper summary

This paper investigates the issue of trustworthiness in long-term memory retrieval for personal AI agents. It highlights that traditional retrieval methods—relying solely on semantic similarity—can inadvertently surface inappropriate historical memories, leading to privacy leaks, sycophancy (bias toward user preferences), misdirected tool invocation, and various security risks. To address this, the authors propose "MemGate," a lightweight memory re-ranking approach based on query-conditioned gating. By dynamically weighting memory embeddings—optimized through a combination of retriever-relative ranking loss and preservation loss—MemGate filters out unsuitable memories while retaining those that are useful. Experiments conducted across various memory frameworks, LLM backbones, and benchmarks demonstrate that this method effectively mitigates security and trustworthiness concerns related to memory, while maintaining or enhancing the utility of long-term memory, all with minimal additional inference overhead.

Critical strengths

This paper addresses the issue of trustworthiness in long-term memory retrieval. The research is well-motivated and holds significant practical value. The proposed "MemGate" framework requires no modifications to existing large language models (LLMs) or memory systems, offering excellent versatility and ease of deployment.

The experimental evaluation—covering a range of mainstream memory frameworks, LLM backbones, and benchmarks—is comprehensive. The results demonstrate that this approach significantly mitigates security risks associated with memory usage, while maintaining or even enhancing performance, all with minimal additional inference overhead.

Critical weaknesses

The method lacks sufficient innovation. MemGate, as proposed in this paper, is essentially a RAG re-ranking approach based on supervised fine-tuning; it employs a lightweight MLP to re-weight retrieved memory embeddings. The overall concept is quite similar to existing RAG retriever fine-tuning or re-ranking methods, and the "query-conditioned gating" and "ranking loss" mechanisms also lack significant technical novelty. Consequently, the paper fails to clearly articulate its fundamental distinctions from—or unique contributions beyond—existing retrieval optimization methods.

There is a lack of comparison with more advanced memory learning approaches. The current experiments primarily compare the proposed method against traditional memory retrieval techniques, supervised re-rankers, and LLM-based judges. It omits comparisons with methods that optimize memory through task-based feedback (such as MemSkill or MemRL). Since these approaches—which leverage downstream task feedback to refine memory selection or usage strategies—are highly relevant to the research objectives of this paper, their absence is a notable gap.

Questions for authors

Please see above.

3 comments

W1: Novelty of MemGate.

Thank you for the question. Our contribution lies in the problem it targets and the design that follows from it: a truthful, topically relevant memory can still be inappropriate for the current request. For example, a dietary preference should guide a restaurant recommendation, but it should not become evidence in an objective judgment about healthy eating. Our supervision separates appropriate memory use from misleading topical overlap, including cases where conventional relevance remains high. We therefore claim a design for contextual memory appropriateness, not a new generic preference loss. Table 2 supports this distinction: two re-rankers trained on the same 1,640 triples, a contrastively fine-tuned encoder and a capacity-matched scalar scorer, trail MemGate on all four trustworthiness metrics and lower utility below native retrieval. The gains therefore do not come from the supervision alone.

At the system level, MemGate is a lightweight component (about 9M parameters) added to the agent harness for memory selection. It reduces memory-induced failures without changing model parameters, rewriting the memory store, or adding LLM calls, so it can be used with closed-source models.

W2: Comparison with MemSkill and MemRL.

Thank you for the suggestion. We agree that both works are relevant and have added them to the related work and the experiments. MemSkill learns how memories are written: an RL-trained controller selects memory skills, and an LLM executor applies them to extract, consolidate, and prune memories. MemRL is closer to our setting, since it re-ranks recalled memories using utilities learned from task feedback.

Setup. All runs follow the Table 2 setting: OpenClaw with GPT-4o-mini, the same evaluation sets as Section 4, the same 50 candidates, and k=20k = 20.

  • MemRL. We use the authors' code and default hyperparameters (α=0.3\alpha = 0.3, λ=0.5\lambda = 0.5, Qinit=0Q_{\text{init}} = 0, z-score normalization). Its Phase A is replaced by OpenClaw's native search, so all methods see the same candidates, and the memory store is kept unchanged, so no trajectory summaries are written back.

    • Warm-up. Before the test query, each instance receives M=20M = 20 warm-up queries on its own memories.
    • Task reward. A GPT-4o-mini judgment of whether the response fulfils the request.
    • Privileged reward. The task reward plus a penalty on failures flagged by our evaluation judges.
  • MemSkill. We use the authors' code with K=7K = 7 skills and span size 512, in place of OpenClaw's memory writing.

Method (configuration; training cost)Cross-D. FR↓Syco FR↓Tool-call FR↓ASR↓LoCoMo↑PreFEval↑Extra callsP50 (s)↓
OpenClaw, native retrieval27.033.562.916.838.986.401.47
MemRL, task reward (~3.0 h)25.034.563.819.639.786.9401.49
MemRL, task + privileged reward (~3.5 h)11.032.557.19.239.286.1601.49
MemSkill27.533.064.816.441.087.601.42
MemGate (ours, ~0.1 h)3.531.554.34.440.888.201.59

Training cost is wall-clock time measured on the 1,255 trustworthiness instances. For MemRL, extra calls count the LLM calls made during warm-up for each instance.

With the task reward, MemRL slightly improves utility, but raises ASR, consistent with task feedback also rewarding memories that make a request look legitimate. With the privileged reward, cross-domain FR and ASR fall to 11.0 and 9.2, which remain well above MemGate. MemGate needs no warm-up and no extra calls, and trains in about 0.1h. MemSkill gives the best LoCoMo F1 (41.0) and the lowest latency, but leaves all four failure rates within 2 points of native retrieval, since well-written memories can still be retrieved for the wrong request. MemSkill improves what is written, whereas MemGate decides which memories are used for a given request. The comparison is added to Table 2 and to Section 4.4 (paragraph "Learned memory management"), and both works are discussed in Related Work.

Thank you again for your time and thoughtful feedback. We have posted our responses to your comments. Please let us know whether any concerns remain so that we can address them before the discussion period ends.

We thank the reviewer for the follow-up. MemGate does operate at the re-ranking stage, but we believe its contribution goes beyond learned re-ranking in two respects: the problem it addresses and how it addresses it.

A new problem: relevant memories can be the wrong ones to use. Retrieval work usually asks whether a memory is relevant to the query. We study memories that are truthful and relevant yet inappropriate for the current request. Prior work documents the resulting failures as separate behaviors: cross-domain leakage, sycophancy, tool-call drift and memory-based jailbreaks. We trace them to a common cause, similarity-based memory search. Our zero-privilege threat model also covers both benign over-personalization and deliberate memory manipulation. Memory search thus becomes a trust decision about which memories may influence a request, rather than a relevance problem.

Standard learned re-ranking fails on this problem. Because these failures come from relevant memories, relevance-trained re-rankers tend to promote them. In Section 4.4, a learned scalar scorer with the same input, capacity, data and loss as MemGate reaches 11.6% cross-domain FR and 7.8% ASR, vs. 3.5% and 4.4% for MemGate.

The method's novelty is how the correction is parameterized and constrained. A query-conditioned mask acts on the memory embedding, and the identity mask recovers the base retriever exactly. The gate therefore learns only a correction to the retriever, trained with a retriever-relative objective (equivalent to DPO with the retriever as reference). A preservation term with a provable bound (Prop. 1) limits how far the scores of useful memories can move. The scalar scorer has neither this anchor nor this bound, which explains the gap above.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Discussion (0)

Sign in to comment.