---
title: Self-Adaptive Long-term Memory (SALM)
url: https://www.emergentmind.com/topics/self-adaptive-long-term-memory-salm
type: topic
---

# Self-Adaptive Long-term Memory (SALM)

Self-Adaptive Long-term Memory (SALM) refers to a class of AI architectures and algorithms that equip foundation models or intelligent agents with a continuously evolving, structured memory system. Unlike fixed parametric memory (weights) or limited working context, SALM provides mechanisms for dynamically storing, retrieving, updating, consolidating, and pruning experiences encountered across long-term interactions. The core objective is to enable *self-evolution* during deployment, supporting lifelong, personalized adaptation, stable knowledge retention, and robust reasoning over extended temporal horizons [2410.15665][2411.00489].

## 1. Architectural Principles and Formalism

The canonical SALM architecture augments a (typically frozen) foundation model with four interacting modules:

1. **Memory Storage Unit**: Persists structured experiences as entries—often key–value–weight tuples $(k, v, w)$, where $k \in \mathbb{R}^d$ is a context embedding, $v$ encodes the stored content (raw fragment, summary node, or expert trace), and $w \geq 0$ tracks usage or importance.

2. **Memory Retrieval Unit**: Given a query $q_t$, computes a relevance score over stored entries (e.g., via scaled dot-product attention or hybrid keyword-dense retrieval), returning the top-$K$ most relevant items for inference-time augmentation.

3. **Memory Update Unit**: On observing a new input $x_t$, the unit updates memory $M_{t-1} \to M_t$ by selective addition, merging, or adaptive pruning based on thresholds ($\tau_\text{add}$, $\tau_\text{merge}$, $\epsilon$). Decay rates $\rho<1$ modulate weight forgetting.

4. **Memory Consolidation Unit**: Periodically reorganizes memory content using summarization, clustering, or graph sparsification, adjusting granularity between fine-grained episodic traces and abstract semantic/procedural summaries.

Each module's behavior is governed by a self-adaptation policy informed by real-time usage metrics (e.g., retrieval frequencies, novelty scores), allowing dynamic tuning of thresholds, decay, and consolidation rates [2410.15665]. Memory is often organized into *columns* specializing in specific semantic or episodic streams, with per-column adaptation of granularity and retention policy.

**Formal update:** For memory state $M_t = \{m_t^i = (k_t^i, v_t^i, w_t^i)\}_{i=1}^{N_t}$, the update function when $x_t$ arrives is:

1. Retrieve similar entries $S = \{i : \operatorname{sim}(k_{t-1}^i, e_t) > \tau_\text{add}\}$
2. Merge or append:
   - If $\exists i \in S$ with $\operatorname{sim} > \tau_\text{merge}$, update $m_t^i \gets \operatorname{merge}(m_{t-1}^i, x_t)$
   - Else append $m_t^\text{new} = (e_t, x_t, w_\text{init})$
3. Update/decay weights: $\forall i,\, w_t^i = \rho w_{t-1}^i + \alpha \delta[i \in S]$
4. Prune: Remove entries with $w_t^i < \epsilon$

Retrieval scores for a query $q_t$ typically use $r_t^i = \exp(q_t \cdot k_{t-1}^i/\sqrt{d}) / \sum_j \exp(q_t \cdot k_{t-1}^j/\sqrt{d})$ [2410.15665].

## 2. Cognitive and Theoretical Underpinnings

SALM generalizes classical cognitive architectures (ACT-R, Soar, Sigma) and extends the Standard Model of the Mind by unifying all six long-term memory types—parametric/non-parametric × episodic/semantic/procedural. Crucially, SALM introduces systematic "adapters" (policies) enabling online adaptation of storage, retrieval, and forgetting:

- **Human-to-AI mappings**:
  - Episodic memory—event buffers and timestamped recurrent nets
  - Semantic memory—external knowledge bases/vectors (non-parametric) and classifiers/segmenters (parametric)
  - Procedural memory—RL policies and production-rule/code update engines

Adapters for storage ($\pi_s$), retrieval ($\pi_r$), and forgetting ($\pi_f$) receive supervision from downstream performance and are typically updated by policy gradient methods. The overall controller determines whether to update the parametric memory $\theta$, write to non-parametric store $\mathcal{M}$, or skip storage, and analogously for retrieval and forgetting [2411.00489].

**Module flow:**

1. Encode input: $m_t \leftarrow \operatorname{Enc}(x_t, s_t)$
2. Storage adapter samples action $a_t \in \{\text{store}_\text{param}, \text{store}_\text{nonparam}, \text{skip}\}$
3. If parametric, update $\theta \leftarrow \theta - \eta \nabla_\theta \mathcal{L}(\theta; m_t)$; if non-parametric, $\mathcal{M} \gets \mathcal{M} \cup \{m_t\}$
4. Evaluate and reinforce adapters from immediate or downstream task metrics

## 3. Empirical Frameworks and Algorithmic Variations

Numerous empirical SALM systems validate these principles:

- **OMNE/GAIA**: A multi-agent system with agents maintaining independent long-term memories, collaborating via retrieval-augmented generation. Achieves state-of-the-art on 400+ logical deduction tasks (GAIA: test acc. 40.53%, validation 46.06%, Level-3 hard Qs 26.53%) [2410.15665].
- **MAPLE**: A table-question-answering pipeline where agent experience is distilled into "memory notes" by an Archiver module. Retrieval and memory evolution are formalized by threshold-based clustering and graph updates, supporting multi-agent feedback loops. Empirically, adding SALM boosts WikiTQ accuracy from 71.09 → 74.01 (+2.92); memory system dynamics optimized at moderate similarity thresholds (δ ≈ 0.7) [2506.05813].
- **FALCON**: In code generation, a global long-term buffer indexed by FAISS stores (task, code, feedback) tuples. Meta-reinforcement learning alternates inner-loop task-local adaptation with outer-loop global consolidation, implementing a form of dual-level SALM. Experiments show SOTA on MBPP and Humaneval benchmarks [2410.21349].

**Training/inference pseudocode and formal objectives** appear in the primary references and reflect a consensus loop: encode, retrieve, augment prompt/context, infer, update/prune memory, consolidate periodically.

## 4. Variant Mechanisms and Implementation Trade-offs

SALM instantiations vary across domains and task demands:

- **MemoryBank**: Employs an Ebbinghaus Forgetting Curve for decay, with memory strength $S_i$ reinforced when recalled and retention $R_i(t_i) = \exp(-t_i/S_i)$. Automated pruning occurs below a threshold. Used in long-term dialog agents demonstrating high retrieval accuracy ($\sim0.80+$) and robust contextual adaptation [2305.10250].
- **LEMN**: Retention agent (RNN policy) assigns replace/retain probabilities per memory slot, based on spatial and temporal context, optimized by RL on task rewards. Shows dominant gains in streaming QA and RL environments, excelling in noisy/long-horizon regimes [1812.04227].
- **FluxMem**: Memory is organized in a three-level hierarchy (short-term, mid-term, long-term), with context-aware structure selection, and distribution-aware fusion using a Beta Mixture Model gate for dynamic session merging. Offline-trained structure selectors and unsupervised EM for mixture gating yield robust adaptation to interaction heterogeneity, with 9.18% accuracy gain over best fixed-structure baselines [2602.14038].
- **SALM in Online Learning/Bandits**: SALM is formalized as a reduction for achieving long-term memory regret bounds of $O(\sqrt{T(S\ln T + n\ln K)})$, combining static-regret and adaptive switching-regret subroutines to efficiently "remember" and revisit optimal expert policies [1905.12950].

**Practical considerations** involve sub-linear retrieval using approximate nearest neighbor indices (FAISS, ANNOY), asynchronous consolidation to minimize latency, per-session ephemeral or encrypted memory for privacy, and column-based sharding for scalability [2410.15665].

## 5. Integration with Foundation Models and Retrieval-Augmented Generation (RAG)

SALM modules interface with language models, vision transformers, and RL agents through retrieval-augmented inference pipelines:

- At each step, the retrieval unit indexes memory for relevant traces based on the prompt or sensory input.
- Retrieved content is incorporated as additional context (e.g., as RAG chunks, graph nodes, or prompt prefix).
- The update/consolidation mechanism integrates resulting output/feedback, enabling continuous model evolution without re-training of backbone weights.

Empirical studies demonstrate that column-wise retention and adaptive consolidation outpace global LRU (12% gain in conversational settings), while real-time decay prevents catastrophic forgetting (>95% retention over 10k+ interactions) [2410.15665].

**Design recommendations** include monitoring access distributions at the column/session level; using LoRA or other parameter-efficient tuning for consolidating high-level memory summaries; and maintaining audit logs and differential privacy guarantees for personal data [2410.15665].

## 6. Research Applications, Evaluation, and Future Directions

SALM has demonstrated utility in domains spanning language (long-horizon dialog, video understanding, table QA), code generation, continual RL, personalization, and bandit/online learning [2410.15665][2506.05813][2410.21349][1812.04227][1905.12950]. Key evaluation metrics include retrieval accuracy, downstream answer correctness, contextual coherence, storage/retrieval/forgetting F1, NDCG@K, and long-term retention on continual-learning benchmarks [2411.00489].

Ablation studies consistently indicate the critical role of adaptive consolidation, per-column structure, and memory selection policies. Theoretical studies show that SALM’s meta-algorithmic strategies for exploitation/exploration and structure selection yield provable memory-efficiency and regret bounds.

Future directions focus on:

- End-to-end trainable SALM instantiation in large LLM architectures and multi-modal models
- Improved reward signals and online adapter policies for supervision from long-horizon objectives
- Comparative analyses of encoding and memory fusion strategies (contrastive, autoencoding, mixture-of-experts)
- Advanced forgetting/summarization based on compression or deduplication
- Extension to regulatory-compliant, privacy-preserving agent deployments

## 7. Summary Table: SALM Key Modules and Functions

| Module                   | Function                                           | Adaptation Strategies                |
|--------------------------|---------------------------------------------------|--------------------------------------|
| Storage                  | Store processed experience entries                | Reinforcement via recall, usage/stat |
| Retrieval                | Compute query-relevance, select top-K memories    | Hybrid attention, session bias       |
| Update                   | Add, merge, or prune entries                      | Decay, selectivity, novelty gating   |
| Consolidation            | Summarize & compress memory, adjust granularity   | Column restructuring, clustering     |
| Controllers/Adapters     | Monitor and tune thresholds/hyperparameters       | RL-based feedback, offline meta-RL   |

SALM operationalizes a unifying, modular approach for evolving, scalable, and adaptive long-term memory in AI systems, bridging the gap between ephemeral context usage and rigid, static model weights. Empirical and theoretical advances establish SALM as foundational for next-generation self-evolving intelligent agents [2410.15665][2411.00489][2506.05813][2602.14038].

Source: https://www.emergentmind.com/topics/self-adaptive-long-term-memory-salm