SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.09450 · 2024

Human-inspired Episodic Memory for Infinite Context LLMs

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 10 failures of our instrument; 3 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2407.09450.json · badge: /api/ran/2407.09450.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
em-llm/EM-LLM-model canonical (classifier label)
classifier basis: census
10 ran · 3 no recorded run
FunctionStatusWhere it lives
repeat_kv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
em-llm/EM-LLM-model/em_llm/attention/utils.py
code served (permissive licence) · get_code("3c76e52815c5401d")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 6, 5, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T23:23:17Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small tensor with shape (batch, num_key_value_heads, seqlen, head_dim)
# Using distinct sizes: batch=2, num_key_value_heads=3, seqlen=5, head_dim=4
hidden_states = torch.randn(2, 3, 5, 4)

# n_rep is the repetition factor
n_rep = 2

ARGS = {
    "hidden_states": hidden_states,
    "n_rep": n_rep,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 6, 5, 4) — shape (2, 6, 5, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
causal_lm_forward Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/em_llm/utils/patch_hf.py
code served (permissive licence) · get_code("a359cd294a71264d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned CausalLMOutputWithPast. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast

torch.manual_seed(0)

# Define a minimal config object
class Config:
    def __init__(self):
        self.vocab_size = 10
        self.output_attentions = False
        self.output_hidden_states = False
        self.use_return_dict = True

# Define minimal model that serves as self.model
class MinimalModel(nn.Module):
    def __init__(self, hidden_size, vocab_size):
        super().__init__()
        self.hidden_size = hidden_size
        self.vocab_size = vocab_size
    
    def forward(self, input_ids=None, attention_mask=None, position_ids=None, 
                past_key_values=None, inputs_embeds=None, use_cache=None,
                output_attentions=None, output_hidden_states=None, return_dict=None):
        batch_size = input_ids.shape[0] if input_ids is not None else 2
        seq_len = input_ids.shape[1] if input_ids is not None else 5
        hidden_states = torch.randn(batch_size, seq_len, self.hidden_size)
        return BaseModelOutputWithPast(
            last_hidden_state=hidden_states,
            past_key_values=None,
            hidden_states=None,
            attentions=None
        )

# Define minimal self object (mock model with forward method)
class MockCausalLM(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = Config()
        self.model = MinimalModel(hidden_size=4, vocab_size=10)
        self.lm_head = nn.Linear(4, 10)

# Create instance
mock_model = MockCausalLM()

# Setup tensor arguments
batch_size = 2
seq_length = 5
vocab_size = 10
hidden_size = 4

input_ids = torch.randint(0, vocab_size, (batch_size, seq_length))
attention_mask = torch.ones(batch_size, seq_length, dtype=torch.long)
position_ids = torch.arange(seq_length).unsqueeze(0).expand(batch_size, -1)
labels = torch.randint(0, vocab_size, (batch_size, seq_length))
inputs_embeds = torch.randn(batch_size, seq_length, hidden_size)

# Build ARGS dictionary
ARGS = {
    'self': mock_model,
    'input_ids': input_ids,
    'attention_mask': attention_mask,
    'position_ids': position_ids,
    'past_key_values': None,
    'inputs_embeds': None,
    'labels': labels,
    'use_cache': False,
    'output_attentions': False,
    'output_hidden_states': False,
    'return_dict': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CausalLMOutputWithPast — a CausalLMOutputWithPast output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CausalLMOutputWithPast output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
conductance Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/similarity.py
code served (permissive licence) · get_code("0b50d2ffa074850e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# A is an adjacency matrix tensor
# The function indexes it with [..., community, :] and [..., :, community_bar]
# so it expects shape (..., N, N) where N is the number of nodes
# Let's create a batch of 2 adjacency matrices, each 4x4

A = torch.rand(2, 4, 4)
# Make symmetric to represent undirected graphs
A = (A + A.transpose(-2, -1)) / 2

# communities is a list of lists, where each inner list contains node indices
# that belong to a community. Nodes are indexed 0 to N-1 where N is A.shape[-1]
communities = [
    [0, 1],      # community 1: nodes 0, 1
    [2, 3],      # community 2: nodes 2, 3
    [0, 2],      # community 3: nodes 0, 2
]

ARGS = {
    "A": A,
    "communities": communities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
em_llm_attn_forward Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/em_llm/attention/em_llm.py
code served (permissive licence) · get_code("0c1a7efc206a20ea")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from typing import Optional

torch.manual_seed(0)

# Mock ContextManager class that the forward function uses
class ContextManager:
    def __init__(self, layer_idx=0, position_embedding=None, n_init=128, n_local=256, 
                 max_block_size=512, max_cached_block=1024, exc_block_size=64, 
                 min_block_size=1, async_global_stream=True, pin_memory=False, 
                 perhead=False, repr_topk=1, surprisal_threshold_gamma=1.1, 
                 n_mem=2048, block_similarity_topk=False, uniform_blocks=False, 
                 random_topk_blocks=False, infini_attention=False, **kwargs):
        self.layer_idx = layer_idx
        self.position_embedding = position_embedding
    
    def append(self, local_q, local_k, local_v, global_q, global_k, global_v):
        # Return dummy output matching expected shape
        batch_size, num_heads, len_q, dim_head = local_q.shape
        return torch.randn(batch_size, num_heads, len_q, dim_head)

# Mock model with layer_idx attribute
class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer_idx = 0

# Projection layers
class ProjectionLayer(nn.Module):
    def __init__(self, in_dim, out_dim):
        super().__init__()
        self.linear = nn.Linear(in_dim, out_dim)
    
    def forward(self, x):
        return self.linear(x)

# Small attention output layer
class AttentionOutLayer(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x):
        return self.linear(x)

# Build small test components
batch_size = 2
seq_len_q = 4
seq_len_kv = 5
dim_head = 3
num_heads = 2
num_heads_kv = 2
hidden_dim = dim_head * num_heads

# Create projection layers
project_q = ProjectionLayer(hidden_dim, hidden_dim)
project_k = ProjectionLayer(hidden_dim, num_heads_kv * dim_head)
project_v = ProjectionLayer(hidden_dim, num_heads_kv * dim_head)
attention_out = AttentionOutLayer(hidden_dim)

# Create test tensors
query = torch.randn(batch_size, seq_len_q, hidden_dim)
key_value = torch.randn(batch_size, seq_len_kv, hidden_dim)
position_bias = torch.randn(num_heads, seq_len_q, seq_len_kv)

# Create mock model
model = MockModel()

ARGS = {
    'model': model,
    'n_local': 256,
    'n_init': 128,
    'max_block_size': 512,
    'max_cached_block': 1024,
    'exc_block_size': 64,
    'repr_topk': 1,
    'surprisal_threshold_gamma': 1.1,
    'async_global_stream': True,
    'pin_memory': False,
    'perhead': False,
    'n_mem': 2048,
    'min_block_size': 1,
    'block_similarity_topk': False,
    'similarity_refinement_kwargs': {},
    'contiguity_buffer_kwargs': {},
    'random_topk_blocks': False,
    'infini_attention': False,
    'uniform_blocks': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
f1_score Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/benchmark/infinitebench_eval.py
code served (permissive licence) · get_code("2eb701a1cd15182a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from collections import Counter
from typing import Tuple, List

def f1_score(prediction, ground_truth, **kwargs) -> Tuple[float, float, float]:
    common = Counter(prediction) & Counter(ground_truth)
    num_same = sum(common.values())
    if num_same == 0:
        return (0, 0, 0)
    precision = 1.0 * num_same / len(prediction)
    recall = 1.0 * num_same / len(ground_truth)
    f1 = 2 * precision * recall / (precision + recall)
    return (f1, precision, recall)


# Construct valid arguments
prediction = [1, 2, 3, 2, 1]
ground_truth = [1, 2, 2, 3, 4]

ARGS = {
    "prediction": prediction,
    "ground_truth": ground_truth,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
huggingface_forward Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/em_llm/utils/patch_hf.py
code served (permissive licence) · get_code("fadd3648ce23daa7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a minimal forward function that matches the signature expected
def minimal_forward(self, hidden_states, query_states, position_ids, use_cache, past_key_value, q_proj, k_proj, v_proj, o_proj, head_dim, num_heads, num_key_value_heads):
    # Minimal implementation that returns the expected tuple
    batch_size, seq_len, hidden_dim = hidden_states.shape
    output = hidden_states
    loss = torch.tensor(0.0)
    pkv = None
    return output, loss, pkv

# Define a minimal attention module with required attributes and methods
class MinimalAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.q_proj = nn.Linear(4, 4)
        self.k_proj = nn.Linear(4, 4)
        self.v_proj = nn.Linear(4, 4)
        self.o_proj = nn.Linear(4, 4)
        self.head_dim = 2
        self.num_heads = 2
        self.num_key_value_heads = 2

# Create an instance of the attention module
attention_module = MinimalAttention()

# Create a hidden_states tensor (batch_size=2, seq_len=3, hidden_dim=4)
hidden_states = torch.randn(2, 3, 4)

# Define the ARGS dictionary
ARGS = {
    'forward': minimal_forward,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
intra_inter_sim Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/similarity.py
code served (permissive licence) · get_code("95da472c278d0d78")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# A is a tensor indexed with A[..., community, :][..., :, community_bar]
# This means A should be at least 2D where the last two dimensions are square-indexable
# Let's make A a 3D tensor: (batch=2, nodes=4, nodes=4)
A = torch.randn(2, 4, 4)

# communities is a list of lists, where each inner list contains node indices
# The function iterates over communities and indexes A with these indices
# Let's create 2 communities from 4 nodes
communities = [[0, 1], [2, 3]]

ARGS = {
    "A": A,
    "communities": communities,
    "return_mean": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
modularity Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/similarity.py
code served (permissive licence) · get_code("d9d71f61780321f5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
torch.manual_seed(0)

# A is a similarity matrix with shape (..., position, position)
# We'll create a 3D tensor: (layer=2, head=3, position=4, position=4)
A = torch.randn(2, 3, 4, 4)
A = (A + A.transpose(-2, -1)) / 2  # Make it symmetric

# communities is a list of lists of position indices
# Each sublist defines which positions belong to a community
communities = [[0, 1], [2, 3]]

ARGS = {
    "A": A,
    "communities": communities,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_answer Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/benchmark/infinitebench_eval.py
code served (permissive licence) · get_code("4b44a4d3fd80a48d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import string

def normalize_answer(s: str) -> str:
    """Lower text and remove punctuation, articles and extra whitespace."""

    def remove_articles(text):
        return re.sub('\\b(a|an|the)\\b', ' ', text)

    def white_space_fix(text):
        return ' '.join(text.split())

    def remove_punc(text):
        exclude = set(string.punctuation)
        return ''.join((ch for ch in text if ch not in exclude))

    def lower(text):
        return text.lower()
    return white_space_fix(remove_articles(remove_punc(lower(s))))


ARGS = {
    "s": "The Quick Brown Fox! How are you, today?"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_zh_answer Ran
ran; our contract draft was wrong, not the code
em-llm/EM-LLM-model/benchmark/infinitebench_eval.py
code served (permissive licence) · get_code("f62b4d2a31aa1081")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import string

def normalize_zh_answer(s: str) -> str:
    """Chinese version. Lower text and remove punctuation, extra whitespace."""

    def white_space_fix(text):
        return ''.join(text.split())

    def remove_punc(text):
        cn_punctuation = '!?。。"#$%&'()*+,-/:;<=>@[\]^_`{|}~⦅⦆「」、、〃》「」『』【】〔〕〖〗〘〙〚〛〜〝〞〟〰〾〿–—''‛""„‟…‧﹏.'
        all_punctuation = set(string.punctuation + cn_punctuation)
        return ''.join((ch for ch in text if ch not in all_punctuation))

    def lower(text):
        return text.lower()
    return white_space_fix(remove_punc(lower(s)))


# Test string with Chinese and English characters, punctuation, and whitespace
test_string = "Hello  世界!?This is a Test。with、mixed,punctuation"

ARGS = {
    "s": test_string
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
em_llm_causal_lm_forward Not yet run
unverified (harvested, no recorded run)
em-llm/EM-LLM-model/em_llm/attention/em_llm.py
code served (permissive licence) · get_code("b8fd76193f3df437")
How it ran

no invocation recorded.

events_with_similarity_adjustment Not yet run
unverified (harvested, no recorded run)
em-llm/EM-LLM-model/em_llm/attention/similarity_refinement/segmentation.py
code served (permissive licence) · get_code("bb6ff175b16b7429")
How it ran

no invocation recorded.

model_forward Not yet run
unverified (harvested, no recorded run)
em-llm/EM-LLM-model/em_llm/utils/patch_hf.py
code served (permissive licence) · get_code("c32ff1ae851680ef")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 1 the same month, 3 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
repeat_kv 243 other papers
96 dated earlier, 8 the same month, 135 later, 2 same year, order not determinable, 2 undated · 22 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2203.08913 (2022-03)
Memorizing Transformers
2305.17888 (2023-05)
LLM-QAT: Data-Free Quantization Aware Training for Large Language Models
and 240 more not named here
normalize_answer 5 other papers
2 dated earlier, 3 later
2402.04617 (2024-02)
InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context Memory
2406.07528 (2024-06)
QuickLLaMA: Query-aware Inference Acceleration for Large Language Models
2408.11745 (2024-08)
FocusLLM: Precise Understanding of Long Context by Dynamic Condensing
and 2 more not named here
normalize_zh_answer 4 other papers
2 dated earlier, 2 later
2402.04617 (2024-02)
InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context Memory
2406.07528 (2024-06)
QuickLLaMA: Query-aware Inference Acceleration for Large Language Models
2408.11745 (2024-08)
FocusLLM: Precise Understanding of Long Context by Dynamic Condensing
and 1 more not named here
f1_score 2 other papers
2 dated earlier
2402.04617 (2024-02)
InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context Memory
2406.07528 (2024-06)
QuickLLaMA: Query-aware Inference Acceleration for Large Language Models

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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, human-inspired access to relevant information. Experiments on the LongBench and $\infty$-Bench 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 parallels between this artificial system and its biological counterpart, thereby offering a novel computational framework for exploring human memory mechanisms.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2407.09450")
get_code_for_paper("2407.09450")
have("2407.09450")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2407.09450.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2407.09450.svg)](https://syntology.ai/paper/2407.09450)

Connect an agent — have() is free.