SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.04617 · 2024

InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context Memory

arXiv · PDF · Open in the Atlas

Code that ran

11 of 12 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 10 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2402.04617.json · badge: /api/ran/2402.04617.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
thunlp/infllm canonical (classifier label)
classifier basis: census
11 ran · 1 no recorded run
FunctionStatusWhere it lives
build_chat Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thunlp/infllm/benchmark/pred.py
pointer only (licence: MIT); the stored copy get_code serves, from dvlab-research/q-llm, is pointer only (licence: NONE) · get_code("899f8b2f018b4018")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from dvlab-research/q-llm, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

count_score Ran
ran, honoured the contract we drafted
thunlp/infllm/benchmark/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from borealisai/radar-decoding, is pointer only (licence: LGPL-3.0) · get_code("b349b79d9cc2934b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from borealisai/radar-decoding, and LGPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

f1_score Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/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
inf_llm_forward Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/inf_llm/attention/inf_llm.py
code served (permissive licence) · get_code("a3139f9838c7d186")
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)

# Small stand-in classes and modules

class ProjectionModule(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)

class AttentionOutModule(nn.Module):
    def __init__(self, in_dim):
        super().__init__()
        self.linear = nn.Linear(in_dim, in_dim)
    
    def forward(self, x):
        return self.linear(x)

class ContextManager:
    def __init__(self, position_bias, n_init, n_local, block_size, max_cached_block, topk, exc_block_size, score_decay, fattn, repr_topk, cache_strategy, chunk_topk_calc, async_global_stream, pin_memory, faiss, perhead):
        self.position_bias = position_bias
        self.n_init = n_init
        self.n_local = n_local
        self.block_size = block_size
        self.max_cached_block = max_cached_block
        self.topk = topk
        self.exc_block_size = exc_block_size
        self.score_decay = score_decay
        self.fattn = fattn
        self.repr_topk = repr_topk
        self.cache_strategy = cache_strategy
        self.chunk_topk_calc = chunk_topk_calc
        self.async_global_stream = async_global_stream
        self.pin_memory = pin_memory
        self.faiss = faiss
        self.perhead = perhead
    
    def append(self, local_q, local_k, local_v, global_q, global_k, global_v):
        # Return dummy output with shape (batch_size, num_heads, len_q, dim_head)
        batch_size, num_heads, len_q, dim_head = local_q.shape
        return torch.randn(batch_size, num_heads, len_q, dim_head)

# Define tensor and module dimensions
batch_size = 2
seq_len_q = 8
seq_len_kv = 10
hidden_dim = 12
num_heads = 3
num_heads_kv = 3
dim_head = 4

# Create projection modules
project_q = ProjectionModule(hidden_dim, num_heads * dim_head)
project_k = ProjectionModule(hidden_dim, num_heads_kv * dim_head)
project_v = ProjectionModule(hidden_dim, num_heads_kv * dim_head)
attention_out = AttentionOutModule(num_heads * dim_head)

# Create position bias
position_bias = torch.randn(1, num_heads, seq_len_q, seq_len_kv)

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

# inf_llm_forward parameters
ARGS = {
    'n_local': 4,
    'n_init': 2,
    'topk': 3,
    'block_size': 2,
    'max_cached_block': 10,
    'exc_block_size': 1,
    'fattn': False,
    'repr_topk': 1,
    'cache_strategy': 'lru',
    'score_decay': None,
    'chunk_topk_calc': None,
    'async_global_stream': True,
    'pin_memory': False,
    'faiss': False,
    'perhead': False,
}

# Forward function parameters (passed as part of the closure/returned function)
forward_kwargs = {
    'query': query,
    'key_value': key_value,
    'position_bias': position_bias,
    'use_cache': True,
    'past_key_value': None,
    'project_q': project_q,
    'project_k': project_k,
    'project_v': project_v,
    'attention_out': attention_out,
    'dim_head': dim_head,
    'num_heads': num_heads,
    'num_heads_kv': num_heads_kv,
}

ARGS['forward_kwargs'] = forward_kwargs
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
load_infinite_bench Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/benchmark/pred.py
code served (permissive licence) · get_code("121ee531e379175c")
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 list, 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.

import os
import json
import tempfile

# Create a temporary directory and files for testing
temp_dir = tempfile.mkdtemp()

# Create sample JSONL files for different data_name types
sample_data = {
    'code_run': [
        {
            'input': 'func_1(42)',
            'context': 'def func_1(x): return x * 2',
            'answer': '84'
        }
    ],
    'code_debug': [
        {
            'context': 'def buggy_func(x): return x + 1',
            'options': ['Option A text', 'Option B text', 'Option C text', 'Option D text'],
            'answer': 'Option A text'
        }
    ],
    'code_debug_qa': [
        {
            'context': 'Some code context here',
            'answer': 'The bug is on line 5'
        }
    ],
    'longdialogue_qa_eng': [
        {
            'context': 'A long dialogue between characters discussing topics',
            'input': 'What was discussed?',
            'answer': 'They discussed the weather'
        }
    ],
    'longbook_choice_eng': [
        {
            'context': 'A long book excerpt with many words to test context length',
            'input': 'What is the main theme?',
            'options': ['Theme A', 'Theme B', 'Theme C', 'Theme D'],
            'answer': ['Theme A', 'A']
        }
    ],
    'longbook_qa_eng': [
        {
            'context': 'A long book excerpt about various topics and themes',
            'input': 'What happened?',
            'answer': 'Something important occurred'
        }
    ],
    'longbook_sum_eng': [
        {
            'context': 'A long book passage that needs to be summarized with many details',
            'answer': 'Summary of the passage'
        }
    ],
    'longbook_qa_chn': [
        {
            'context': '一部长书籍的摘录包含各种话题和主题',
            'input': '发生了什么?',
            'answer': '发生了一些重要的事情'
        }
    ],
    'math_calc': [
        {
            'context': 'Calculate 2 + 2',
            'answer': '4'
        }
    ],
    'math_find': [
        {
            'input': 'The sum of the following numbers is what?',
            'context': '1 2 3 4 5 6 7 8 9 10',
            'answer': '55'
        }
    ],
    'kv_retrieval': [
        {
            'content': 'key_0123456789abcdef: value1, key_fedcba9876543210: value2',
            'input': 'What is "key_0123456789abcdef"?',
            'answer': 'value1'
        }
    ]
}

# Write all sample data to JSONL files
for data_name, data_list in sample_data.items():
    file_path = os.path.join(temp_dir, data_name + '.jsonl')
    with open(file_path, 'w') as f:
        for item in data_list:
            f.write(json.dumps(item) + '\n')

ARGS = {
    'path': temp_dir,
    'data_name': 'code_run'
}
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 list, ndim 1, dtype family float — a list 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
normalize_answer Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/benchmark/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from borealisai/radar-decoding, is pointer only (licence: LGPL-3.0) · get_code("e7e75981cb464788")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from borealisai/radar-decoding, and LGPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

normalize_answer Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/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
thunlp/infllm/benchmark/metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from borealisai/radar-decoding, is pointer only (licence: LGPL-3.0) · get_code("8c5c581f9264c810")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from borealisai/radar-decoding, and LGPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

normalize_zh_answer Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/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
origin_forward Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thunlp/infllm/inf_llm/attention/origin.py
code served (permissive licence) · get_code("7e700bfa53cce7cf")
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)

# Parameters
batch_size = 2
len_q = 3
len_k = 5
num_heads = 2
num_heads_kv = 2
dim_head = 4
hidden_dim = num_heads * dim_head

# Linear projection layers
class ProjectionLayer(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.linear(x)

project_q = ProjectionLayer(hidden_dim, num_heads * dim_head)
project_k = ProjectionLayer(hidden_dim, num_heads_kv * dim_head)
project_v = ProjectionLayer(hidden_dim, num_heads_kv * dim_head)
attention_out = ProjectionLayer(num_heads * dim_head, hidden_dim)

# Position bias module
class PositionBias(nn.Module):
    def forward(self, h_q, h_k):
        return h_q, h_k

position_bias = PositionBias()

# Tensors
query = torch.randn(batch_size, len_q, hidden_dim)
key_value = torch.randn(batch_size, len_k, hidden_dim)

# Past key value cache (None or tuple of tensors)
past_key_value = None

ARGS = {
    "fattn": False,
    "args": (),
    "kwargs": {
        "query": query,
        "key_value": key_value,
        "position_bias": position_bias,
        "use_cache": True,
        "past_key_value": past_key_value,
        "project_q": project_q,
        "project_k": project_k,
        "project_v": project_v,
        "attention_out": attention_out,
        "dim_head": dim_head,
        "num_heads": num_heads,
        "num_heads_kv": num_heads_kv,
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flash_attn, 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
stream_llm_forward Ran
ran; our contract draft was wrong, not the code
thunlp/infllm/inf_llm/attention/stream_llm.py
code served (permissive licence) · get_code("c03a0458a393d5c5")
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)

# Mock get_multi_stage_dot_production_attention function
class MockAttn:
    def __init__(self, shape, dtype, device):
        self.shape = shape
        self.dtype = dtype
        self.device = device
        self.local_q = None
        self.local_k = None
        self.local_v = None
        self.init_q = None
        self.init_k = None
        self.init_v = None
    
    def append(self, q, k, v, sliding_window=None, end=False, complement_sliding_window=False):
        if not end:
            self.local_q = q
            self.local_k = k
            self.local_v = v
        else:
            self.init_q = q
            self.init_k = k
            self.init_v = v
    
    def get_result(self):
        batch_size = self.local_q.size(0)
        num_heads = self.local_q.size(1)
        len_q = self.local_q.size(2)
        dim_head = self.local_q.size(3)
        result = torch.randn(batch_size, num_heads, len_q, dim_head, dtype=self.dtype, device=self.device)
        return result, None

def mock_get_multi_stage_dot_production_attention(fattn):
    return MockAttn, None

# Monkey patch for the test
import sys
current_module = sys.modules[__name__]
original_get = getattr(current_module, 'get_multi_stage_dot_production_attention', None)

# Position bias mock
class MockPositionBias(nn.Module):
    def __init__(self, dim_head, num_heads):
        super().__init__()
        self.dim_head = dim_head
        self.num_heads = num_heads
        self._cos_cached = torch.randn(128, 1, 1, dim_head)
        self._sin_cached = torch.randn(128, 1, 1, dim_head)
    
    def forward(self, h_q, h_k):
        # Apply rotary embeddings
        return h_q, h_k
    
    def apply_rotary_pos_emb_one_angle(self, h_q, angle):
        return h_q
    
    def apply_rotary_pos_emb(self, h_k, start, end, cos_cached, sin_cached):
        return h_k

# Linear 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)

class AttentionOut(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)

# Set up parameters
batch_size = 2
seq_len_q = 3
seq_len_kv = 5
num_heads = 2
num_heads_kv = 2
dim_head = 4
hidden_dim = num_heads * dim_head
kv_hidden_dim = num_heads_kv * dim_head

query = torch.randn(batch_size, seq_len_q, hidden_dim)
key_value = torch.randn(batch_size, seq_len_kv, kv_hidden_dim)

project_q = ProjectionLayer(hidden_dim, hidden_dim)
project_k = ProjectionLayer(kv_hidden_dim, kv_hidden_dim)
project_v = ProjectionLayer(kv_hidden_dim, kv_hidden_dim)
attention_out = AttentionOut(hidden_dim, hidden_dim)

position_bias = MockPositionBias(dim_head, num_heads)

ARGS = {
    'n_local': 2,
    'n_init': 2,
    'fattn': False,
}

# For the inner forward function, we need to bind it to create a callable
# The function returns a forward function, so we create a mock self object
class MockSelf:
    pass

mock_self = MockSelf()

# Create the forward function
def get_multi_stage_dot_production_attention(fattn):
    return MockAttn, None

# We need to inject this into the module namespace so the stream_llm_forward can find it
sys.modules[__name__].get_multi_stage_dot_production_attention = get_multi_stage_dot_production_attention

ARGS = {
    'n_local': 2,
    'n_init': 2,
    'fattn': 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
infinite_lm_forward Not yet run
unverified (harvested, no recorded run)
thunlp/infllm/inf_llm/attention/infinite_lm.py
code served (permissive licence) · get_code("8d4ac5178e695392")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 7 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 7 later) and 5 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
normalize_answer 133 other papers
59 dated earlier, 8 the same month, 65 later, 1 undated · 1 only as an assembly brick
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 130 more not named here
normalize_zh_answer 28 other papers
2 dated earlier, 1 the same month, 23 later, 1 same year, order not determinable, 1 undated
2311.04934 (2023-11)
Prompt Cache: Modular Attention Reuse for Low-Latency Inference
2311.09198 (2023-11)
Never Lost in the Middle: Mastering Long-Context Question Answering with Position-Agnostic Decompositional Training
2024.findings-emnlp.230 (2024 (year only))
CLongEval: A Chinese Benchmark for Evaluating Long-Context Large Language Models
and 25 more not named here
count_score 24 other papers
2 dated earlier, 1 the same month, 20 later, 1 undated
2311.04934 (2023-11)
Prompt Cache: Modular Attention Reuse for Low-Latency Inference
2311.09198 (2023-11)
Never Lost in the Middle: Mastering Long-Context Question Answering with Position-Agnostic Decompositional Training
2402.02750 (2024-02)
KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache
and 21 more not named here
normalize_answer 5 other papers
5 later
2406.07528 (2024-06)
QuickLLaMA: Query-aware Inference Acceleration for Large Language Models
2407.09450 (2024-07)
Human-inspired Episodic Memory for Infinite Context LLMs
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
4 later
2406.07528 (2024-06)
QuickLLaMA: Query-aware Inference Acceleration for Large Language Models
2407.09450 (2024-07)
Human-inspired Episodic Memory for Infinite Context LLMs
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 later
2406.07528 (2024-06)
QuickLLaMA: Query-aware Inference Acceleration for Large Language Models
2407.09450 (2024-07)
Human-inspired Episodic Memory for Infinite Context LLMs
build_chat 1 other paper
1 later
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-23.

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 emerged as a cornerstone in real-world applications with lengthy streaming inputs (e.g., LLM-driven agents). However, existing LLMs, pre-trained on sequences with a restricted maximum length, cannot process longer sequences due to the out-of-domain and distraction issues. Common solutions often involve continual pre-training on longer sequences, which will introduce expensive computational overhead and uncontrollable change in model capabilities. In this paper, we unveil the intrinsic capacity of LLMs for understanding extremely long sequences without any fine-tuning. To this end, we introduce a training-free memory-based method, InfLLM. Specifically, InfLLM stores distant contexts into additional memory units and employs an efficient mechanism to lookup token-relevant units for attention computation. Thereby, InfLLM allows LLMs to efficiently process long sequences with a limited context window and well capture long-distance dependencies. Without any training, InfLLM enables LLMs that are pre-trained on sequences consisting of a few thousand tokens to achieve comparable performance with competitive baselines that continually train these LLMs on long sequences. Even when the sequence length is scaled to $1,024$K, InfLLM still effectively captures long-distance dependencies. Our code can be found in \url{https://github.com/thunlp/InfLLM}.

For agents

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

get_harvested_code_for_paper("2402.04617")
get_code_for_paper("2402.04617")
have("2402.04617")

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

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

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

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

Connect an agent — have() is free.