Paper deep dive
HGP:An on-device personalized agent memory via hybrid graph storage
Ran Zhou, Xueming Han, Jiaheng Liu, Yuyao Zhang, Fanyu Meng, Junlan Feng, Yuxiang Ren
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 93%
Last extracted: 10/11/2026, 3:45:19 AM
Summary
The paper introduces HGP, a hybrid graph personalized memory framework for LLM-based agents designed for on-device deployment. HGP addresses challenges in routing and retrieving heterogeneous, multi-typed long-term traces by employing a lightweight self-enhancement classifier for memory routing and constructing episodic, semantic, procedural, and working memories as distinct graph structures. This approach improves personalization quality and decision reliability compared to single-vector baselines.
Entities (10)
Relation Signals (8)
HGP â evaluatedon â PAL-Set
confidence 95% · PAL-Set (Huang et al., 2025) evaluates memory-aware personalization
HGP â evaluatedon â LoCoMo
confidence 95% · We evaluate on two long-term memory benchmarks: LoCoMo
HGP â stores â Knowledge Graph
confidence 95% · semantic memory... is explicitly represented as a knowledge graph
HGP â stores â State Trajectory Graph
confidence 95% · working memory is implemented as a State Trajectory Graph
HGP â stores â Rule Tree
confidence 95% · procedural memory is structured as a Rule Tree
HGP â stores â Event Graph
confidence 95% · episodic memory is represented as an Event Graph
HGP â uses â Self-Enhancement Classifier
confidence 95% · HGP employs a lightweight self-enhancement classifier for personalized memory routing
HGP â achievesmetric â S-Score
confidence 90% · HGP achieves an S-score of 35.58
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:LLM-based agents face challenges in personalized interactive tasks due to heterogeneous, multi-typed, and implicitly constrained long-term traces. Existing memory mechanisms struggle with accurate routing and retrieval, especially on-device where personalization is critical. Most methods use single-vector representations, blurring type distinctions and relational structure. We propose HGP, a hybrid graph memory framework. HGP employs a lightweight self-enhancement classifier for personalized memory routing and constructs episodic, semantic, and procedural memories as graphs. It also extracts working memory as a state trajectory to capture current state and implicit constraints, ensuring reliable decision-making. The classifier reduces large-model calls, enabling on-device deployment, while graph storage enables accurate retrieval and incremental user profile refinement. Experiments on two benchmarks show that on PAL-Set solution selection, HGP achieves an S-score of 35.58, nearly 7 points above the strongest baseline. Code and data are at this https URL.
Tags
Links
- Source: https://arxiv.org/abs/2610.10071v1
- Canonical: https://arxiv.org/abs/2610.10071v1
Trouble viewing inline? Open PDF directly â
Full Text
72,244 characters extracted from source content.
Expand or collapse full text
HGP: An on-device personalized agent memory via hybrid graph storage Ran Zhou 1 , Xueming Han 2 , Jiaheng Liu 1 , Yuyao Zhang 2 , Fanyu Meng 2 , Junlan Feng 2 , Yuxiang Ren 1â 1 School of Intelligence Science and Technology, Nanjing University 2 Jiutian Research Correspondence: renyuxiang@nju.edu.cn Abstract LLM-based agents face challenges in person- alized interactive tasks due to heterogeneous, multi-typed, and implicitly constrained long- term traces. Existing memory mechanisms struggle with accurate routing and retrieval, especially on-device where personalization is critical. Most methods use single-vector repre- sentations, blurring type distinctions and re- lational structure. We propose HGP, a hy- brid graph memory framework. HGP employs a lightweight self-enhancement classifier for personalized memory routing and constructs episodic, semantic, and procedural memories as graphs. It also extracts working memory as a state trajectory to capture current state and implicit constraints, ensuring reliable decision- making. The classifier reduces large-model calls, enabling on-device deployment, while graph storage enables accurate retrieval and in- cremental user profile refinement. Experiments on two benchmarks show that on PAL-Set so- lution selection, HGP achieves an S-score of 35.58, nearly 7 points above the strongest base- line. Code and data are athttps://github. com/Ouan6/HGP-.git. 1 Introduction LLM(Large Language Models)-based agents are increasingly deployed in personalized interactive tasks, such as long-term conversational compan- ionship and constraint-aware task planning (Yao et al., 2023; Park et al., 2023). These applica- tions require the agent to access user-related in- formation across turns and generate responses that align with a specific userâs preferences and con- straints (Zhong et al., 2023; Packer et al., 2024). To compensate for limited context windows and unreli- able long-context recall, external memory modules have been widely adopted (Lewis et al., 2021; Zhao et al., 2024; Fan et al., 2024). Most agent memory â Corresponding author: Yuxiang Ren. systems adopt a unified memory pool, compress each memory item into a single-vector represen- tation, retrieve by semantic similarity, and then concatenate retrieved snippets to support genera- tion (Lewis et al., 2021; Zhong et al., 2023). How- ever, such flat memory designs often blur distinc- tions among memory types and relational structure, which are critical for personalized retrieval and de- cision making. Robust personalization demands continuously summarizing interaction experience, distilling user preferences and behavioral habits, and reliably activating such signals in subsequent decisions. These capabilities are essential for main- taining consistent user-specific behavior over long interactions (Park et al., 2023; Liu et al., 2023). Moreover, a critical but underexplored bottleneck is personalized memory routing: dynamically as- signing incoming interaction traces to the appro- priate memory type. In practice, histories contain heterogeneous signals (events, profiles, strategies, and actionable states) (Atkinson and Shiffrin, 1968; Tulving, 1972; Baddeley and Hitch, 1974; Squire, 1992), and inaccurate routing stores information in the wrong memory type, causing cascading re- trieval errors (Xu et al., 2025). Personalized memory framework is needed. We argue that achieving personalization requires a memory system with two key properties: (a) en- abling personalized memory routing with low su- pervision cost; and (b) explicitly modeling hetero- geneous memory types and their relations. First, personalized routing is important because memory distributions vary across users, making it difficult to rely solely on a fixed general-purpose classifier. Given the cost of repeatedly invoking LLMs during online interaction, especially in on-device contexts, a lightweight routing mechanism that amortizes supervisory cost over time becomes essential. In our setting, on-device operation refers to latency- critical online routing and retrieval on a local de- arXiv:2610.10071v1 [cs.AI] 7 Oct 2026 vice, while graph construction and classifier up- dates are performed asynchronously. Second, an explicit modeling of memory heterogeneity is re- quired: heterogeneous memory types must not be collapsed into a uniform vector space, but should instead retain their distinct attributes and interrela- tions through structured representations to facilitate retrieval. Presented work. To address these challenges, we propose HGP, a Hybrid Graph Personalized mem- ory framework. Our main contributions are sum- marized as follows: âąFramework design. We develop a framework that moves beyond single-vector compression by organizing episodic, semantic, and procedural memories with type-specific graph structures, in- cluding event graphs, knowledge graphs, and rule trees. This is augmented by dynamic work- ing memory-state trajectory graphs that capture and preserve implicit contextual constraints. âąSelf-Enhancement Classifier.We propose a confidence-based LLM-assisted annotation policy for personalized memory routing.A lightweight classifier progressively takes over routing decisions, adapts to user-specific mem- ory distributions, and substantially reduces su- pervision cost by recycling low-confidence LLM annotations as training data. âąEmpirical validation. We evaluate HGP on LoCoMo (Maharana et al., 2024) and PAL- Set (Huang et al., 2025), demonstrating consis- tent improvements in personalization quality and decision reliability over strong baselines. We also provide a thorough analysis of how work- ing memory improves robustness under implicit constraints. 2 Related Work 2.1 Long-context Modeling and Retrieval-Augmented Memory. One research direction improves model capac- ity by extending context windows and devel- oping memory-optimized attention mechanisms, thereby enabling training and inference over sig- nificantly longer sequences. Representative ap- proaches include sparse-attention models such as Longformer (Beltagy et al., 2020) and BigBird (Za- heer et al., 2021), as well as I/O-efficient exact attention methods like FlashAttention (Dao et al., 2022). Key innovations in positional encoding and length extrapolation, such as RoPE, ALiBi, and their derivatives (Su et al., 2023; Press et al., 2022; Ding et al., 2024), have driven increases in the ef- fective context window of LLM. Representing a complementary strategy to long-context modeling, retrieval augmentation enhances LLMs by coupling them with an external knowledge store, as exempli- fied by RAG (Lewis et al., 2021), REALM (Guu et al., 2020), and RETRO (Borgeaud et al., 2022). However, increased context capacity does not guar- antee effective information utilization. This limita- tion is evidenced by findings such as âLost in the Middleâ (Liu et al., 2023), which demonstrate that models often access salient information unevenly within long contexts. More critically, even with unbounded context length, both long-context mod- eling and retrieval augmentation lack the requisite mechanisms for continuously capturing and struc- turing user-specific interaction patterns, which are essential for genuine personalization. 2.2 Graph-structured memory. Recent memory frameworks are increasingly adopt- ing graph-based representations, driven by the promise of explicit relational reasoning (Sun et al., 2025; Li et al., 2025a). Moving beyond flat similar- ity search over text chunks, graph-structured mem- ory enables more structured storage and retrieval through explicit modeling of relations among mem- ory units. GraphRAG-style systems (Han et al., 2025; Zhang et al., 2024b,a) index knowledge as graphs and retrieve query-relevant subgraphs to support multi-hop evidence aggregation. Represen- tative approaches include graph-traversal-based re- trieval, such as HippoRAG (GutiĂ©rrez et al., 2025), and hierarchical indexing with structure-aware re- trieval, exemplified by LeanRAG (Zhang et al., 2025b) and HiRAG (Jiao et al., 2025). Graph- structured memory has also been explored in agen- tic settings, including G-Memory (Zhang et al., 2025a), G-Refer (Li et al., 2025b), and the concur- rent PlugMem (Yang et al., 2026), which organizes agent experiences into structured memory graphs for efficient retrieval. These works are closely re- lated to HGP in moving beyond raw trajectory re- trieval and flat memory storage. However, most of them mainly focus on structure-aware retrieval or task-agnostic agent memory, while HGP focuses on personalized agent memory where heterogeneous user traces must be routed into distinct memory types and stored with type-specific graph structures for later personalized retrieval and decision mak- ing. 2.3 Agent memory system. Memory is a core capability of LLM-based agents. Early systems mainly rely on passive retrieve-and- inject mechanisms such as retrieval-augmented gen- eration (RAG) (Lewis et al., 2021), while agent frameworks like ReAct (Yao et al., 2023) and Tool- former (Schick et al., 2023) treat memory as an im- plicit or short-term component. To support person- alization and long-term consistency, recent work increasingly incorporates cross-session memory. MemoryBank (Zhong et al., 2023) continuously updates persistent user profiles; MemGPT (Packer et al., 2024) introduces a memory hierarchy be- tween the context window and external storage; Generative Agents (Park et al., 2023) and Memo- ryOS (Kang et al., 2025) further explore structured memory storage and lifecycle management. Typed memory has also been discussed in cognitive agent architectures. For example, CoALA (Sumers et al., 2024) formalizes language agents with multiple memory components, including working, episodic, semantic, and procedural memories. Production- oriented systems like Mem0 (Chhikara et al., 2025) and A-MEM (Xu et al., 2025) target scalable mem- ory pipelines, while recent work ScrapMem (Chang and Ren, 2026) further considers storage-efficient personalized memory on edge devices. These works motivate persistent and cognitively inspired agent memory, whereas HGP studies how user traces can be routed into heterogeneous memory types and stored with type-specific graph structures for personalization. Our self-enhanced router is related to cost-aware model routing and deferral methods, such as FrugalGPT (Chen et al., 2023) and RouteLLM (Ong et al., 2025). Unlike these methods, which route inputs across models, HGP routes memory writes into different memory stores; only low-confidence traces invoke LLM annotation, which is then cached for incremental classifier up- dates. 3 Methodology In this work, we propose HGP, a hybrid graph memory framework for user personalization. As illustrated in Figure 1, HGP comprises two core components: (1) a self-enhancement classifier; (2) a hybrid graph-based storage. 3.1 Personalized Memory Routing In cross-user scenarios, individual differences in memory-type signals cause substantial distribution shifts, making a general classifier prone to misrout- ing. To address this, HGP employs a confidence- based, LLM-assisted annotation mechanism that continuously refines the router and amortizes su- pervision cost. For an input segmentx, the router first predicts a labelËc Ξ (x)with confidence score s(x). The final routing decision is governed by an iteration-adaptive threshold Ï t : c(x) = ( Ëc LLM (x), s(x) < Ï t , Ëc Ξ (x), s(x)â„ Ï t , (1) whereËc LLM (x)denotes the label from the LLM- based router, andÏ t is the confidence threshold at iterationt. Ifs(x) â„ Ï t , the predicted label Ëc Ξ (x)is retained for downstream memory construc- tion. Otherwise, the segment is deferred to the LLM for annotation, and the resulting labeled pair (x, Ëc LLM (x))is cached into an incremental training pool. Periodically, the classifier is updated on the accumulated pool. We initialize the router conser- vatively (LLM-dominant) and gradually shift the workload to the classifier via exponential anneal- ing: Ï t = max Ï min ,Ï 0 · e âÎČt .(2) where a high initial threshold Ï 0 encourages defer- ral, a decay rateÎČenables a smooth transition, and a lower boundÏ min prevents overly aggressive self- labeling. As the data pool grows with user-specific samples, the classifierâs decision boundary progres- sively adapts to the current domain and user pat- terns, effectively mitigating cross-user distribution shifts. This continuous adaptation sustains long- term personalization, which is especially critical as user behaviors evolve and memory distributions drift over time. 3.2 Hybrid Graph Storage To preserve heterogeneous memory types and their relations, HGP adopts a hybrid graph storage de- sign. We detail each memory structure below. 3.2.1 Episodic Memory â Event Graph Episodic memory stores situated interaction events experienced, preserving traceable trajectories, tem- poral order, and contextual dependencies. In HGP, episodic memory is represented as an Event Graph. Formally, the event graph is modeled as G epi = (V e âȘ V ent ,E epi ),(3) Hybrid Graph Memory Storage (c) Procedural IF .......(health task) THENTHEN IF .......IF....... check ... THEN Storage: If-Then Rule Tree Directed sequences / tree structures facilitate storing operational workflows such as stepâ â stepâ â ..., enabling the structuring and reusable storage of rules, strategies, and similar elements. (e) Fragmented - Snippets " Thank you. " "Sorry..." "What??" "Forget it, just this once..." " That place from last timeâ you know where I mean." " @HR: ??? bpm, " "gsdyukfgu.." (a) Episodic Last weekYesterdayToday Event:....Event:...Event:.... Storage: Event-Graph An event-centric directed graph representing relationships such as "personâtimeâlocationâevent." This facilitates tracing and retrieving user experiences by timeline, individual, or location. (b) Semantic Preference:....... ....... Allergy: ... Chronic disease: ......... Gene risk:......... Storage: Knowledge Graph Entity nodes (people, places, concepts, etc.) + semantic relationship edges, with optional metadata. Facilitates storing long-term stable memories (preferences, habits, etc.). (d) Working Event 3Event 2Event 1 S1 S2 S1 S2 S1 S2 Storage: State trajectory graph Event nodes represent specific events, while state nodes record the executed state of the event. State trajectory graph create a state trajectory for each event to track its state. Refined memory type labels Unclear / noisy snippets Query LLM-Labelled Samples Buffer Self-Enhancement Confidence Gate Memory-type LLM Low-confidence-> LLM judge Continual fine-tuning "I'm allergic to aspirin, have hypertension and an old knee injury." Predicted: Semantic (conf.=0.94) Multi-label Memory Classifier E / S /P / F âLast night my smartwatch showed heart rate 220 bpm while I felt totally fne,maybe the strap was loose?" Low confidence, type unclear High-confidence-> Direct storage LLM-labelled samples Memory Type Classifier (LLM in the loop) Tokenized memory snippets Symbols episodic ES semantic P procedural W workingfragmented Retrieval / traversallow conf ----> high confForward process F Figure 1: Overview of our HGP framework with two components: (1) a self-enhancement classifier that routes inputs via a classifier/LLM and incrementally updates the classifier using high-confidence samples, and (2) hybrid graph storage that preserves structural properties of heterogeneous memory types. whereV e is the set of atomic episode nodes,V ent de- notes contextual entity nodes, andE epi represents typed edges encoding eventâevent and eventâentity relations. In the event graph, episode nodes serve as struc- tural anchors, connected to other episodes or con- textual entities via semantically typed edges. These edges capture structured dependencies between events, such as temporal order, contextual asso- ciation, and other semantic relations. Each edge is defined as e ij = (v i ,v j ,r), r âtemporal, contextual,..., (4) whererspecifies the semantic role of the relation between two nodes. Unlike isolated record storage, the event graph links events through shared entities, preserving structured relationships and contextual continuity. As a core component of the hybrid graph storage, the event graph further supports structure-aware re- trieval and long-term evolution. As event graphs accumulate, recurring relational patterns and sub- structures can be abstracted as: K =A abs G (1) epi ,...,G (n) epi ),(5) whereAabs(·)denotes a structure abstraction op- erator instantiated via LLM. Through this process, episodic memory functions not only as a reposi- tory of past experiences but also as a structural foundation for deriving higher-level semantic and procedural knowledge. 3.2.2 Semantic Memory â Knowledge Graph Semantic memory captures long-term, decontextu- alized knowledge such as facts, relations, and user preferences, supporting consistent personalized be- havior. In HGP, it is explicitly represented as a knowledge graph: G sem = (V sem ,E sem ),(6) whereV sem denotes semantic nodes encoding user- centric long-term knowledge, andE sem represents typed semantic relations among them. Each semantic relation is represented as a triple: (u,r,v), uâ V user , v â V ent , r âR sem , (7) where r is a predicate drawn from a predefined se- mantic relations (e.g., HAS_SKILL, PREFERS, WORKS_AS). Unlike episodic memory, which captures tem- porally grounded experience fragments, seman- tic memory focuses on regularities that general- ize across interaction contexts. It can be obtained either directly via the self-enhancement classifier or through semantic abstraction over accumulated episodic event graphs: G sem =A sem G (1) epi ,...,G (n) epi .(8) The detailed design and prompt templates ofA sem are provided in Appendix D.1. 3.2.3 Procedural Memory â Rule Tree Graph Procedural memory stores reusable, experience- driven behavioral strategies and decision flows, en- hancing long-term planning capability. In HGP, procedural memory is structured as a Rule Tree, where nodes represent conditions, actions, or inter- mediate goals, and edges encode their dependen- cies. Formally, it is defined as G proc = (V c âȘ V a âȘ V g ,E proc ),(9) whereV c ,V a ,V g denote condition, action, and sub- goal nodes, respectively, andE proc represents the set of edges encoding control or dependency rela- tions among these nodes. Procedural memory is sourced directly from the self-enhancement classifier or extracted from episodic event graphs. In the latter case, it is con- structed via G proc =A proc G (1) epi ,...,G (n) epi ),(10) whereA proc (·)is a procedural-abstraction opera- tor instantiated with an LLM. The detailed design and prompt template ofA proc are provided in Ap- pendix D.2. 3.2.4 Working Memory â State Trajectory Graph Working memory maintains the states of ongoing interactions or tasks, supplying state information for reasoning and decision-making. In HGP, it is implemented as a State Trajectory Graph, where nodes represent current system or user states and edges encode state transitions. Formally, working memory is defined as G wm = (V state ,E state ),(11) whereV state represents the current states andE state denotes transitions between states. Unlike episodic and semantic memory, which re- tain long-term information, working memory main- tains short-lived, dynamic context extracted from recent episodic memory and continuously updated during interaction. Its update process can be ex- pressed as G (t+1) wm =U G (t) wm ,G (t) epi ,(12) whereU (·)denotes a state update operator. Graph- based modeling of working memory provides an explicit representation of the current state and its evolution, enabling timely reasoning, strategy se- lection, and action triggering. 3.2.5 Query Retrieval Workflow Upon receiving a user queryq, HGP executes a structured retrieval protocol over its hybrid graph memoryG =G epi ,G sem ,G proc ,G wm . A detailed example of this retrieval workflow is provided in Appendix B. For the queryq, HGP issues parallel queries to each subgraph, each designed to retrieve a particular type of structured evidence: âą Episodic graphG epi : Retrieves a set of tem- porally or contextually related past interaction nodes. For instance, in a health management sce- nario, a query about âevening exercise planningâ may retrieve nodes representing ânight run with elevated heart rateâ and âprevious over-exertion alertâ, connected via shared activity and time entities. âąSemantic graphG sem : Retrieves a subgraph of factual triples about the user that are semantically relevant toq. Examples include (User, allergy, Ibuprofen) and (User, condition, Hypertension), providing stable profile constraints. âą Procedural graphG proc : Retrieves applicable rule nodes that match the current context. For example, the rule âIf NSAID combines with as- pirinâcheck bleeding riskâ is retrieved when the query involves taking painkillers after aspirin intake. âą Working memory graphG wm : Retrieves the current state trajectory, capturing immediate ses- sion constraints such as âaspirin already taken this morningâ and âpending dinner recommen- dation taskâ. The retrieved subgraphs are merged into a unified context and passed, together with the original query q, to the LLM. The model then generates a response grounded in both long-term memory and the userâs current state and implicit constraints, ensuring co- herence, personalization, and safety. 4 Experiments 4.1 Experimental Setup Datasets. We evaluate on two long-term memory benchmarks: LoCoMo (Maharana et al., 2024) pro- vides 10 multi-session conversations withâŒ200 QA pairs each, covering single-hop, multi-hop, temporal, and open-domain questions. Follow- ing Mem0 (Chhikara et al., 2025), we exclude the adversarial category due to missing ground-truth answers. PAL-Set (Huang et al., 2025) evaluates memory-aware personalization via user logs and Table 1: Unified evaluation results on LoCoMo (%). Evaluation metrics are reported for each category and overall, including F1 score (F1), BLEU-1 (B1), Exact Match score (EM) and LLM-as-a-Judge score (J), with higher values indicating better performance. Best results are in bold, and second-best results areunderlined. Method Single-hopMulti-hopTemporalOpen-domainOverall JF1B1EMJF1B1EMJF1B1EMJF1B1EMJF1B1EM TurnRAG47.52 34.31 28.43 6.0338.54 20.33 16.606.2560.44 51.71 47.86 19.9465.28 48.34 43.76 24.9759.35 44.73 40.11 19.29 LangMem53.55 32.78 26.35 3.9041.67 22.97 19.99 10.4217.76 10.238.673.7454.22 34.30 30.64 14.1045.65 24.74 21.498.46 MemoryBank47.87 19.26 24.29 3.5537.50 10.89 15.007.2926.176.637.514.0572.65 40.97 44.37 26.2756.12 39.83 35.03 16.22 A-Mem51.42 20.43 25.29 4.9644.79 13.60 17.007.2959.19 35.21 38.63 19.3167.59 38.42 41.09 24.8261.41 32.87 36.15 18.90 HippoRAG252.84 21.16 27.69 4.6140.62 13.25 17.088.3360.75 38.00 41.75 19.9468.31 39.75 42.84 26.3962.13 34.29 38.20 19.88 Mem052.13 35.18 26.15 5.6738.54 28.95 22.85 13.5459.81 52.71 39.70 19.3166.39 47.98 40.81 26.1460.63 45.42 36.75 20.14 Ours56.0334.44 30.39 5.6746.8827.69 23.7012.5060.7550.3146.2419.6371.45 51.33 46.59 26.8765.0845.07 42.09 20.54 interaction histories. We focus on the Solution Pro- posal tasks: (1)QA: memory-grounded answer gen- eration; (2)Selection: selecting the best response from candidates based on retrieved memories. Metrics. On LoCoMo, we report F1, Exact Match (EM), BLEU-1 (B1), and supplement with Mem0- style LLM-as-a-judge(J) to overcome the limits of lexical overlap in long-context reasoning. On PAL- Set, for the QA subtask, we use BLEU-1/2/3/4 as automatic metrics and report an LLM-as-a-judge score as a complementary assessment of answer correctness and usefulness. For comparability, the same judging protocol is applied to both memory- based and non-memory systems. For Selection, we use the benchmark-defined S-score, which mea- sures how well the selected solution matches the userâs needs. The LLM-as-a-judge score is treated as supplementary evidence rather than the sole eval- uation criterion; our conclusions are based jointly on automatic QA metrics, the PAL-Set S-score, ablation results, and long-horizon memory eval- uation. Full QA judge prompts are provided in Appendix A.1. Baselines. We compare against two paradigms: (1)Non-memory methods. On LoCoMo, we use a standard RAG pipeline. On PAL-Set, fol- lowing the official benchmark, we include four retrieval-based variants with different context granularities: Vanilla (w/o log) (no history), Vanilla (with log) (logs concatenated into the prompt), Turn-level RAG, and Session-level RAG. (2)Memory-based frameworks. We compare with representative memory-augmented sys- tems: Mem0 (Chhikara et al., 2025), Memory- Bank (Zhong et al., 2023), A-Mem (Xu et al., 2025), HippoRAG2 (GutiĂ©rrez et al., 2025), and additionally LangMem on LoCoMo. Implementation Details. In HGP, memory routing is performed by a lightweight BERT-based classi- fier (roberta_L-4_H-512). The confidence thresh- old is initialized atÏ 0 = 0.90, annealed with rate ÎČ = 0.05, and lower-bounded byÏ min = 0.50. Since working-memory annotations are not avail- able in LoCoMo or PAL-Set, our experiments focus on episodic, semantic, and procedural memories, stored as Neo4j graph databases. Memory extrac- tion usesdeepseek-chat; response generation and LLM-as-a-judge usegpt-4o-mini(temperature 0.0). On LoCoMo, max output length is 100 to- kens; dialogue history for TurnRAG is truncated to 4K tokens; retrieval-based methods useK = 30 items. All methods share the same answer/judge prompts adapted from Mem0 for fairness. On PAL- Set, we follow the official setup withK = 3and introduce an additional QA-specific judge prompt for semantic correctness beyond lexical overlap. 4.2 Main Results LoCoMo performance. Experiments on the Lo- CoMo dataset demonstrate the strong memory re- call capability of HGP. As shown in Table 1, HGP achieves the best overall performance in Judge (65.08), BLEU-1 (42.09), and EM (20.54), while maintaining competitive F1 (45.07)âoutperform- ing Mem0 by +4.45 (Judge) and +5.34 (BLEU-1). Gains are most pronounced on Open-domain tasks, where HGP attains the highest F1 (51.33), BLEU- 1 (46.59), and EM (26.87). This improvement supports the effectiveness of graph-based memory storage: structuring episodic events, semantic pro- files, and procedural rules as interconnected graphs provides more reliable evidence for diverse, un- constrained questions. Temporal questions remain comparatively challenging, suggesting opportuni- ties for enhancing temporal ordering. PAL-Set Solution Proposal tasks. Table 2 reports Table 2: Performance comparison across different methods on PAL-Set Solution QA tasks. B-1 to B-4 represent BLEU scores.â(vs. Vanilla w/o log) reports the absolute improvement in S-score compared to the Vanilla (w/o log) baseline. LLM-judge denotes the score evaluated by GPT-4o-mini. GroupMethodB-1B-2B-3B-4QA JudgeS-scoreâ (vs. Vanilla w/o log) Non-memory Vanilla (w/o log) 19.687.723.802.117.3120.34+0.00 Vanilla (with log)18.967.513.822.227.3225.00+4.66 Turn-level RAG 19.487.723.932.237.4125.06+4.72 Session-level RAG19.177.553.822.227.3025.24+4.90 Memory-based MemoryBank 20.837.364.232.567.1328.85+8.51 Mem019.207.663.822.127.3426.50+6.16 A-Mem19.338.123.962.177.0427.27+6.93 HippoRAG218.848.064.302.347.3129.22+8.88 HGP (Ours)19.628.674.702.787.4635.58+15.24 assistant (ours):Before you prepare dinner, I noticed you have an uncompleted task in your health app: you haven't taken your pre-dinner medication yet. I recommend completing this task first to ensure your health and safety. After taking your medication, regarding dinner recommendations, considering the stomach discomfort you mentioned earlier, I suggest avoiding apicy food and eating light, easily digestible foods such as: 1. Clear broth noodles: Opt for soft noodles in a light brothâgentle and easy on the stomach. - Chicken congee: Cooked with chicken and rice, it provides nourishment without burdening your stomach. - Steamed fish: Choose lightly steamed varietiesâlow in fat yet rich in protein to aid nutrient absorption. Hope these suggestions help you enjoy a pleasant dinner! User Profile Core Health Issue: Abdominal discomfort â Acute gastritis â Gastroscopy confirmed "chronic superficial gastritis with erosion" Medication and Management Approach Medication: Omeprazole + Domperidone â Adjusted to Omeprazole + Magnesium Aluminum Carbonate (14-day course) Daily To-Do List: Take medication 30 minutes before meals Preferences and Restrictions Shifted from trigger foods (spicy + ice-cold beer) to light, easily digestible meals Historical dietary preferences: congee/millet porridge, steamed egg custard, steamed fish, soft noodles Continue avoiding: spicy, greasy, alcoholic, and highly stimulating foods Long-Term Goals Develop a sustainable healthy diet and lifestyle plan post-recovery, adhering to recommendations for "1 month of light diet + regular health checkups" assistant (Mem0):Considering your recent stomach condition and eating habits, it is recommended that you choose some light and easily digestible dinners. Here are several dinner recommendations suitable for you: 1. Steamed Fish : You can choose some low-fat fish, steam them and add a little shredded ginger and scallions. It's both delicious and easy to digest. 2. Rice Porridge : Continue to choose millet porridge or white rice porridge. You can add some vegetables according to your personal taste, such as shredded carrots or spinach, to increase nutrition. 3. Steamed Egg Custard : Egg custard is rich in protein and has a soft texture, making it very suitable for patients with gastritis. Please try to avoid spicy and greasy foods and keep a light diet, which is helpful for the recovery of your stomach. If you feel comfortable after eating, you can also record it to help you adjust your diet later. Hope you have a pleasant dinner! assistant(none):Of course! Dinner choices can be tailored to your taste preferences, dietary habits, and nutritional needs. Here are several healthy and delicious dinner recommendations: 1. Steamed Fish with Vegetables: Choose sea bass or salmon, steamed and served with broccoli, carrots, and green peas. This dish is rich in protein and packed with vitamins. 2. Chicken Salad: Combine grilled chicken breast with mixed greens, cherry tomatoes, cucumber, and avocado. Drizzle with olive oil and lemon juice for a light yet nutritious meal. 3. Vegetarian Pasta: Use whole-wheat pasta tossed with tomatoes, spinach, garlic, and olive oil. Simple to prepare and nutritionally balanced. user: I'm getting ready to eat dinner. Any good dinner recommendations? Figure 2: Working Memory Analysis: working-memory state tracking in a personal healthcare scenario. Yellow highlights denote pending to-do reminders, and blue highlights indicate preference-aligned personalized suggestions. Compared with baselines, our method surfaces the working-memory state (pre-meal medication: pending) and reminds the user while providing personalized dinner recommendations. results on Solution QA and Selection. On QA, HGP achieves the highest LLM-judge score (7.46) and the best BLEU-2/3/4 (8.67/4.70/2.78), indicat- ing stronger multi-step coherence. On Selection, non-memory baselines improve only marginally over Vanilla (w/o log) (+4.66to+4.90), confirm- ing that raw log retrieval is insufficient. HGP at- tains an S-score of 35.58, surpassing Vanilla (w/o log) (20.34) by+15.24and the top memory base- line HippoRAG2 (29.22) by+6.36. These results show that graph-structured memory enables more precise personalized retrieval, better aligning re- sponses with user-specific needs. Table 3: Ablation study on memory components and representation designs. The table reports generation quality (BLEU and LLM-judge) and selection perfor- mance (S-score). Higher is better. MethodB-1B-2B-3B-4LLM-judgeS-score Unified-vector18.157.243.602.057.1825.15 Typed-vector 18.617.513.742.097.2933.66 w/o E-Mem19.537.963.962.237.0928.83 w/o S-Mem19.698.304.382.577.2325.71 w/o P-Mem19.598.634.662.767.3133.10 Full (Ours)19.628.674.702.787.4635.58 4.3 Ablation Study To quantify the contribution of each memory com- ponent, We ablate each memory type while keep- ing the rest of the pipeline unchanged (Table 3). Graph and type structure. Unified-vector col- lapses all memories into a single vector space, while Typed-vector preserves memory types but re- moves graph structure. Typed-vector substantially improves over Unified-vector on Selection (33.66 vs. 25.15), showing that memory typing is impor- tant for personalized decision making. Full HGP further improves the S-score to 35.58, indicating that type-specific graph storage provides additional gains beyond typed vector retrieval. Episodic Memory(E-Mem). Removing episodic memory causes the largest drop on Solution QA: BLEU-1/2/3/4 fall from 19.66/8.67/4.70/2.78 to 19.53/7.96/3.96/2.23, and the LLM-judge score de- clines from 7.46 to 7.09. On Selection, the S-score drops from 35.58 to 28.83 (â = â6.75). These results confirm that episodic memory, as the foun- dational trace of user interactions, is essential for both precise answer generation and context-aware solution matching. Semantic Memory(S-Mem). Removing seman- tic memory causes the largest drop on Selection (â =â9.87,S-score; Table 3), confirming that sta- ble user profiles (long-term preferences, attributes, health facts) are essential for personalized decision- making. On Solution QA, the LLM-judge score also declines (7.46 to 7.23), indicating its contri- bution to coherent memory recall beyond pure re- trieval. Procedural Memory(P-Mem). Removing proce- dural memory causes a modest but non-negligible drop in Selection (â = â2.48), while the impact on Solution QA is minor (judge score7.46â 7.31, BLEU-42.78 â 2.76). This aligns with its role as high-level strategic guidance rather than direct factual evidence. Overall, Table 3 highlights complementary roles: semantic graphs drive personalized selection, episodic graphs supply fine-grained event evidence for QA, and procedural graphs enhance strategy reuse. Integrating all components yields the best performance, validating our hybrid graph memory design. 4.4 Working Memory Analysis Figure 2 illustrates the role of working memory in HGP using a healthcare scenario. Working mem- ory explicitly extracts and maintains the current actionable state, enabling the agent to prioritize 0246810 Iteration 0.0 0.2 0.4 0.6 0.8 1.0 Routing ratio (a) Routing ratio and threshold 01234567891011 Iteration 0 500 1000 1500 Cumulative samples (b) Cumulative Count Statistics 0.5 0.6 0.7 0.8 0.9 Confidence threshold LLM ratio Classifier ratio Threshold Cumulative LLM calls Cumulative classifier handled Figure 3: Classifier routing statistics across iterations. (a) Routing mix and adaptive threshold. (b) Cumulative workload handled by the LLM and the classifier. immediate actions during response generation. Setup. We compare three systems: (i) a vanilla LLM without memory, (i) an LLM augmented with Mem0, and (i) HGP with working memory enabled. The dialog history contains a pre-meal medication reminder. The user query asks for din- ner recommendations without explicitly mention- ing medication. Observation.The vanilla LLM directly sug- gests dinner options. Mem0 generates preference- aligned recommendations but fails to remind the user about the medication. In contrast, HGP re- trieves the state âpre-meal medication: unfinishedâ from the working memory graph and injects it into the prompt, enabling the LLM to proactively issue a medication reminder before dinner and demon- strating state awareness under implicit constraints. (Further details in Appendix C.) Table 4 compares our self-enhancement clas- sifier with an offline classifier, a fixed LLM router, and a zero-shot LLM router. Our classi- fier achieves the highest macro-F1 (0.9339) and micro-F1 (0.9105) with an average latency of 4.98 ms, roughly 360Ă faster than the fixed LLM router. Fig. 3 shows the training dynamics: the confidence- based gating progressively shifts routing decisions from the LLM to the classifier, and incremental training every 200 samples drives the system from LLM-dominant to classifier-dominant (Fig. 3a). Overall, LLM calls drop from 2400 to 807 (a 66.4% reduction), confirming the workload transfer visi- ble in the cumulative curves (Fig. 3b). These results demonstrate that the classifier effectively captures LLM routing knowledge while substantially lower- ing inference costs for on-device deployment. Hy- perparameter sensitivity and per-stage performance are detailed in Appendix A.2. Table 4:Performance comparison of the self- enhancement classifier against other baselines. Best re- sults are in bold, and second-best results areunderlined. RouterMicro-F1Macro-F1Avg Latency (ms) Offline Classifier0.86380.87904.06 Fixed LLM Router0.89530.92241803.69 Zero-shot LLM Router0.82860.84361572.64 Ours0.91050.93394.98 5 Conclusion In this paper, we address the key challenge of achieving robust and adaptive personalization in LLM-based agents under cross-user heterogeneity and distribution shift. To this end, we propose HGP, a memory-augmented framework that integrates a self-enhancement routing mechanism with a hy- brid graph-based memory storage, enabling cost- efficient and structured personalization. Extensive experiments on LoCoMo and PAL-Set validate the effectiveness of HGP in improving memory-recall accuracy and personalization capability, while rout- ing statistics confirm its ability to amortize super- vision cost over time. Future work will explore finer-grained modeling of memory graphs, incor- porate cross-memory consistency constraints, and extend the framework to a broader range of interac- tive tasks and tool-augmented agents. 6 Limitations While HGP demonstrates improvements in person- alized memory management, several limitations remain. First, although working memory shows promising qualitative results, existing benchmarks lack explicit working-memory annotations, prevent- ing systematic quantitative evaluation. Construct- ing datasets with ground-truth state trajectories is an important direction for rigorous assessment. Second, graph construction and maintenance in- troduce additional offline computation and storage costs, while our on-device claim primarily con- cerns latency-critical online routing and retrieval. A more complete end-to-end cost analysis remains for future work. In addition, this work focuses mainly on graph storage, while finer-grained re- trieval and pruning mechanisms require further study. Finally, we use LLM-as-a-judge evaluation to complement lexical-overlap metrics. Although standardized prompts and temperature 0.0 improve evaluation consistency, LLM judges may still ex- hibit biases, and their reliability warrants continued attention. Acknowledgments This work was supported by the Nanjing University-China Mobile Joint Research Institute. References Richard C Atkinson and Richard M Shiffrin. 1968. Hu- man memory: A proposed system and its control processes. In Kenneth W Spence and Janet Taylor Spence, editors, The Psychology of Learning and Motivation: Advances in Research and Theory, vol- ume 2, pages 89â195. Academic Press, New York. Alan D Baddeley and Graham J Hitch. 1974. Working memory. In Gordon H Bower, editor, The Psychology of Learning and Motivation: Advances in Research and Theory, volume 8, pages 47â89. Academic Press, New York. Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. Preprint, arXiv:2004.05150. Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, Diego de Las Casas, Aure- lia Guy, Jacob Menick, Roman Ring, Tom Henni- gan, Saffron Huang, Loren Maggiore, Chris Jones, Albin Cassirer, and 9 others. 2022. Improving lan- guage models by retrieving from trillions of tokens. Preprint, arXiv:2112.04426. Jiale Chang and Yuxiang Ren. 2026.Scrapmem: A bio-inspired framework for on-device personal- ized agent memory via optical forgetting. Preprint, arXiv:2605.03804. Lingjiao Chen, Matei Zaharia, and James Zou. 2023. Frugalgpt: How to use large language models while reducing cost and improving performance. Preprint, arXiv:2305.05176. Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav. 2025. Mem0: Building production-ready ai agents with scalable long-term memory. Preprint, arXiv:2504.19413. Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher RĂ©. 2022. Flashattention: Fast and memory-efficient exact attention with io-awareness. Preprint, arXiv:2205.14135. Yiran Ding, Li Lyna Zhang, Chengruidong Zhang, Yuanyuan Xu, Ning Shang, Jiahang Xu, Fan Yang, and Mao Yang. 2024. Longrope: Extending llm context window beyond 2 million tokens. Preprint, arXiv:2402.13753. Wenqi Fan, Yujuan Ding, Liangbo Ning, Shijie Wang, Hengyun Li, Dawei Yin, Tat-Seng Chua, and Qing Li. 2024. A survey on rag meeting llms: Towards retrieval-augmented large language models. Preprint, arXiv:2405.06211. Bernal JimĂ©nez GutiĂ©rrez, Yiheng Shu, Yu Gu, Michi- hiro Yasunaga, and Yu Su. 2025. Hipporag: Neu- robiologically inspired long-term memory for large language models. Preprint, arXiv:2405.14831. Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasu- pat, and Ming-Wei Chang. 2020. Realm: Retrieval- augmented language model pre-training. Preprint, arXiv:2002.08909. Haoyu Han, Yu Wang, Harry Shomer, Kai Guo, Ji- ayuan Ding, Yongjia Lei, Mahantesh Halappanavar, Ryan A. Rossi, Subhabrata Mukherjee, Xianfeng Tang, Qi He, Zhigang Hua, Bo Long, Tong Zhao, Neil Shah, Amin Javari, Yinglong Xia, and Jiliang Tang. 2025. Retrieval-augmented generation with graphs (graphrag). Preprint, arXiv:2501.00309. Zhaopei Huang, Qifeng Dai, Guozheng Wu, Xiaopeng Wu, Kehan Chen, Chuan Yu, Xubin Li, Tiezheng Ge, Wenxuan Wang, and Qin Jin. 2025. Mem-pal: Towards memory-based personalized dialogue assis- tants for long-term user-agent interaction. Preprint, arXiv:2511.13410. YiHan Jiao, ZheHao Tan, Dan Yang, DuoLin Sun, Jie Feng, Yue Shen, Jian Wang, and Peng Wei. 2025. Hi- rag: Hierarchical-thought instruction-tuning retrieval- augmented generation. Preprint, arXiv:2507.05714. Jiazheng Kang, Mingming Ji, Zhe Zhao, and Ting Bai. 2025.Memory os of ai agent.Preprint, arXiv:2506.06326. Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Hein- rich KĂŒttler, Mike Lewis, Wen tau Yih, Tim Rock- tĂ€schel, Sebastian Riedel, and Douwe Kiela. 2021. Retrieval-augmented generation for knowledge- intensive nlp tasks. Preprint, arXiv:2005.11401. Yuhan Li, Yuyao Wang, Jianheng Tang, Heng Chang, Yuxiang Ren, and Jia Li. 2025a. Advancing graph foundation models: A data-centric perspective. KDD â25, page 1635â1646, New York, NY, USA. Associa- tion for Computing Machinery. Yuhan Li, Xinni Zhang, Linhao Luo, Heng Chang, Yuxiang Ren, Irwin King, and Jia Li. 2025b. G- refer: Graph retrieval-augmented large language model for explainable recommendation. Preprint, arXiv:2502.12586. Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paran- jape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. 2023. Lost in the middle: How language mod- els use long contexts. Preprint, arXiv:2307.03172. Adyasha Maharana, Dong-Ho Lee, Sergey Tulyakov, Mohit Bansal, Francesco Barbieri, and Yuwei Fang. 2024.Evaluating very long-term conversational memory of llm agents. Preprint, arXiv:2402.17753. Isaac Ong, Amjad Almahairi, Vincent Wu, Wei-Lin Chi- ang, Tianhao Wu, Joseph E. Gonzalez, M Waleed Kadous, and Ion Stoica. 2025. Routellm: Learn- ing to route llms with preference data. Preprint, arXiv:2406.18665. Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez. 2024. Memgpt: Towards llms as operating systems. Preprint, arXiv:2310.08560. Joon Sung Park, Joseph C. OâBrien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, and Michael S. Bernstein. 2023.Generative agents:Interac- tive simulacra of human behavior.Preprint, arXiv:2304.03442. Ofir Press, Noah A. Smith, and Mike Lewis. 2022. Train short, test long: Attention with linear bi- ases enables input length extrapolation. Preprint, arXiv:2108.12409. Timo Schick, Jane Dwivedi-Yu, Roberto DessĂŹ, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. 2023. Toolformer: Language models can teach themselves to use tools. Preprint, arXiv:2302.04761. Larry R Squire. 1992. Declarative and nondeclarative memory: Multiple brain systems supporting learning and memory. Journal of Cognitive Neuroscience, 4(3):232â243. Jianlin Su, Yu Lu, Shengfeng Pan, Ahmed Murtadha, Bo Wen, and Yunfeng Liu. 2023. Roformer: En- hanced transformer with rotary position embedding. Preprint, arXiv:2104.09864. Theodore R. Sumers, Shunyu Yao, Karthik Narasimhan, and Thomas L. Griffiths. 2024.Cognitive architectures for language agents.Preprint, arXiv:2309.02427. Shengyin Sun, Yuxiang Ren, Jiehao Chen, and Chen Ma. 2025. Large language models as topological struc- ture enhancers for text-attributed graphs. Preprint, arXiv:2311.14324. Endel Tulving. 1972. Episodic and semantic memory. In Endel Tulving and Wayne Donaldson, editors, Or- ganization of Memory, pages 381â403. Academic Press, New York. Wujiang Xu, Zujie Liang, Kai Mei, Hang Gao, Juntao Tan, and Yongfeng Zhang. 2025. A-mem: Agentic memory for llm agents. Preprint, arXiv:2502.12110. Ke Yang, Zixi Chen, Xuan He, Jize Jiang, Michel Galley, Chenglong Wang, Jianfeng Gao, Jiawei Han, and ChengXiang Zhai. 2026. Plugmem: A task-agnostic plugin memory module for llm agents. Preprint, arXiv:2603.03296. Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. 2023. React: Synergizing reasoning and acting in language models. Preprint, arXiv:2210.03629. Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. 2021. Big bird: Transformers for longer sequences. Preprint, arXiv:2007.14062. Guibin Zhang, Muxin Fu, Guancheng Wan, Miao Yu, Kun Wang, and Shuicheng Yan. 2025a. G-memory: Tracing hierarchical memory for multi-agent systems. Preprint, arXiv:2506.07398. Wanhao Zhang, Qianli Zhang, Enyu Yu, Yuxiang Ren, Yeqing Meng, Mingxi Qiu, and Jilong Wang. 2024a. Leveraging rag-enhanced large language model for semi-supervised log anomaly detection. In 2024 IEEE 35th International Symposium on Software Re- liability Engineering (ISSRE), pages 168â179. Wanhao Zhang, Qianli Zhang, Enyu Yu, Yuxiang Ren, Yeqing Meng, Mingxi Qiu, and Jilong Wang. 2024b. Lograg: Semi-supervised log-based anomaly detec- tion with retrieval-augmented generation. In 2024 IEEE International Conference on Web Services (ICWS), pages 1100â1102. Yaoze Zhang, Rong Wu, Pinlong Cai, Xiaoman Wang, Guohang Yan, Song Mao, Ding Wang, and Botian Shi. 2025b. Leanrag: Knowledge-graph-based gen- eration with semantic aggregation and hierarchical retrieval. Preprint, arXiv:2508.10391. Penghao Zhao, Hailin Zhang, Qinhan Yu, Zhen- gren Wang, Yunteng Geng, Fangcheng Fu, Ling Yang, Wentao Zhang, Jie Jiang, and Bin Cui. 2024. Retrieval-augmented generation for ai-generated con- tent: A survey. Preprint, arXiv:2402.19473. Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. 2023. Memorybank: Enhancing large language models with long-term memory. Preprint, arXiv:2305.10250. A More Experiment Details A.1 Prompts for PAL-Set Solution QA We provide the full LLM-as-a-Judge prompt tem- plate for the PAL-Set Solution QA task in Figure 4. This template is used to compute the LLM-judge scores reported in Table 2. During evaluation, we supply the judge LLM with the model-generated solution, the task question, and relevant conversa- tion context (when available), along with the corre- sponding positive and negative reference solutions from the dataset. The judge is instructed to score outputs across multiple dimensions: requirement satisfaction, semantic correctness, step complete- ness, and user-level personalization. Positive and negative references are provided to calibrate judg- ments and penalize common error patterns. For ease of aggregation, the judge is constrained to produce strictly formatted JSON outputs, with tem- perature fixed at 0.0. A.2 Supplementary Experiments on the Self-Enhancement Classifier A.2.1 Hyperparameter Sensitivity Analysis To evaluate the robustness of our self-enhancement classifier under different hyperparameter settings, we conducted a full-factor grid search over the three key parameters: initial thresholdÏ 0 â 0.8, 0.9, 0.95, decay rateÎČ â 0.02, 0.05, 0.1, and lower boundÏ min â 0.3, 0.5, 0.7. This re- sulted in 27 configurations. For each configuration, we measured the macro F1 score (with standard deviation) and the average inference latency on the same validation set. To comprehensively evaluate each hyperparameter configuration, we define a combined score that balances accuracy, stability, and efficiency. LetÎŒ lat (c)denote the average in- ference latency of configurationc, and letÎŒ min lat be the minimum average latency among all candidate configurations: ÎŒ min lat = min c ÎŒ lat (c).(13) The normalized latency is then defined as: LatencyNorm(c) = ÎŒ lat (c) ÎŒ min lat .(14) With penalty coefficientsλ s = 0.5andλ l = 0.5, the overall score for configuration c is: Score(c) = ÎŒ F1 (c)â λ s · Ï F1 (c)â λ l · max 0, LatencyNorm(c) (15) whereÎŒ F1 (c)andÏ F1 (c)are the mean and stan- dard deviation of the macro F1 score, respectively. This score penalizes both performance variability (Ï F1 ) and any latency exceeding the optimal value (LatencyNorm(c)â 1), thereby encouraging con- figurations that are accurate, stable, and efficient. As shown in the table 5, the macro F1 values across all 27 configurations vary within a very small range, demonstrating that the classifier is remarkably insensitive to the choice of these hy- perparameters. The best macro F1 (0.9528) is achieved by configuration #21 (Ï 0 = 0.95,ÎČ = 0.02,Ï min = 0.3), but its latency (5.93 ms) is sig- nificantly higher than the optimum. The config- uration with the lowest latency (4.23 ms) is #1 (Ï 0 = 0.9,ÎČ = 0.02,Ï min = 0.5), which also attains a macro F1 of 0.9490. Our default configuration #5 (Ï 0 = 0.9,ÎČ = 0.05,Ï min = 0.5 ) yields a macro F1 of 0.9474 and a latency of 4.44 ms, which is only marginally You are a strict, impartial, and reproducible Solution QA evaluator (LLM Judge). Your task is to evaluate only the relevance and fit of the generated solution to the complete user requirement. Assign an integer score from 1 to 10. Evaluate only the final solution text. Do not evaluate the method that produced it, the retrieval process, the memory system, or the storage structure. Logs and Memories are provided only as user context for checking whether the solution satisfies the user's needs, preferences, and constraints. #Evaluation objectives: 1) Primary: Does the solution accurately satisfy the requirement, including explicit needs, implicit constraints, and current context? 2) Secondary: Is the solution consistent with the provided user context, including relevant preferences, background information, historical constraints, and prohibitions? 3) Tertiary: Does the solution avoid error patterns in the negative references, such as being off-topic, misleading, violating preferences, or ignoring key constraints? #Important rules: Do not give extra credit merely because the solution explicitly mentions memory, history, logs, or retrieved memories. Do not evaluate whether the solution uses any specific retrieval or memory process. If Logs/Memories are empty or insufficient, do not penalize solely for the lack of memory information. Judge based on the requirement, available context, and final solution. If Logs/Memories contain relevant user preferences or constraints and the solution clearly ignores, conflicts with, or fabricates them, deduct points. If the solution does not explicitly cite Logs/Memories but correctly satisfies the relevant preferences and constraints, do not penalize it. #Scoring anchors: 9-10: Highly satisfies the requirement; covers key points completely; is consistent with relevant user context; no major issues. 7-8: Generally satisfies the requirement; mostly consistent with relevant context and preferences; minor omissions only. 5-6: Partially satisfies the requirement; has noticeable omissions, generic content, or insufficient use of relevant context; still somewhat usable. 3-4: Largely fails or deviates from the topic; ignores key context, preferences, or constraints; may be misleading. 1-2: Severely off-topic, obviously wrong, strongly matches negative error patterns, or may cause clear negative impact. Please evaluate the relevance/fit of the following AI-generated solution (1-10 points). [User Requirement] requirement [Current Conversation Context Logs] logs [Provided User Context / Memories] memories [Generated Solution] solution [Positive Reference: high-scoring direction/key points] references_pos [Negative Reference: error patterns to avoid] references_neg Return strict JSON only: "relevance": <integer from 1 to 10>, "explanation": "<one or two concise sentences>" The first character must be "" and the last character must be "". PROMPT TEMPLATE FOR SOLUTION QA RESULTS GENERATIOM (PAL-SET) Figure 4: LLM-as-a-Judge prompt used for PAL-Set Solution QA evaluation, enforcing requirement-fit scoring with implicit constraints, retrieved memories/logs, and pos/neg reference calibration. worse than the best trade-off. The differences from the top-scoring configuration (#1) are min- imal: macro-F1 differs by only 0.0016 (0.9474 vs. 0.9490) and latency by 0.21 ms (4.44 vs.4.23). Both configurations lie on the same near-Pareto frontier. We choose #5 over #1 for the following reasons: âąAdaptive threshold updates: The moderate decay rate (ÎČ = 0.05) triggers more ef- fective threshold updates during online self- enhancement, whereas a smaller decay (ÎČ = 0.02 ) would keep the threshold nearly unchanged, leading to under-adaptation. âąConsistency with our experimental protocol: This setting avoids post-hoc overfitting to a single best point and maintains consistency with the rest of our experiments. âą Robustness: The performance gap between #5 and the best configuration is negligible, and our main conclusions remain unchanged regardless of which near-optimal configuration is chosen. Therefore, we adoptÏ 0 = 0.9,ÎČ = 0.05,Ï min = 0.5 as the default setting for all main experiments. The full ranking of 27 configurations is provided to demonstrate that our results are insensitive to the specific choice among near-optimal settings. Table 5: Hyperparameter sensitivity analysis of the router with different values ofÏ 0 ,ÎČ, andÏ min . The configuration selected for our experiments is highlighted in bold. Rank Ï 0 ÎČ Ï min F1 (mean±std)Latency (ms)Norm LatencyScore 10.90.020.50.9490± 0.00344.231.0000.947 20.90.020.30.9490± 0.00344.361.0310.932 30.90.020.70.9490± 0.00344.401.0400.927 40.80.10.70.9482± 0.00234.461.0550.919 50.90.050.50.9474± 0.00604.441.0500.919 60.80.020.50.9482± 0.00234.721.1180.888 70.90.050.30.9474± 0.00604.831.1430.873 80.950.10.50.9526± 0.00014.961.1740.866 90.90.10.50.9474± 0.00605.061.1980.846 100.80.050.30.9482± 0.00235.101.2070.843 110.950.050.50.9522± 0.00495.131.2130.843 120.80.050.50.9482± 0.00235.221.2350.830 130.90.10.30.9474± 0.00605.261.2440.822 140.950.10.70.9526± 0.00015.421.2810.812 150.90.050.70.9474± 0.00605.401.2770.806 160.80.050.70.9482± 0.00235.471.2950.800 170.950.020.70.9509± 0.00305.521.3070.796 180.950.050.70.9522± 0.00495.641.3350.782 190.80.020.70.9482± 0.00235.631.3320.781 200.80.10.50.9482± 0.00235.801.3710.761 210.950.020.30.9528± 0.00095.931.4020.751 220.950.020.50.9509± 0.00305.941.4050.747 230.950.10.30.9526± 0.00016.051.4310.737 240.80.020.30.9482± 0.00236.011.4210.737 250.90.10.70.9474± 0.00606.051.4310.729 260.80.10.30.9482± 0.00236.241.4770.709 270.950.050.30.9522± 0.00496.441.5250.687 A.2.2 Stage-wise Performance of the Self-Enhancement Classifier Table 6: Performance evolution of the self-enhancement classifier across incremental training stages. StageMacro-F1 Micro-F1âMacro (vs. S0) S0 (offline init)0.89800.88590.0000 S10.91620.9068+0.0182 S20.92820.9192+0.0302 S30.94450.9275+0.0465 S40.95270.9379+0.0547 S50.95540.9416+0.0574 To investigate how the self-enhancement mecha- nism improves classifier performance over time, we record its performance after each incremental train- ing round. The initial stage (S0) uses an offline- trained classifier without any LLM supervision. Subsequently, every 200 newly LLM-labeled sam- ples trigger one round of incremental fine-tuning, resulting in five rounds (S1 to S5). As shown in Ta- ble 6, the macro F1 steadily increases from 0.8980 (S0) to 0.9554 (S5), an absolute gain of 5.74 per- centage points. The micro F1 follows a similar upward trend. The most significant improvements occur in the first two rounds (S0âS1: +1.82 points; S1âS2: +1.20 points), after which the gains grad- ually diminish, indicating convergence. These re- sults demonstrate that the self-enhancement mech- anism effectively leverages LLM-labeled hard sam- ples to continuously improve routing accuracy with- out causing performance oscillation or catastrophic forgetting. Card 1(episodic example) 2024-04-20: Night run 25 minutes, heart rate peaked at 160 bpm. System triggered a mild 'over- exertion' alert and suggested slowing down. Card 3(procedural example) Learned rule: - If NSAID painkillers combine with aspirin â check bleeding risk. - If heart rate>120 bpm for>10 min + hypertension historyâenter risk-warning workflow. - When recommending exercise with knee injury âprefer swimming / cycling over running. Current Task Q Card 2(semantic example) Allergy: Ibuprofen. Chronic diseases: hypertension,knee joint injury. Gene info: family risk of hyperlipidemiaâ. Query/Task & History Past Interactions Topic: Personal health management Difficulty:â â Task: This morning l already took aspirin and my blood-pressure medication. Tonight my knee hurts , after dinner I want to take pain reliever and do some exercise. Please give me a low-salt dinner recommendation and exercising planning. (Check for drug conflicts, exercise safety and diet advice.) Query Answering via Memory Retrieval Episodic health call Night run 25 min, HR peak 160 bpm,mild alert Semantic health facts lookup Allergy:Ibuprofen HypertensionKnee injury++ Procedural risk & medicatio rules aspirin + NSAID check bleeding risk HR > 120bpm + hypertensioin --> risk + State Record taken the medication Dinner Recommendations Engage in exercise Candidate Health Plan 1)To-do items: Take pain medication, eat meals, engage in moderate exercise 2) Medication management - Check aspirin +ibuprofen:avoid high-dose or long-term combination;if pain persists,consult physician. 3) Risk warning - During evening exercise: if HR stays>120 bpm for more than 10 minutes with hypertension history, trigger alert : slow down or stop,measure blood pressure,seek help if symptoms appear. 4) Diet recommendation - For tonight's dinner : propose low- salt, low-fat, high-fiber meal (e.g.,grilled fish or tofu+large vegetablesalad + brown rice), avoid very salty take-out. Current Task Q Topic: Personal health management Difficulty:â â Task: This morning l already took aspirin and my blood-pressure medication. Tonight my knee hurts , after dinner I want to take pain reliever and do some exercise. Please give me a low-salt dinner recommendation and exercising planning. HGP Retrieve HGP Figure 5: An illustrative example of HGP in a personalized health management scenario. Given a userâs current query and long-term interaction history, HGP organizes heterogeneous memories, including episodic, semantic, procedural, and working memory, within a hybrid graph storage, and retrieves task-relevant evidence to generate personalized health recommendations. It is important to emphasize the training protocol for this stage-wise evaluation. The classifier first makes predictions on the training set. Samples with low confidence are sent to an LLM for re-labeling, and the (sample, label) pairs are cached. Once a sufficient number of such samples is accumulated, incremental training is performed, and the cycle repeats. The training and test sets are strictly sep- arated. The test set is never used for training, nor does it ever involve LLM inference. For rigorous evaluation, the test set is further partitioned into multiple disjoint subsets, each used exactly once for evaluating the classifier after one incremental training round. This prevents any data leakage across evaluation steps. B Retrieval Workflow Example As shown in Figure 5, upon receiving a user queryq, HGP executes a structured retrieval protocol over its hybrid graph memoryG = G epi ,G sem ,G proc ,G wm .Each sub-graph is queried for a specific type of evidence. The re- trieved sub-graphs are merged into a unified con- text and passed, together withq, to the LLM. The model then generates a response that is aware of both long-term user history and the current im- plicit constraints, thereby ensuring personalization, safety, and coherence. C Details of special case We construct a personalized health scenario where the dialogue history includes a to-do item: take pre-meal medication before dinner. During eval- uation, the user only requests dinner recommen- dations without explicitly mentioning medication. This case tests whether the agent can adhere to im- plicit constraints inferred from prior interactions and prioritize actions that are required but not ex- plicitly stated in the query. Figure 6 illustrates the full pipeline for the case study in Section 4.3. During retrieval, HGP queries heterogeneous external memories separately: (i) the event graph for diet- and symptom-related logs (episodic memory); (i) the knowledge graph for user preferences and profile facts (semantic mem- ory); and (i) the rule tree for reusable strategies that previously received positive feedback (proce- dural memory). Together, these long-term memo- ries supply user-relevant evidence for personalized dinner suggestions (highlighted in blue). Crucially, HGP also queries the working- memory states from the state trajectory graph to retrieve the current actionable status. In this case, working memory returns âpre-meal medication: in- completeâ and injects it as an actionable constraint into the prompt. Then the LLM reminds the user to take the medication before offeringrecommen- dations (highlighted in yellow).This behavior is (a) Episodic (c) Procedural [log] The user canceled their original breakfast delivery order due to stomach discomfort and opted to rest at home to monitor symptom changes.â 2024-01-02 08:00:00 [Event] âThe user ordered light meals suitable for gastritis sufferers via the delivery platform, including steamed egg custard, pumpkin millet porridge, and steamed fish slices, while avoiding irritating foods.â [Event] The user first tried soft noodles with clear broth, experiencing no pain or discomfort in the stomach. 2024-01-05 12:00:00 2024-01-08 12:00:00 [Prompt] You are an intelligent health assistant. Please provide professional and thoughtful responses based on user requests. User query:I'm getting ready to eat dinner. Any good dinner recommendations? User-related information: [User's past experiences]ïŒepisodic memoryïŒ: logs:......; event: .........ordered light meals suitable for gastritis sufferers via the delivery platform, including steamed egg custard, pumpkin millet porridge, and steamed fish slices............... [User Profile](semantic memory): like eating soft noodles with clear soup [User's Past Execution Strategy Reference](procedural memory):...... [Current Status](working memory):State-haven't taken pre-dinner medication Please provide a response based on the user's relevant information. (d) Working Event ăImportantă Take 20mg of omeprazole 30 minutes before meals. As per medical instructions, medication should be taken before meals. Dinner is scheduled for approximately 6:00 PM, so the medication must be taken by 5:30 PM. S1 S2 Status: Incomplete (b) Semantic Has preference: eating soft noodles with clear soup................. Disease: Acute gastritisïŒstomach discomfort ... Preference:....... ....... Gene risk:......... Allergy: ... Chronic disease: ......... HGP IF user ask dinner suggestion.... THENTHEN IF .......IF....... THEN User have provided positive feedback on dining at x, and we recommend x. assistant (ours):Before you prepare dinner, I noticed you have an uncompleted task in your health app: you haven't taken your pre-dinner medication yet. I recommend completing this task first to ensure your health and safety. After taking your medication, regarding dinner recommendations, considering the stomach discomfort you mentioned earlier, I suggest avoiding apicy food and eating light, easily digestible foods such as: 1. Clear broth noodles: Opt for soft noodles in a light brothâgentle and easy on the stomach. - Chicken congee: Cooked with chicken and rice, it provides nourishment without burdening your stomach. - Steamed fish: Choose lightly steamed varietiesâlow in fat yet rich in protein to aid nutrient absorption. Hope these suggestions help you enjoy a pleasant dinner! user: I'm getting ready to eat dinner. Any good dinner recommendations? Figure 6: Special case study: illustrating the detailed process by which an LLM retrieves user-relevant memories via HGP in the special case. Working memory addresses implicit constraints in a personalized health assistant scenario; its effect is highlighted in yellow (pre-meal medication: pending), while personalized recommendation cues are highlighted in blue. difficult to trigger reliably using only episodic, se- mantic, or procedural retrieval, as it hinges on short- horizon execution state rather than long-term facts, preferences, or strategies. Overall, this case demonstrates HGP âs ability to deliver personalized, context-aware responses. It also shows that long-term memory retrieval alone cannot guarantee compliance with implicit, action- able constraints. By explicitly tracking short-term states via working memory, HGP enhances behav- ioral consistency and safety in long-horizon inter- actions. D Abstraction Operators for Semantic and Procedural Memory from Episodic Memory (LLM Prompts) To construct semantic and procedural memory from raw episodic traces, we design two abstraction op- erators,A sem andA proc , each implemented via a dedicated LLM prompt template. These operators extract structured knowledge from episodic event graphs and convert them into reusable memory for- mats. D.1 Semantic Abstraction OperatorA sem The semantic abstraction operatorA sem extracts static factual knowledge from episodic interactions to construct user profiles, including user attributes, preferences, skills, and long-term constraints. As shown in Figure 7,A sem employs a structured LLM prompt to identify and summarize semantic triples in the form of a knowledge graph, given episodic memories. D.2 Procedural Abstraction OperatorA proc The procedural abstraction operatorA proc extracts reusable rules, workflows, and decision strategies from episodic traces. As illustrated in Figure 8, A proc uses a structured LLM prompt that requires the model to output each rule in a unified JSON format, containing fields such as title, trigger con- ditions, execution steps, tags, and a tree-structured workflow that supports sequential and branching logic. If no clear workflow is present, the operator returns an empty list. The extracted rules are then stored in the procedural memory graphG proc . You are a knowledge graph expert responsible for extracting relevant triples for user semantic memory. Semantic memory is defined as follows: Semantic memory stores long-term, decontextualized knowledge abstracted from individual experiences, used to describe user profiles (such as relationships, preferences, skills, basic information, etc.). It can be reused across time and tasks. Extract knowledge triples about user "user_id" from the following text. ăTextă: content ăExtraction rulesă: 1. Triple format: (User ID, Relation, Entity) 2. Only extract profile knowledge about user user_id 3. Relations should use standard verbs that describe user profiles, such as: likes, dislikes, works_as, lives_in, has_skill, good_at, studies, has, is (or other relation words that align with the definition of semantic memory) 4. Entity must be a concrete object ăConfidence guidelines (examples)ă: 0.90â1.00: Explicit, direct, unconditional statements in the text (first-person preferences/facts) Example: "I like basketball", "I live in Shanghai", "I am a doctor" 0.70â0.89: Clear evidence but with minor uncertainty (paraphrased, slightly omitted context, synonymous expressions) Example: "I've been playing basketball a lot lately" (implies likes, but less direct) 0.50â0.69: Weak evidence / inference (indirect clues, possibly a one-time event) Example: "I went to play basketball yesterday" (more episodic, not necessarily a stable profile) < 0.50: Guess, conditional sentence, counterfactual, sarcasm, or insufficient evidence; try not to output such triples (or output with low confidence) ăSpecial notesă: Explicit negation (e.g., "I don't like X") should not produce a "likes" triple; instead produce a "dislikes" triple and score according to the same guidelines. Conditional preferences (e.g., "If I have time, I would...") should be downgraded or not output. ăExample JSON array outpută: ["relation": "likes", "entity": "basketball", "entity_type": "HOBBY", "confidence": 0.9] Output only the JSON array, no additional text. If no triples are found, return [] PROMPT TEMPLATE FOR Figure 7: Illustration of the procedural abstraction operatorA sem . You are a "procedural memory" extraction assistant. Given a piece of text that may describe an operational workflow, an "if...then..." rule, or a multi- step method, extract (0 to N) reusable rules that have received positive user feedback. Each rule should be represented as: 1. "title": A short name for this process/rule 2. "if": A list of trigger conditions (array of strings; can be empty if not mentioned in the text) 3. "then": A list of main steps in chronological order (each step described as a short verb phrase) 4. "tags": A list of short tags (e.g., ["programming", "environment setup"], ["life", "cooking"]) 5. "tree": A tree structure representing complex workflows, supporting sequential and branching logic, formatted as follows: ăSequential execution (sequence)ă: "type": "sequence", "steps": [ Node, Node, ... ] ăBasic step (action)ă: "type": "action", "text": "the specific action to take" ăConditional branch (branch)ă: "type": "branch", "condition": "under what condition this branch is considered (e.g., installation fails)", "cases": [ "when": "specific situation A (e.g., network error)", "steps": [ Node, Node, ... ] , "when": "specific situation B (e.g., insufficient permissions)", "steps": [ Node, Node, ... ] ] Here, Node can be an "action", a "branch", or a nested "sequence". If the workflow is simple and has no branches, the tree can be a simple sequence corresponding to each step in "then": "type": "sequence", "steps": [ "type": "action", "text": "step 1", "type": "action", "text": "step 2" ] Please strictly follow the JSON structure below (do not include any extra explanations): "rules": [ "title": "rule name", "if": ["condition 1", "condition 2"], "then": ["step 1", "step 2", "step 3"], "tags": ["tag 1", "tag 2"], "tree": "type": "...", "steps": [...] ] If the text contains no clear workflow or rule, return an empty list: "rules": []. Here is the text: text PROMPT TEMPLATE FOR Figure 8: Illustration of the procedural abstraction operatorA proc .