HasMem: Hard-Origin Adaptively Softened Memory for Long-Term LLM Agents
cs.AI
Submitted: 2026-09-25
Updated: 2026-09-25
Code: https://github.com/ZihongHe/HasMem
License: http://creativecommons.org/licenses/by-nc-sa/4.0/
The gist: Text-based memory and context compression support reuse of past interactions.
Terminology
Abstract
Text-based memory and context compression support reuse of past interactions. Resizing continuous memory changes the input to a frozen LLM, coupling capacity allocation with readout. We propose Hard-Origin Adaptively Softened Memory (HasMem). Frozen hard-prompt embeddings provide a verifiable initial state. A controller adjusts memory widths, a Writer re-encodes resized entries, and Reader and Global provide readout adaptation and cross-turn state. On all 535 questions in a reconstruction probe derived from the Multi-Session Chat (MSC) development split, the main configuration achieves lexical F1 of 95.3 (+4.4 percentage points) at 93.6% of the hard reference's framed memory positions. With approximately matched per-question target body budgets, six configurations at mean per-entry retention around 0.83 -- 0.91 exceed rule-based re-encoding by 8.0 -- 23.6 exact-match (EM) percentage points. With fixed model parameters and rule target width ratio 0.75, Global's EM gain passes a user-level exact paired test with Bonferroni correction over eight comparisons. On all 500 LongMemEval-S questions, local lexical F1 rises from the hard reference's 3.4 to 8.9, and answer negative log-likelihood (NLL) falls from 12.257 to 5.274. F1 gains accompany lower EM on both evaluations.
Sources
- PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funneling
- Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory
- Larimar: Large Language Models with Episodic Memory Control
- In-context Autoencoder for Context Compression in a Large Language Model
- LoRA: Low-Rank Adaptation of Large Language Models
- Mistral 7B
- MemRefine: LLM-Guided Compression for Long-Term Agent Memory
- A Human-Inspired Reading Agent with Gist Memory of Very Long Contexts
- SimpleMem: Efficient Lifelong Memory for LLM Agents
- Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference
- MemGPT: Towards LLMs as Operating Systems
- Compressive Transformers for Long-Range Sequence Modelling
- Saliency-driven Dynamic Token Pruning for Large Language Models
- MEMORYLLM: Towards Self-Updatable Large Language Models
- M+: Extending MemoryLLM with Scalable Long-Term Memory
- LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory
- Memorizing Transformers
- From Human Memory to AI Memory: A Survey on Memory Mechanisms in the Era of LLMs
- Qwen2.5 Technical Report
- FlexComp: One Model for Every Ratio in Context Compression
Related papers
- MAVEN-T: Reinforced Heterogeneous Distillation for Real-Time Multi-Agent Trajectory Prediction
- Model Discovery Agent: LLM-assisted Bayesian experiment design for data-efficient discovery of mechanistic world models
- Agents' Last Exam
- The Clinician's Veto: Navigating Trust, Liability, and Uncertainty in Autonomous AI Prescribing
- MindHelper: Closed-Loop Embodied Mental-State Reasoning for Precision Intervention
- Incumbent Advantage: Brand Bias and Cognitive Manipulation Dynamics in LLM Recommendation Systems