RPMem: Learning Long-Term Recurrent Parametric Memory Across Sessions for LLM Agents

Fanyu Zhao1,2,* Ruike Cao2,* Liang Dong2,† Fugen Yao2 Jian Xu2 Guanjun Jiang2 Han Zhang1 Yifei Zhao1 Yinsheng Li1,†

1 Fudan University2 Qwen Business Unit of Alibaba

* Equal contribution. † Corresponding authors.

RPMem architecture: single-session memory compilation, cross-session consolidation, and deployment with a backbone-specific decoder.
A session compiler creates latent memory. A recurrent gate consolidates it across sessions. A model-specific decoder turns retained memory into LoRA parameters for the reader.

Memory across sessions

Long-running LLM agents need memory that persists and evolves. Text-based memory retrieves and reconstructs past interactions at each query. RPMem instead compiles session information into model computation through low-rank adaptation.

The architecture separates session encoding, recurrent consolidation, and backbone-specific decoding. A frozen context encoder and a trainable Perceiver compile each bounded session into fixed-shape latent memory. A task-trained gate integrates new sessions with retained memory, and a decoder maps the consolidated state to LoRA parameters.

This separation supports decoder-head adaptation when the backbone changes. The paper studies long-term memory on PERMA, PersonaMem-v2, and PrefEval, alongside cross-backbone transfer and memory dynamics.

Two stages, one persistent memory

Stage 1

Session compilation

The compiler learns from a history-aware teacher using a fixed-reference forward-KL objective. The reader and context encoder stay frozen while the Perceiver and LoRA decoder are trained.

Stage 2

Recurrent consolidation

Downstream supervision trains a lightweight gate to retain and update session memory. At deployment, bounded sessions update a fixed-size state without reprocessing the entire history.

Cross-session memory performance

RPMem achieves the strongest non-oracle aggregate results on PERMA and PersonaMem-v2. On PrefEval, LightMem leads at shorter intervals; RPMem leads at 300 intervening turns.

Accuracy (%), as reported in the paper. Qwen3-8B with thinking disabled for RPMem and baseline implementations, except the released Metis-9B model. Bold values mark the best non-oracle result in each column; Gold State is an oracle reference. Shading identifies RPMem.

PERMA

Ten-fold leave-one-user-out evaluation. Core averages the four clean/noisy single-domain and multi-domain settings.
MethodSD-CSD-NMD-CMD-NCore
No Context66.7366.7354.6054.6060.66
Gold State (oracle)72.7072.2366.0665.4769.12
Rolling Summary39.5740.2723.3427.4132.65
LightMem56.6356.2040.7240.2048.44
Mem057.5758.5741.0342.1049.82
RAG (BGE-M3)63.0062.5349.1647.4655.54
Full Context76.4773.0370.7269.9572.54
SFT78.0071.4749.3042.6160.35
Metis-9B80.8780.4780.1779.2980.20
RPMem (ours)90.5791.2079.6780.6285.52

PersonaMem-v2

Official train/test split. Overall, Self, and Current are reported separately.
MethodOverallSelfCurrent
No Context25.7425.2825.42
Gold State (oracle)57.9064.0569.16
Rolling Summary26.5825.4625.32
LightMem30.4631.4234.51
Mem030.0230.2631.90
RAG (BGE-M3)30.3231.1331.70
Full Context31.1032.7233.97
SFT31.6433.6535.47
Metis-9B29.6430.2431.32
RPMem (ours)40.2243.6147.28

PrefEval

Official split. Each history-length result averages explicit, implicit-choice, and implicit-persona forms.
Method10 turns70 turns300 turns
No Context36.6739.8239.07
Gold State (oracle)80.1880.7480.00
Rolling Summary44.2645.1945.19
LightMem81.3079.0773.52
Mem073.1565.1961.67
RAG (BGE-M3)59.2654.6350.74
Full Context60.0045.0040.56
SFT57.2240.0038.15
Metis-9B43.8939.0739.82
RPMem (ours)69.8172.4174.81

Across language-model backbones

The paper evaluates five backbones across model families, scales, and dense and MoE architectures. RPMem consistently improves over matched No Context and Full Context references.

PERMA accuracy across Qwen3-4B, Qwen3-8B, Ministral-3-8B, Qwen3.5-9B, and Qwen3.5-35B-A3B. RPMem exceeds both matched references on each backbone.
PERMA generalization: seven-variant averages at left; single-domain and multi-domain averages at right. These averages use a different scope from the four-setting Core column above.

What makes memory work?

Both training stages matter. Matching the context-conditioned distribution produces stronger session memories, while learned consolidation substantially outperforms fixed rules for combining them.

PERMA accuracy (%). Core SD and Core MD average the clean and noisy settings; Core Avg. averages all four. Each ablation varies one stage while holding the other fixed.

Memory compilation

The same learned gate protocol, with different compiler objectives.
ObjectiveCore SDCore MDCore Avg.
Compiler SFT72.2050.2361.21
Sampled RKL (top-K)74.0859.7366.91
Sampled RKL (K3)70.8263.2267.02
Top-K CE82.9972.3477.66
Sampled FKL88.3779.1483.75
Fixed FKL90.8980.1585.52

Fixed FKL improves over Top-K CE by 7.86 percentage points, supporting distributional matching beyond selected-token probabilities.

Cross-session consolidation

The same Fixed-FKL compiler, with different memory-combination rules.
RuleCore SDCore MDCore Avg.
Rank concatenation14.9712.7113.84
Latent averaging62.4028.6445.52
Latest Session67.7239.4053.56
Factor averaging69.4438.9954.21
Learned gate (ours)90.8980.1585.52

The learned gate gains 31.31 percentage points over factor averaging, the strongest fixed rule evaluated here.

More sessions, fixed-size memory

At 64 accumulated sessions, RPMem updates memory in 0.043 seconds and retains 36.562 MiB per user. The reader receives no historical context tokens. Update time and retained state stay nearly constant across the measured history lengths.

Online deployment at 64 sessions. Growth is the measured ratio between 64 sessions and one session. Lower is better; bold marks the best value, including ties.
MethodMemory updatePersistent memoryHistorical
query tokens
Time (s)GrowthSize (MiB)Growth
Full Context——0.13878.09×28,498.4
Mem012.5541.10×20.04162.11×441.7
Adapter rank concatenation0.94829.46×183.7385.10×0
RPMem (ours)0.0431.03×36.5621.00×0

Hot-update timings with models and services already resident. Persistent memory excludes shared model parameters. Full Context has no separate write operation. Here, rank concatenation recompiles accumulated history at each update; the consolidation ablation above instead uses session-wise adapters.

What does the gate keep?

The gate writes and retains information differently according to its role in the history. Events that establish a new memory domain receive stronger writes than supplements; later updates revise same-domain information while preserving more of other domains.

Six-panel PERMA analysis: emergence events receive larger writes than supplements; Clean and Noisy writes remain similar; same-domain updates have more similar write patterns but lower one-step source survival than cross-domain updates; emergence sources survive longer over 60 subsequent sessions.
Qwen3-8B on held-out PERMA Clean-SD and Noisy-SD histories, analyzed after direct first-session initialization. (a-b) Write magnitude by event role and noise condition. (c-e) Domain-specific write patterns and source retention. (f) Source survival over subsequent sessions, on a logarithmic scale.

The emergence-to-supplement survival ratio grows from 1.31× after one update to 6.64× after 60. This traces the retained contribution of a session to the latent state, not a probability of answering correctly.

Citation

@article{zhao2026rpmem,
  title={RPMem: Learning Long-Term Recurrent Parametric Memory Across Sessions for LLM Agents},
  author={Zhao, Fanyu and Cao, Ruike and Dong, Liang and Yao, Fugen and Xu, Jian and
          Jiang, Guanjun and Zhang, Han and Zhao, Yifei and Li, Yinsheng},
  journal={arXiv preprint arXiv:2609.23466},
  year={2026},
  url={https://arxiv.org/abs/2609.23466}
}

Acknowledgements

This work was supported by Qwen Business Unit through Alibaba Research Intern Program.

We thank the authors of Doc-to-LoRA (D2L), Idefics2, PERMA, PersonaMem-v2, and PrefEval for their open-source work.