SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.17422 · 2024

Discovering the Gems in Early Layers: Accelerating Long-Context LLMs with 1000x Input Token Reduction

arXiv · PDF · Open in the Atlas

Code that ran

13 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; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 11 failures of our instrument; 0 no recorded run), 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/2409.17422.json · badge: /api/ran/2409.17422.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
salesforceairesearch/gemfilter canonical (classifier label)
classifier basis: census
13 ran · 0 no recorded run
FunctionStatusWhere it lives
build_chat Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/eval/LongBench/pred.py
code served (permissive licence) · get_code("8339145374a403f3")
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 torch
import torch.nn as nn

class MockTokenizer:
    def build_chat_input(self, prompt):
        return f"[ChatGLM3]{prompt}[/ChatGLM3]"
    
    def build_prompt(self, prompt):
        return f"[ChatGLM]{prompt}[/ChatGLM]"

tokenizer = MockTokenizer()
prompt = "Hello, how are you?"
model_name = "chatglm3"

ARGS = {
    "tokenizer": tokenizer,
    "prompt": prompt,
    "model_name": model_name
}
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 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
count_score Ran
ran, honoured the contract we drafted
salesforceairesearch/gemfilter/eval/LongBench/metrics.py
pointer only (licence: Apache-2.0); 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 (Apache-2.0), 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.

get_layer_context Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/my_utils/my_generation.py
code served (permissive licence) · get_code("8023b20549593b60")
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 int, shape (1, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def decode(self, token_ids):
        return f"decoded_{token_ids.tolist()}"

# Create a minimal self-attention module with indecies attribute
class MinimalSelfAttention(nn.Module):
    def __init__(self):
        super().__init__()
        # indecies should be a tensor of shape [1, 1, seq_len]
        # containing indices into the input_ids
        self.indecies = torch.tensor([[[0, 2, 1, 3]]], dtype=torch.long)
    
    def forward(self, x):
        return x

# Create a minimal decoder layer
class MinimalDecoderLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.self_attn = MinimalSelfAttention()
    
    def forward(self, x):
        return x

# Create a minimal model
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = nn.Module()
        self.model.layers = nn.ModuleList([MinimalDecoderLayer()])
    
    def forward(self, x):
        return x

# Instantiate the model
model = MinimalModel()

# Create tokenizer
tokenizer = MinimalTokenizer()

# Create input_ids tensor (shape: [seq_len])
# Must have at least 4 elements to match the indices in self_attn.indecies
input_ids = torch.tensor([10, 20, 30, 40], dtype=torch.long)

# Layer index
layer_idx = 0

# Assemble ARGS dict
ARGS = {
    "model": model,
    "tokenizer": tokenizer,
    "input_ids": input_ids,
    "layer_idx": layer_idx,
    "print_context": 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 Tensor, ndim 2, dtype family int, shape (1, 4) — shape (1, 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
insert_needle Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/eval/needle/utils.py
code served (permissive licence) · get_code("ce3c4802be48b9d2")
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 torch
import numpy as np

def insert_needle(context, needle, depth):
    context = context.split('.')
    c_len = len(context)
    needle_place = int(depth * c_len)
    context = '.'.join(context[:needle_place]) + '.' + needle + '.'.join(context[needle_place:])
    return context

ARGS = {
    'context': 'the.quick.brown.fox.jumps',
    'needle': 'NEEDLE',
    'depth': 0.4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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
load_context Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/eval/needle/utils.py
code served (permissive licence) · get_code("6af3fc7115dbdfad")
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 tempfile
import os

# Create temporary directory with test files
temp_dir = tempfile.mkdtemp()

# Create some test text files
test_content_1 = "This is the first test file. " * 1000
test_content_2 = "This is the second test file. " * 1000

file1 = os.path.join(temp_dir, "essay1.txt")
file2 = os.path.join(temp_dir, "essay2.txt")

with open(file1, 'w') as f:
    f.write(test_content_1)

with open(file2, 'w') as f:
    f.write(test_content_2)

# Define the arguments
ARGS = {
    'fpath': os.path.join(temp_dir, '*.txt'),
    'ctx_len': 100000
}
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
my_forward Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/my_utils/load_model.py
code served (permissive licence) · get_code("74f9afa035c0616b")
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.cache_utils import Cache
from transformers.modeling_outputs import CausalLMOutputWithPast

torch.manual_seed(0)

# Small config stand-in
class Config:
    def __init__(self):
        self.output_attentions = False
        self.output_hidden_states = False
        self.use_return_dict = True
        self.hidden_size = 4
        self.vocab_size = 8

config = Config()

# Small model that mimics the internal self.model
class InnerModel(nn.Module):
    def __init__(self, config):
        super().__init__()
        self.config = config
        self.embedding = nn.Embedding(config.vocab_size, config.hidden_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,
                cache_position=None):
        if input_ids is not None:
            hidden_states = self.embedding(input_ids)
        else:
            hidden_states = inputs_embeds
        
        # Return a mock output object with expected attributes
        class ModelOutput:
            def __init__(self, hidden_states):
                self.hidden_states = hidden_states
                self.past_key_values = None
                self.attentions = None
            
            def __getitem__(self, idx):
                if idx == 0:
                    return self.hidden_states
                return None
        
        return ModelOutput(hidden_states)

# Main model class with self.model and self.lm_head
class MyModel(nn.Module):
    def __init__(self, config):
        super().__init__()
        self.config = config
        self.model = InnerModel(config)
        self.lm_head = nn.Linear(config.hidden_size, config.vocab_size)
    
    def forward(self, input_ids=None, attention_mask=None, position_ids=None,
                past_key_values=None, inputs_embeds=None, labels=None,
                use_cache=None, output_attentions=None, output_hidden_states=None,
                return_dict=None, cache_position=None, output_last_logits_only=False):
        # This is the original my_forward function
        output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
        output_hidden_states = output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
        return_dict = return_dict if return_dict is not None else self.config.use_return_dict
        outputs = self.model(input_ids=input_ids, attention_mask=attention_mask, position_ids=position_ids, past_key_values=past_key_values, inputs_embeds=inputs_embeds, use_cache=use_cache, output_attentions=output_attentions, output_hidden_states=output_hidden_states, return_dict=return_dict, cache_position=cache_position)
        hidden_states = outputs[0]
        if output_last_logits_only:
            logits = self.lm_head(hidden_states[:, -1:, :])
        else:
            logits = self.lm_head(hidden_states)
        logits = logits.float()
        loss = None
        if not return_dict:
            output = (logits,) + outputs[1:]
            return (loss,) + output if loss is not None else output
        return CausalLMOutputWithPast(loss=loss, logits=logits, past_key_values=outputs.past_key_values, hidden_states=outputs.hidden_states, attentions=outputs.attentions)

model = MyModel(config)

# Construct ARGS
ARGS = {
    'self': model,
    'input_ids': torch.randint(0, config.vocab_size, (2, 5), dtype=torch.long),
    'attention_mask': torch.ones((2, 5), dtype=torch.long),
    'position_ids': torch.arange(5, dtype=torch.long).unsqueeze(0).expand(2, -1),
    'past_key_values': None,
    'inputs_embeds': None,
    'labels': torch.randint(0, config.vocab_size, (2, 5), dtype=torch.long),
    'use_cache': False,
    'output_attentions': False,
    'output_hidden_states': False,
    'return_dict': True,
    'cache_position': None,
    'output_last_logits_only': False,
}
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
normalize_answer Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/eval/LongBench/metrics.py
pointer only (licence: Apache-2.0); 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 (Apache-2.0), 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
salesforceairesearch/gemfilter/eval/LongBench/metrics.py
pointer only (licence: Apache-2.0); 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 (Apache-2.0), 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.

parse_args Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/eval/LongBench/pred.py
code served (permissive licence) · get_code("7e76d6613e17885d")
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 Namespace. 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 argparse
import torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    'args': [
        '--model', 'llama-3.1-8b-instruct',
        '--e',
        '--topk', '128',
        '--select_layer_idx', '16'
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
post_process Ran
ran, violated the contract we drafted
salesforceairesearch/gemfilter/eval/LongBench/pred.py
code served (permissive licence) · get_code("4489113b536ca6eb")
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) 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 torch
import numpy as np

torch.manual_seed(0)

# The function post_process takes two parameters:
# 1. response: a string that gets processed based on model_name
# 2. model_name: a string used to determine which processing branch to take

# Test case 1: xgen model
response_xgen = "Some response text\nAssistant: This is the assistant response"
model_name_xgen = "xgen-7b"

# Test case 2: internlm model
response_internlm = "Some response<eoa>This should be removed"
model_name_internlm = "internlm-chat"

# Test case 3: other model (no special processing)
response_other = "Just a regular response"
model_name_other = "gpt2"

# We'll use the xgen case as the primary test
ARGS = {
    "response": "Some response text\nAssistant: This is the assistant response",
    "model_name": "xgen-7b"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — 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
recover_layer Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/my_utils/my_generation.py
code served (permissive licence) · get_code("7492f636f610e78b")
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 ModelWrapper. 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)

class SimpleLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layers = nn.ModuleList([SimpleLayer(), SimpleLayer()])
    
    def forward(self, x):
        for layer in self.layers:
            x = layer(x)
        return x

class ModelWrapper(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = SimpleModel()
    
    def forward(self, x):
        return self.model(x)

# Create model and wrapper
model = ModelWrapper()

# Create new layers to recover
new_layers = nn.ModuleList([SimpleLayer(), SimpleLayer(), SimpleLayer()])

ARGS = {
    "model": model,
    "layers": new_layers
}
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 ModelWrapper — a ModelWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModelWrapper 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
reduce_layer Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/my_utils/my_generation.py
code served (permissive licence) · get_code("9fbfc530cceb902f")
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
import torch.nn as nn

torch.manual_seed(0)

class SimpleLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layers = nn.ModuleList([
            SimpleLayer(),
            SimpleLayer(),
            SimpleLayer(),
            SimpleLayer(),
        ])
    
    def forward(self, x):
        for layer in self.layers:
            x = layer(x)
        return x

class ModelWrapper(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = SimpleModel()
    
    def forward(self, x):
        return self.model(x)

model = ModelWrapper()
layer_idx = 2

ARGS = {
    "model": model,
    "layer_idx": layer_idx,
}
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
standard_dis_index Ran
ran; our contract draft was wrong, not the code
salesforceairesearch/gemfilter/my_baseline/GemFilter/gem_filter_utils.py
code served (permissive licence) · get_code("1d164ab515de6ff5")
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 4, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Construct tensors with distinct dimensions
# data: (batch, heads, seq_len, dim)
data = torch.randn(2, 3, 4, 5)

# queries: (batch, heads, 1, dim) - note the 1 in dim 2 which gets selected with [:, :, 0, :]
queries = torch.randn(2, 3, 1, 5)

# k: number of top elements to retrieve
k = 2

# norm: normalization factor for distances
norm = 2

# pool: whether to apply average pooling
pool = True

# kernel_size: kernel size for pooling
kernel_size = 5

# sum_over_heads: whether to sum over heads dimension
sum_over_heads = False

ARGS = {
    "data": data,
    "queries": queries,
    "k": k,
    "norm": norm,
    "pool": pool,
    "kernel_size": kernel_size,
    "sum_over_heads": sum_over_heads,
}
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 4, 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

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, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 3 the same month, 4 later) and 7 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
90 dated earlier, 2 the same month, 40 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
14 dated earlier, 2 the same month, 10 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
12 dated earlier, 1 the same month, 10 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
post_process 14 other papers
6 dated earlier, 8 later
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
2404.14469 (2024-04)
SnapKV: LLM Knows What You are Looking for Before Generation
and 11 more not named here
insert_needle 1 other paper
1 dated earlier
2404.15574 (2024-04)
Retrieval Head Mechanistically Explains Long-Context Factuality
load_context 1 other paper
1 dated earlier
2404.15574 (2024-04)
Retrieval Head Mechanistically Explains Long-Context Factuality

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 demonstrated remarkable capabilities in handling long context inputs, but this comes at the cost of increased computational resources and latency. Our research introduces a novel approach for the long context bottleneck to accelerate LLM inference and reduce GPU memory consumption. Our research demonstrates that LLMs can identify relevant tokens in the early layers before generating answers to a query. Leveraging this insight, we propose an algorithm that uses early layers of an LLM as filters to select and compress input tokens, significantly reducing the context length for subsequent processing. Our method, GemFilter, demonstrates substantial improvements in both speed and memory efficiency compared to existing techniques, such as standard attention and SnapKV/H2O. Notably, it achieves a 2.4$\times$ speedup and 30\% reduction in GPU memory usage compared to SOTA methods. Evaluation on the Needle in a Haystack task shows that GemFilter significantly outperforms standard attention, SnapKV and demonstrates comparable performance on the LongBench challenge. GemFilter is simple, training-free, and broadly applicable across different LLMs. Crucially, it provides interpretability by allowing humans to inspect the selected input sequence. These findings not only offer practical benefits for LLM deployment, but also enhance our understanding of LLM internal mechanisms, paving the way for further optimizations in LLM design and inference. Our code is available at \url{https://github.com/SalesforceAIResearch/GemFilter}.

For agents

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

get_harvested_code_for_paper("2409.17422")
get_code_for_paper("2409.17422")
have("2409.17422")

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

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

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

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

Connect an agent — have() is free.