SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.02069 · 2024

PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funneling

arXiv · PDF · Open in the Atlas

Code that ran

14 of 15 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; 2 honoured the contract we drafted, 3 violated it and 0 have no contract verdict; 9 failures of our instrument; 1 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/2406.02069.json · badge: /api/ran/2406.02069.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
zefan-cai/pyramidkv canonical (classifier label)
classifier basis: census
13 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
repeat_kv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zefan-cai/pyramidkv/pyramidkv/pyramidkv_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
build_stop_token_ids Ran
ran, honoured the contract we drafted
zefan-cai/pyramidkv/pyramidkv/eval_utils.py
code served (permissive licence) · get_code("6856f796db256e0a")
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 int; 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 as nn
from transformers import PretrainedConfig

torch.manual_seed(0)

# Create a minimal model with generation_config
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.generation_config = PretrainedConfig()
        # Set eos_token_id as a list to test the list/tuple case
        self.generation_config.eos_token_id = [2, 3]
    
    def forward(self, x):
        return x

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.eos_token_id = 2
        self.unk_token_id = 0
        self._token_map = {
            '<|eot_id|>': 4,
            '<|end_of_text|>': 5
        }
    
    def convert_tokens_to_ids(self, token):
        """Convert a token string to its id, or return None if not found."""
        return self._token_map.get(token, None)

model = MinimalModel()
tokenizer = MinimalTokenizer()

ARGS = {
    'model': model,
    'tokenizer': tokenizer
}
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 list, ndim 1, dtype family int — 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
compress_minicache_pair Ran
ran; our contract draft was wrong, not the code
zefan-cai/pyramidkv/pyramidkv/minicache.py
code served (permissive licence) · get_code("042f3baac334e2d7")
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 math

torch.manual_seed(0)

# Create tiny test tensors
# Shape: [batch=2, heads=3, seq_len=4, head_dim=5]
batch_size = 2
num_heads = 3
seq_len = 4
head_dim = 5

current_states = torch.randn(batch_size, num_heads, seq_len, head_dim)
previous_states = torch.randn(batch_size, num_heads, seq_len, head_dim)

ARGS = {
    'current_states': current_states,
    'previous_states': previous_states,
    'interpolation': 0.6,
    'retention_ratio': 0.05,
    'retention_count': None,
    'eps': 1e-6,
}
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
create_window_attention_mask Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from answerdotai/cold-compress
pointer only · get_code("472d821ef38be37d")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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_headwise_projections Ran
ran; our contract draft was wrong, not the code
zefan-cai/pyramidkv/pyramidkv/headinfer.py
code served (permissive licence) · get_code("50463bb67a0214ae")
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 MockAttentionModule(nn.Module):
    def __init__(self, hidden_dim=16, num_heads=8, num_key_value_heads=2, head_dim=2):
        super().__init__()
        self.hidden_dim = hidden_dim
        self.num_heads = num_heads
        self.num_key_value_heads = num_key_value_heads
        self.head_dim = head_dim
        
        # Query projection: outputs num_heads * head_dim features
        self.q_proj = nn.Linear(hidden_dim, num_heads * head_dim)
        
        # Key projection: outputs num_key_value_heads * head_dim features
        self.k_proj = nn.Linear(hidden_dim, num_key_value_heads * head_dim)
        
        # Value projection: outputs num_key_value_heads * head_dim features
        self.v_proj = nn.Linear(hidden_dim, num_key_value_heads * head_dim)

module = MockAttentionModule(
    hidden_dim=16,
    num_heads=8,
    num_key_value_heads=2,
    head_dim=2
)

ARGS = {
    'module': module
}
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
headinfer_slot Ran
ran, honoured the contract we drafted
zefan-cai/pyramidkv/pyramidkv/headinfer.py
code served (permissive licence) · get_code("ad54d3a439b1ed31")
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 int, ndim 0, dtype family int, shape () 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
import numpy as np

torch.manual_seed(0)

ARGS = {
    "layer_idx": 0,
    "kv_head_idx": 2,
    "num_key_value_heads": 8,
}
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 int, ndim 0, dtype family int, shape () — shape () 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
is_empty_past_key_values Ran
ran, violated the contract we drafted
zefan-cai/pyramidkv/pyramidkv/generation_state.py
code served (permissive licence) · get_code("4fd25dca7e4d0ba3")
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 bool, ndim 0, dtype family float, shape () 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
import numpy as np

torch.manual_seed(0)

# Test case 1: None past_key_values
past_key_values_none = None

# Test case 2: Cache object with empty key_cache
class MockCache:
    def __init__(self, key_cache):
        self.key_cache = key_cache

past_key_values_cache_empty = MockCache(key_cache=[])

# Test case 3: Cache object with non-empty key_cache
past_key_values_cache_nonempty = MockCache(key_cache=[torch.randn(2, 4)])

# Test case 4: Empty tuple (legacy layout)
past_key_values_tuple_empty = ()

# Test case 5: Non-empty tuple (legacy layout)
past_key_values_tuple_nonempty = (torch.randn(2, 4), torch.randn(2, 4))

# Use the None case as the primary test case
ARGS = {
    "past_key_values": past_key_values_none
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
key_pruner_query_driven Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zefan-cai/pyramidkv/pyramidkv/pyramidkv_utils.py
code served (permissive licence) · get_code("3597e5670a759378")
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 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)

# kv_states: shape (batch, num_heads, seqlen, head_dim)
# q_states: shape (batch, num_heads, seqlen, head_dim)
# recent_size: int, default 128
# ratio: float, default 0.3

batch_size = 2
num_heads = 3
seqlen = 160
head_dim = 4

kv_states = torch.randn(batch_size, num_heads, seqlen, head_dim)
q_states = torch.randn(batch_size, num_heads, seqlen, head_dim)
recent_size = 128
ratio = 0.3

ARGS = {
    "kv_states": kv_states,
    "q_states": q_states,
    "recent_size": recent_size,
    "ratio": ratio,
}
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 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
maybe_repeat_kv_before_cache Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zefan-cai/pyramidkv/pyramidkv/pyramidkv_utils.py
code served (permissive licence) · get_code("6211e835b472f7ad")
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 tuple, ndim 5, 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)

# Create a minimal config class with kv_cache_granularity attribute
class MinimalConfig:
    def __init__(self, kv_cache_granularity='query_head'):
        self.kv_cache_granularity = kv_cache_granularity

# Create test tensors
# Shape: (batch, num_key_value_heads, seqlen, head_dim)
batch = 2
num_key_value_heads = 3
seqlen = 4
head_dim = 5

key_states = torch.randn(batch, num_key_value_heads, seqlen, head_dim)
value_states = torch.randn(batch, num_key_value_heads, seqlen, head_dim)

# num_key_value_groups is the repetition factor
num_key_value_groups = 2

# Create config with default 'query_head' granularity
config = MinimalConfig(kv_cache_granularity='query_head')

ARGS = {
    'config': config,
    'key_states': key_states,
    'value_states': value_states,
    'num_key_value_groups': num_key_value_groups
}
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 tuple, ndim 5, 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
minicache_slerp Ran
ran; our contract draft was wrong, not the code
zefan-cai/pyramidkv/pyramidkv/minicache.py
code served (permissive licence) · get_code("dbe56944ebe0f117")
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)

# Create small tensors with shape [batch, heads, seq_len, head_dim]
batch_size = 2
num_heads = 3
seq_len = 4
head_dim = 5

current_states = torch.randn(batch_size, num_heads, seq_len, head_dim)
previous_states = torch.randn(batch_size, num_heads, seq_len, head_dim)

ARGS = {
    'current_states': current_states,
    'previous_states': previous_states,
    'interpolation': 0.6,
    'eps': 1e-06,
}
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
reduce_nacl_proxy_scores Ran
ran; our contract draft was wrong, not the code
zefan-cai/pyramidkv/pyramidkv/nacl.py
code served (permissive licence) · get_code("b453a87c0268a786")
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 3, dtype family float, shape (2, 3, 4) 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)

# Case 1: 4D attention scores with proxy_indices
attn_scores_4d = torch.randn(2, 3, 5, 4)  # [batch=2, heads=3, query=5, key=4]
proxy_indices = torch.tensor([0, 2, 4], dtype=torch.long)  # Select 3 proxy positions

ARGS = {
    "attn_scores": attn_scores_4d,
    "proxy_indices": proxy_indices,
}
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
select_minicache_retention_indices Ran
ran; our contract draft was wrong, not the code
zefan-cai/pyramidkv/pyramidkv/minicache.py
code served (permissive licence) · get_code("0753fefeac56ae68")
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 3, dtype family int, shape (2, 3, 1) 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
import math

torch.manual_seed(0)

# Create a small angular_distance tensor with shape [batch, heads, seq_len]
# Using distinct sizes: batch=2, heads=3, seq_len=4
angular_distance = torch.rand(2, 3, 4)

# Test with default retention_ratio
retention_ratio = 0.05
retention_count = None

ARGS = {
    "angular_distance": angular_distance,
    "retention_ratio": retention_ratio,
    "retention_count": retention_count,
}
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 3, dtype family int, shape (2, 3, 1) — shape (2, 3, 1) 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
select_nacl_tokens Ran
ran; our contract draft was wrong, not the code
zefan-cai/pyramidkv/pyramidkv/nacl.py
code served (permissive licence) · get_code("6aa8f85d4f403b46")
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 3, dtype family int, shape (2, 3, 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)

# Construct minimal valid arguments for select_nacl_tokens
# attn_scores: shape [batch, heads, query, key] - raw attention scores
batch_size = 2
num_heads = 3
query_len = 4
key_len = 5

attn_scores = torch.randn(batch_size, num_heads, query_len, key_len)

# token_budget: positive integer, must be less than key_len
token_budget = 3

# proxy_indices: optional tensor of query positions to use as proxy tokens
# If None, all query positions are used
proxy_indices = torch.tensor([0, 2], dtype=torch.long)

# protected_indices: optional tensor of key indices that must be retained
# These are always kept in the selection
protected_indices = torch.tensor([0, 4], dtype=torch.long)

# random_budget: non-negative integer for random sampling
random_budget = 1

# generator: optional torch.Generator for reproducibility
generator = torch.Generator()
generator.manual_seed(42)

# random_temperature: float controlling randomness in sampling
random_temperature = 1.0

ARGS = {
    'attn_scores': attn_scores,
    'token_budget': token_budget,
    'proxy_indices': proxy_indices,
    'protected_indices': protected_indices,
    'random_budget': random_budget,
    'generator': generator,
    'random_temperature': random_temperature,
}
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 3, dtype family int, shape (2, 3, 3) — shape (2, 3, 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
str2bool Ran
ran, violated the contract we drafted
zefan-cai/pyramidkv/pyramidkv/eval_utils.py
code served (permissive licence) · get_code("d291b649166e280d")
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 bool, ndim 0, dtype family float, shape () 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 argparse

def str2bool(value):
    if isinstance(value, bool):
        return value
    if value.lower() in ('true', '1'):
        return True
    if value.lower() in ('false', '0'):
        return False
    raise argparse.ArgumentTypeError(f'Expected true/false/1/0, got {value!r}')

# Test cases for the str2bool function
ARGS = {
    'value': 'true'
}
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 bool, ndim 0, dtype family float, shape () — shape () 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
select_nacl_proxy_indices Not yet run
unverified (harvested, no recorded run)
zefan-cai/pyramidkv/pyramidkv/nacl.py
code served (permissive licence) · get_code("554279ac03f73d79")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 4 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 3 later) and 11 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
79 dated earlier, 16 the same month, 144 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
create_window_attention_mask 3 other papers
3 dated earlier
2305.17118 (2023-05)
Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Time
2306.14048 (2023-06)
H$_2$O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models
2310.01801 (2023-10)
Model Tells You What to Discard: Adaptive KV Cache Compression for LLMs
key_pruner_query_driven 2 other papers
2 later
2505.23416 (2025-05)
KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction
2506.08373 (2025-06)
Draft-based Approximate Inference for LLMs
maybe_repeat_kv_before_cache 2 other papers
2 later
2505.23416 (2025-05)
KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction
2506.08373 (2025-06)
Draft-based Approximate Inference for LLMs

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

In this study, we investigate whether attention-based information flow inside large language models (LLMs) is aggregated through noticeable patterns for long context processing. Our observations reveal that LLMs aggregate information through Pyramidal Information Funneling where attention is scattering widely in lower layers, progressively consolidating within specific contexts, and ultimately focusing on critical tokens (a.k.a massive activation or attention sink) in higher layers. Motivated by these insights, we developed PyramidKV, a novel and effective KV cache compression method. This approach dynamically adjusts the KV cache size across different layers, allocating more cache in lower layers and less in higher ones, diverging from traditional methods that maintain a uniform KV cache size. Our experimental evaluations, utilizing the LongBench benchmark, show that PyramidKV matches the performance of models with a full KV cache while retaining only 12% of the KV cache, thus significantly reducing memory usage. In scenarios emphasizing memory efficiency, where only 0.7% of the KV cache is maintained, PyramidKV surpasses other KV cache compression techniques, achieving up to a 20.5 absolute accuracy improvement on TREC dataset. In the Needle-in-a-Haystack experiment, PyramidKV outperforms competing methods in maintaining long-context comprehension in LLMs; notably, retaining just 128 KV cache entries enables the LLAMA-3-70B model to achieve 100.0 Acc. performance.

For agents

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

get_harvested_code_for_paper("2406.02069")
get_code_for_paper("2406.02069")
have("2406.02069")

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

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

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

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

Connect an agent — have() is free.