Self-Updatable Large Language Models by Integrating Context into Model Parameters

Yu Wang, Xinshuang Liu, Xiusi Chen, Sean O'Brien, Junda Wu, Julian McAuley

TL;DR

SELF-PARAM is a novel method that allows Large Language Models (LLMs) to continuously integrate new, small-scale experiences directly into their existing parameters without requiring any additional storage or modules. By minimizing the Kullback-Leibler (KL) divergence between a context-aware model and a context-blind target model over a diverse set of generated question-answer pairs, it achieves near-optimal memory accuracy (efficacy) and long-term recall (retention).

What Problem Does This Paper Address?

As LLMs are deployed in dynamic environments like video games or conversational systems, they need to absorb new, small-scale experiences continuously. This requires two critical properties:

  1. Efficacy: Accurately remembering and utilizing recently integrated knowledge.
  2. Retention: Recalling long-past experiences over time.

Existing approaches fall into two flawed categories. Methods without extra storage (like continual learning or model editing) modify weights directly but often fail to generalize complex experiences or suffer from catastrophic forgetting. Methods with extra storage (like Retrieval-Augmented Generation (RAG) or memory-augmented modules) maintain high efficacy but introduce an $O(n)$ storage overhead that scales poorly as experiences accumulate.

The authors introduce SELF-PARAM to bridge this gap, achieving high efficacy and robust retention while maintaining a storage complexity of zero.

Methods

Instead of training a model on raw text using standard Next-Word Prediction (NWP) loss, SELF-PARAM updates the model parameters by aligning its internal distributions with a context-enhanced version of itself.

The Process of Context Injection

The pipeline works as follows:

  1. Target Sentence Set Construction: For a given new context $x$, an instruct model (like GPT-4o-mini or a local counterpart) generates a diverse set of contextually relevant question-answer (QA) pairs.
  2. Regularization: To prevent the model from losing its general capabilities, sentences unrelated to the context are sampled from a pre-training dataset (SlimPajama).
  3. KL Divergence Minimization: The target model $\theta'$ (which does not see the context) is trained to match the token distribution predictions of the original model $\theta$ (which does see the context). This forces the target model to internalize the underlying knowledge seamlessly within its parameters, allowing it to answer varied queries about the context later without actually reading it during inference.

Datasets

The authors evaluated their approach across multiple tasks using the following datasets:

  • PwC Dataset: Filtered to contain 1,581 unique contexts and 3,353 unique factual question-answer triples for single, batch, and sequential context injection tasks.
  • SlimPajama: Used to sample context-unrelated sentences for regularization during training.
  • INSPIRED & REDIAL: Two conversational recommendation datasets (containing 731 and 7,415 interactions respectively) used to evaluate the model's ability to absorb multi-turn user-system dialogues and improve movie recommendation recall.

Key Insights and Ideas

  • The Failure of Next-Word Prediction (NWP): Standard fine-tuning on raw text causes the model to overfit to the specific phrasing of the context. If an LLM learns "David likes apples" via NWP, it often fails to answer "What fruit does David like?".
  • Knowledge Internalization via Distribution Matching: By training on a diverse array of generated QA pairs using a KL-divergence objective, SELF-PARAM forces the model to absorb the semantic knowledge rather than just memorizing specific text strings.
  • The Necessity of General Regularization: Ablation studies revealed that without mixing in general data (like SlimPajama), sequential updates quickly degrade the model's broader reasoning and generalization capabilities.

Key Results

SELF-PARAM was evaluated against standard fine-tuning baselines and popular RAG methods (DPR, BM25, RAPTOR) across three backbone architectures: OpenLLaMA-3B-v2, Mistral-7B, and Llama3-8B.

  • Single Context Injection: As shown in the paper's evaluations, SELF-PARAM achieves QA-F1 scores that closely approach the theoretical upper bound (where the model has direct access to the context in its prompt). For instance, on OpenLLaMA-3B-v2, SELF-PARAM scored 0.4927 (Upper Bound: 0.5043), vastly outperforming standard context fine-tuning (0.2217).
  • Batch Context Injection: When injecting 100 and 500 contexts simultaneously, SELF-PARAM consistently outperformed all RAG and memory-augmented baselines (such as MemoryLLM-8B) without incurring any additional storage costs ($S=0$).
  • Sequential Retention: In experiments tracking 20 sequential context injections, SELF-PARAM maintained stable performance (QA-F1 scores around 0.3 to 0.5), demonstrating robust long-term memory retention where baseline fine-tuning methods completely collapsed.
Figure 2: Average QA-F1 scores after sequentially injecting contexts into the model across 50 se- quences. For each sequence, 20 contexts are injected one by one. The first column (step 0) represents the performance of the base model when queried without any injected context. Each subsequent col- umn (step i, where 1 ≤i ≤20) shows the model’s QA-F1 score on each of the contexts across all 20 contexts after i injection steps. The displayed scores are the mean values averaged over all 50 sequences, demonstrating the model’s retention ability as contexts are progressively injected.

Limitations and Future Work

The primary trade-off highlighted by the authors is computational cost. SELF-PARAM roughly doubles the overall training cost compared to standard fine-tuning because it requires four distinct steps: generating QA pairs, computing base logits, computing updated logits, and performing backpropagation.

Additionally, prompting a model to answer questions without explicit context always carries a risk of hallucination. While the authors mitigated this by filtering out non-factual prompts, future work will focus on scaling SELF-PARAM to larger models, handling more diverse and complex experience types, and applying the framework to long, session-based conversational histories.

Summary updated

BibTeX
@inproceedings{wang2025self,
  author = {Yu Wang and Xinshuang Liu and Xiusi Chen and Sean O'Brien and Junda Wu and Julian McAuley},
  title = {{Self-Updatable Large Language Models by Integrating Context into Model Parameters}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=aCPFCDL9QY},
}
Figure