Papers › Online Adaptation of Language Models with a Memory of Amortized Contexts

Online Adaptation of Language Models with a Memory of Amortized Contexts

7 Mar 2024arXiv:2403.04317archive 2025-07-28

Jihoon Tack, Jaehyung Kim, Eric Mitchell, Jinwoo Shin, Yee Whye Teh, Jonathan Richard Schwarz

Due to the rapid generation and dissemination of information, large language models (LLMs) quickly run out of date despite enormous development costs. To address the crucial need to keep models updated, online learning has emerged as a critical tool when utilizing LLMs for real-world applications. However, given the ever-expanding corpus of unseen documents and the large parameter space of modern LLMs, efficient adaptation is essential. To address these challenges, we propose Memory of Amortized Contexts (MAC), an efficient and effective online adaptation framework for LLMs with strong knowledge retention. We propose a feature extraction and memory-augmentation approach to compress and extract information from new documents into compact modulations stored in a memory bank. When answering questions, our model attends to and extracts relevant knowledge from this memory bank. To learn informative modulations in an efficient manner, we utilize amortization-based meta-learning, which substitutes an otherwise required optimization process with a single forward pass of the encoder. Subsequently, we learn to choose from and aggregate selected documents into a single modulation by conditioning on the question, allowing us to adapt a frozen language model during test time without requiring further gradient updates. Our experiment demonstrates the superiority of MAC in multiple aspects, including online adaptation performance, time, and memory efficiency. In addition, we show how MAC can be combined with and improve the performance of popular alternatives such as retrieval augmented generations (RAGs). Code is available at: https://github.com/jihoontack/MAC.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2403.04317")

Code

Syntology Ran 13 of 15 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 1 ran · honoured contract; 5 ran · violated contract; 2 ran · our draft was wrong; 1 ran · fixture could not drive it; 4 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 12 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

jihoontack/mac officialmentioned in paperpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 13 ran; 1 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
5ran · violated contract
2ran · our draft was wrong
1ran · fixture could not drive it
4ran
2unverified

Licence: 1 of the 15 samples is pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from jihoontack/MAC. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

clean_up jihoontack/MAC/utils.py official repository ran fingerprinted MIT (permissive) · 28e11820c8f8d9f0 · report
context_summarization jihoontack/MAC/evals/qa_utils.py official repository ran MIT (permissive) · 4053ebe53b067c39 · report
decode_to_clean_text jihoontack/mac/models/amortized_encdec.py official repository ran MIT (permissive) · 4bc8c9e308a24e2f · report
default jihoontack/MAC/models/module/cross_attention.py official repository ran · violated contract MIT (permissive) · 424012cb37b31172 · report
embeddings_to_ids jihoontack/MAC/evals/qa_utils.py official repository ran MIT (permissive) · 3e376007f812c566 · report
exact_match jihoontack/mac/models/amortized_encdec.py official repository ran · violated contract MIT (permissive) · 64702a446a4111bd · report
exists jihoontack/MAC/models/module/cross_attention.py official repository ran · violated contract MIT (permissive) · aa5486a3650902d8 · report
log_perplexity jihoontack/mac/models/amortized_encdec.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · 8f7b3874eb0e028a · report
normalize_answer jihoontack/MAC/utils.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · c6a80c065d2e4851 · report
pair jihoontack/MAC/models/module/self_attention.py official repository ran · violated contract fingerprinted MIT (permissive) · 6ba8cee9f5daea41 · report
passprompt jihoontack/mac/models/amortized_encdec.py official repository ran · violated contract fingerprinted MIT (permissive) · 726980f025dbc7ee · report
uniq jihoontack/MAC/models/module/cross_attention.py official repository ran · our draft was wrong MIT (permissive) · 9a299fe5ae09e407 · report
AmortEncDecAggregateWrapper jihoontack/mac/models/amortized_encdec.py official repository unverified MIT (permissive) · 60f40382e49d0e3b · report
tqdm_distributed jihoontack/mac/models/amortized_encdec.py official repository unverified MIT (permissive) · e8baf90dada23a73 · report
f1_score identical code first harvested elsewhere ran · honoured contract fingerprinted licence of this copy not recorded · fdd9a4d20f5a9d6f · report

Tasks

Language ModellingMeta-Learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections