Papers › Human-like Episodic Memory for Infinite Context LLMs

Human-like Episodic Memory for Infinite Context LLMs

12 Jul 2024arXiv:2407.09450archive 2025-07-28

Zafeirios Fountas, Martin A Benfeghoul, Adnan Oomerjee, Fenia Christopoulou, Gerasimos Lampouras, Haitham Bou-Ammar, Jun Wang

Large language models (LLMs) have shown remarkable capabilities, but still struggle with processing extensive contexts, limiting their ability to maintain coherence and accuracy over long sequences. In contrast, the human brain excels at organising and retrieving episodic experiences across vast temporal scales, spanning a lifetime. In this work, we introduce EM-LLM, a novel approach that integrates key aspects of human episodic memory and event cognition into LLMs with no fine-tuning, enabling them to handle practically infinite context lengths while maintaining computational efficiency. EM-LLM organises sequences of tokens into coherent episodic events using a combination of Bayesian surprise and graph-theoretic boundary refinement in an online fashion. When needed, these events are retrieved through a two-stage memory process, combining similarity-based and temporally contiguous retrieval for efficient and human-like access to relevant information. Experiments on the LongBench and InfiniteBench benchmarks demonstrate EM-LLM's superior performance, consistently outperforming the state-of-the-art retrieval model InfLLM across various baseline LLMs. In addition, EM-LLM outperforms its popular counterpart, RAG, in a wide range of tasks, while requiring similar resources. Notably, EM-LLM's performance even surpasses full-context models in most tasks, while successfully performing retrieval across 10 million tokens - a scale computationally infeasible for such models. Finally, our analysis reveals strong correlations between EM-LLM's event segmentation and human-perceived events, suggesting a bridge between this artificial system and its biological counterpart, thereby offering a novel computational framework for exploring human memory mechanisms.

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="2407.09450")

Code

Syntology Ran 10 of 13 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · fixture could not drive it; 9 ran with no contract checked.

By repository: official repository: 13 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

em-llm/EM-LLM-model officialmentioned on GitHubpytorchMIT 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

13 samples harvested; 10 ran; 0 honoured the contract we drafted; 3 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 · fixture could not drive it
9ran
3unverified

Licence: 0 of the 13 samples are 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 em-llm/EM-LLM-model. “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.

repeat_kv em-llm/EM-LLM-model/em_llm/attention/utils.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · 3c76e52815c5401d · report
causal_lm_forward em-llm/EM-LLM-model/em_llm/utils/patch_hf.py official repository ran MIT (permissive) · a359cd294a71264d · report
conductance em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/similarity.py official repository ran MIT (permissive) · 0b50d2ffa074850e · report
em_llm_attn_forward em-llm/EM-LLM-model/em_llm/attention/em_llm.py official repository ran MIT (permissive) · 0c1a7efc206a20ea · report
f1_score em-llm/EM-LLM-model/benchmark/infinitebench_eval.py official repository ran fingerprinted MIT (permissive) · 2eb701a1cd15182a · report
huggingface_forward em-llm/EM-LLM-model/em_llm/utils/patch_hf.py official repository ran MIT (permissive) · fadd3648ce23daa7 · report
intra_inter_sim em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/similarity.py official repository ran MIT (permissive) · 95da472c278d0d78 · report
modularity em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/similarity.py official repository ran MIT (permissive) · d9d71f61780321f5 · report
normalize_answer em-llm/EM-LLM-model/benchmark/infinitebench_eval.py official repository ran fingerprinted MIT (permissive) · 4b44a4d3fd80a48d · report
normalize_zh_answer em-llm/EM-LLM-model/benchmark/infinitebench_eval.py official repository ran fingerprinted MIT (permissive) · f62b4d2a31aa1081 · report
em_llm_causal_lm_forward em-llm/EM-LLM-model/em_llm/attention/em_llm.py official repository unverified MIT (permissive) · b8fd76193f3df437 · report
events_with_similarity_adjustment em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/segmentation.py official repository unverified MIT (permissive) · bb6ff175b16b7429 · report
model_forward em-llm/EM-LLM-model/em_llm/utils/patch_hf.py official repository unverified MIT (permissive) · c32ff1ae851680ef · report

Tasks

Computational EfficiencyEvent SegmentationRAGRetrieval

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AdamAttentionAttention DropoutBARTBERTBPEDense ConnectionsDropoutLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionRAGResidual ConnectionSoftmaxWeight DecayWordPiece

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