TL;DR
MemFold is a novel framework for long-context personalization that compresses user history into a fixed-budget "soft memory" of latent vectors. By optimizing this memory through on-policy reinforcement learning and a unique confidence-gated distillation process, it ensures the model doesn't just "remember" text, but actually uses that information to drive correct behavior, outperforming full-text baselines on contexts up to 128K tokens.
What Problem Does This Paper Address?
As AI assistants serve users over longer periods, they must navigate evolving preferences, revised constraints, and complex histories. Current approaches generally fall into two camps:
- Textual Memory: Keeping the entire history as text. This is accurate but causes the input length to explode, increasing latency and cost.
- Latent Memory: Compressing history into fixed-size vectors. While efficient, these are typically trained to reconstruct the original text or imitate reference answers.
The authors argue there is a gap between retaining information and acting on it. A model might be able to reconstruct a sentence about a user's dislike for wearable tech but still recommend an Apple Watch because the compression didn't preserve the "behavioral signal" needed for the task. MemFold addresses this by optimizing the memory interface directly based on the downstream behavior it supports.
Methods
MemFold consists of a memory writer, a compressor, and a reader, optimized through a three-stage on-policy pipeline:
- Fixed-Budget Soft Memory: A query-conditioned textual memory is first extracted from the history. A Perceiver-style compressor then maps this text into $K$ continuous "soft memory" vectors. This keeps the reader's interface size constant, regardless of how long the history is.
- On-Policy Rollout: The student model (the reader) generates responses based on the query and these $K$ soft memory tokens.
- On-Policy Distillation (OPD): This is the "secret sauce." A frozen "teacher" model—which has access to the full, uncompressed textual memory—scores the student's generated tokens.
- Confidence-Gated Optimization: The authors introduce a token-level confidence gate. If the teacher is significantly more confident in a token than the student, that token receives a higher weight in the update. This provides a dense, per-token signal that complements the sparse, sequence-level task reward.
The final objective combines Group Relative Policy Optimization (GRPO) for task-level rewards with the OPD loss for fine-grained behavioral alignment.
Datasets
The authors evaluated MemFold across several challenging benchmarks:
- PersonaMem-32K & 128K: Benchmarks for tracking dynamic user preferences over long conversational histories.
- PrefEval: Used to test cross-dataset generalization of implicit persona recognition.
- LoCoMo & LongMemEval: Used to assess long-term memory reasoning, including multi-session logic and knowledge updates.
Key Insights and Ideas
- Behavior-Centric Compression: The most important finding is that optimizing for task performance (how the model acts) is more effective for personalization than optimizing for reconstruction (how well the model remembers the words).
- The Power of the Gate: The confidence gate prevents the teacher from being an "accuracy oracle." It only pulls the student toward the teacher's distribution when the student is clearly under-performing due to compression. If the teacher is also uncertain, the gate approaches zero, preventing noisy updates.
- Scaling to the Extreme: While many models see performance degrade as context grows (the "lost in the middle" phenomenon), MemFold's performance gap over baselines actually widens at 128K tokens. The fixed-budget interface helps the model stay focused on relevant signals.
- Sample Efficiency: Because OPD reuses the student's own rollouts and doesn't require additional autoregressive decoding from the teacher, it is highly sample-efficient.
Key Results
- State-of-the-Art Performance: MemFold achieved the highest accuracy across three different Qwen backbones (2.5-3B, 2.5-7B, and Qwen3-4B) on both PersonaMem variants.
- Robust Generalization: Without any target-domain training, MemFold transferred successfully to PrefEval and LongMemEval, significantly outperforming other latent-memory methods like xRAG and MemGen.
- Memory Dependency: Through "shuffled" and "null" memory interventions, the authors proved the model isn't just relying on task priors; it is actively and specifically using the content stored in its $K$ soft vectors to make decisions.
Limitations and Future Work
- Initial Extraction Dependency: The memory writer is currently initialized using memories extracted by a stronger external model (GLM-5.2). While not needed at inference, the system's quality is currently tethered to this initial supervision.
- Backbone Scaling: The experiments were limited to models up to 7B parameters. Testing whether these gains hold for 70B+ parameter models remains an open question.
- First-Pass Cost: While the soft memory makes the reader efficient, the system still needs to process the full history once to build the textual memory. Reducing this initial overhead is a potential area for future research.
Summary updated