SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.02750 · 2024

KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache

arXiv · PDF · Open in the Atlas

Code that ran

15 of 18 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 11 failures of our instrument; 3 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/2402.02750.json · badge: /api/ran/2402.02750.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
jy-yuan/kivi canonical (classifier label)
classifier basis: census
15 ran · 3 no recorded run
FunctionStatusWhere it lives
build_chat Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jy-yuan/kivi/pred_long_bench.py
code served (permissive licence) · get_code("ef82bf5af4441329")
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
from unittest.mock import Mock

# Create a minimal tokenizer mock that implements apply_chat_template
class MockTokenizer:
    def apply_chat_template(self, messages, tokenize=False, add_generation_prompt=False):
        # Simple implementation: concatenate message contents
        result = ""
        for msg in messages:
            result += msg['content']
        if add_generation_prompt:
            result += " [ASSISTANT]"
        return result

# Create a minimal tokenizer instance
tokenizer = MockTokenizer()

# Define test prompts
prompt = "Hello, how are you?"

# Define test model names that will exercise different branches
model_name = "llama-3-instruct"

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
fastchat, 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
calculate_zeros_width Ran
ran, honoured the contract we drafted
jy-yuan/kivi/quant/qmodule.py
code served (permissive licence) · get_code("fd8719af3db2c5ae")
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)

# Analyze the function:
# calculate_zeros_width takes:
# - in_features: an integer (used in arithmetic operations)
# - group_size: an integer with default 128 (used in conditionals and arithmetic)
# - pack_num: an integer with default 8 (used in arithmetic)
# 
# The function performs integer arithmetic and conditional logic.
# No objects or methods are called, just arithmetic operations.

ARGS = {
    "in_features": 256,
    "group_size": 128,
    "pack_num": 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
count_score Ran
ran, honoured the contract we drafted
jy-yuan/kivi/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.

dequant_weight Ran
ran; our contract draft was wrong, not the code
jy-yuan/kivi/quant/gemv.py
code served (permissive licence) · get_code("a9baefdb784da628")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (4, 6) 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 torch.nn as nn

torch.manual_seed(0)

# Analyze the function:
# - w: tensor that supports .half(), .view(), and has .shape attribute
# - scale: tensor that supports .unsqueeze(-1) and multiplication
# - mn: tensor that supports .unsqueeze(-1) and addition
# - gs: integer used for division and indexing

# The function does:
# 1. w.half().view(w.shape[0], w.shape[1] // gs, gs)
#    So w needs shape (d0, d1) where d1 is divisible by gs
# 2. w_fp * scale.unsqueeze(-1) + mn.unsqueeze(-1)
#    After first view, w_fp has shape (d0, d1//gs, gs)
#    So scale and mn should have shape (d0, d1//gs) to broadcast correctly

# Create tensors with distinct sizes for clarity
gs = 2
w = torch.randint(0, 256, (4, 6), dtype=torch.uint8)  # shape: (4, 6), 6 divisible by gs=2
scale = torch.randn(4, 3)  # shape: (4, 3) where 3 = 6//2
mn = torch.randn(4, 3)     # shape: (4, 3)

ARGS = {
    "w": w,
    "scale": scale,
    "mn": mn,
    "gs": gs,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (4, 6) — shape (4, 6) 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
dequant_weight_outer Ran
ran; our contract draft was wrong, not the code
jy-yuan/kivi/quant/gemv.py
code served (permissive licence) · get_code("4d4c20e8d1e678ef")
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
import torch.nn as nn

torch.manual_seed(0)

# Analyze the function:
# - w: tensor with shape (w.shape[0], w.shape[1], w.shape[2])
#   gets reshaped to (w.shape[0], w.shape[1], w.shape[2] // gs, gs)
#   so w.shape[2] must be divisible by gs
# - scale: tensor that gets unsqueezed and multiplied with w_fp
#   should have shape compatible with (w.shape[0], w.shape[1], w.shape[2] // gs)
# - mn: tensor that gets unsqueezed and added to w_fp
#   should have shape compatible with (w.shape[0], w.shape[1], w.shape[2] // gs)
# - gs: scalar (group size)

# Let's set up small tensors with distinct dimensions
gs = 2

# w needs shape (d0, d1, d2) where d2 is divisible by gs
# Using distinct sizes: 2, 3, 4
d0, d1, d2 = 2, 3, 4

w = torch.randint(0, 256, (d0, d1, d2), dtype=torch.uint8)

# scale and mn should have shape (d0, d1, d2 // gs) = (2, 3, 2)
scale = torch.randn(d0, d1, d2 // gs)
mn = torch.randn(d0, d1, d2 // gs)

ARGS = {
    "w": w,
    "scale": scale,
    "mn": mn,
    "gs": gs,
}
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
make_divisible Ran
ran, honoured the contract we drafted
jy-yuan/kivi/quant/qmodule.py
code served (permissive licence) · get_code("ad85b288e9acb9c2")
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

ARGS = {
    "c": 10,
    "divisor": 3
}
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 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
normalize_answer Ran
ran; our contract draft was wrong, not the code
jy-yuan/kivi/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_zh_answer Ran
ran; our contract draft was wrong, not the code
jy-yuan/kivi/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.

parse_args Ran
ran; our contract draft was wrong, not the code
jy-yuan/kivi/eval_long_bench.py
code served (permissive licence) · get_code("ca066a4c088c8cf5")
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 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

def parse_args(args=None):
    parser = argparse.ArgumentParser()
    parser.add_argument('--model', type=str, default=None)
    parser.add_argument('--e', action='store_true', help='Evaluate on LongBench-E')
    return parser.parse_args(args)

# Setup code to construct valid arguments
ARGS = {
    'args': ['--model', 'bert-base-uncased', '--e']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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
jy-yuan/kivi/pred_long_bench.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
process_input Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jy-yuan/kivi/models/utils_quant.py
code served (permissive licence) · get_code("d54a29178ce3203f")
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 a small input tensor: batch_size=2, with some spatial dimensions (4x3)
input = torch.randn(2, 4, 3)

# Set group_size to a value that divides evenly into the flattened dimension
# Flattened shape will be (2, 12), so group_size=4 works well
group_size = 4

ARGS = {
    "input": input,
    "group_size": group_size,
}
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
quant_and_pack_kcache Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jy-yuan/kivi/quant/new_pack.py
code served (permissive licence) · get_code("901a3668958c9deb")
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 a small k tensor with shape (B, nh, T, D)
# B=2 (batch), nh=3 (num heads), T=8 (sequence length), D=4 (dimension)
k = torch.randn(2, 3, 8, 4)

# group_size must divide T
group_size = 4

# bits must be in [2, 4, 8]
bits = 4

ARGS = {
    "k": k,
    "group_size": group_size,
    "bits": bits,
}
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
quant_and_pack_vcache Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jy-yuan/kivi/quant/new_pack.py
code served (permissive licence) · get_code("95a9c97f6ea7d050")
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 a small 4D tensor for v parameter
# Shape: (batch=2, seq=3, head=4, dim=8)
v = torch.randn(2, 3, 4, 8, dtype=torch.float32)

# group_size must divide the last dimension (8)
# Valid choices: 1, 2, 4, 8
group_size = 2

# bits must be in [2, 4, 8]
bits = 4

ARGS = {
    "v": v,
    "group_size": group_size,
    "bits": bits,
}
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
quantize_and_pack Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jy-yuan/kivi/models/utils_quant.py
code served (permissive licence) · get_code("4ed267d57146753e")
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. 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 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 small input tensor: batch_size=2, spatial dims that flatten to 12 features
# This will be reshaped to (2, 12)
input_tensor = torch.randn(2, 3, 4)

# Parameters for the function
group_size = 4
bits = 8
simulate = True

ARGS = {
    "data": input_tensor,
    "group_size": group_size,
    "bits": bits,
    "simulate": simulate
}
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
repeat_kv_quant Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jy-yuan/kivi/models/mistral_kivi.py
pointer only (licence: MIT); the stored copy get_code serves, from sail-sg/simlayerkv, is pointer only (licence: NONE) · get_code("fa013be990ccedab")
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 sail-sg/simlayerkv, 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.

dequantize_and_unpack Not yet run
unverified (harvested, no recorded run)
jy-yuan/kivi/models/utils_quant.py
code served (permissive licence) · get_code("1297b7d82f48928d")
How it ran

no invocation recorded.

get_pred Not yet run
unverified (harvested, no recorded run)
jy-yuan/kivi/pred_long_bench.py
code served (permissive licence) · get_code("1b63810f36de324d")
How it ran

no invocation recorded.

unpack_and_dequant_kcache Not yet run
unverified (harvested, no recorded run)
jy-yuan/kivi/quant/new_pack.py
code served (permissive licence) · get_code("e493c68ae46ac587")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 13 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 5 the same month, 13 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.04617 (2024-02)
InfLLM: Training-Free Long-Context Extrapolation for LLMs with an Efficient Context Memory
and 21 more not named here
post_process 14 other papers
1 dated earlier, 13 later
2311.09198 (2023-11)
Never Lost in the Middle: Mastering Long-Context Question Answering with Position-Agnostic Decompositional Training
2404.14469 (2024-04)
SnapKV: LLM Knows What You are Looking for Before Generation
2405.04434 (2024-05)
DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model
and 11 more not named here
calculate_zeros_width 3 other papers
1 the same month, 2 later
2402.10631 (2024-02)
BitDistiller: Unleashing the Potential of Sub-4-Bit LLMs via Self-Distillation
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM
make_divisible 3 other papers
1 the same month, 2 later
2402.10631 (2024-02)
BitDistiller: Unleashing the Potential of Sub-4-Bit LLMs via Self-Distillation
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM
parse_args 3 other papers
3 later
2406.03482 (2024-06)
QJL: 1-Bit Quantized JL Transform for KV Cache Quantization with Zero Overhead
2409.12181 (2024-09)
A Controlled Study on Long Context Extension and Generalization in LLMs
2505.22913 (2025-05)
MUSTAFAR: Promoting Unstructured Sparsity for KV Cache Pruning in LLM Inference
repeat_kv_quant 2 other papers
2 later
2406.03482 (2024-06)
QJL: 1-Bit Quantized JL Transform for KV Cache Quantization with Zero Overhead
2410.13846 (2024-10)
LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptation
dequant_weight 1 other paper
1 later
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM
dequant_weight_outer 1 other paper
1 later
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM
quant_and_pack_kcache 1 other paper
1 later
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM
quant_and_pack_vcache 1 other paper
1 later
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM
unpack_and_dequant_kcache 1 other paper
1 later
2403.05527 (2024-03)
GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM

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

Efficiently serving large language models (LLMs) requires batching of many requests to reduce the cost per request. Yet, with larger batch sizes and longer context lengths, the key-value (KV) cache, which stores attention keys and values to avoid re-computations, significantly increases memory demands and becomes the new bottleneck in speed and memory usage. Additionally, the loading of the KV cache causes the computational core to be idle, which limits the inference speed. A straightforward and effective solution to reduce KV cache size is quantization, which decreases the total bytes taken by KV cache. However, there is a lack of in-depth studies that explore the element distribution of KV cache to understand the hardness and limitation of KV cache quantization. To fill the gap, we conducted a comprehensive study on the element distribution in KV cache of popular LLMs. Our findings indicate that the key cache should be quantized per-channel, i.e., group elements along the channel dimension and quantize them together. In contrast, the value cache should be quantized per-token. From this analysis, we developed a tuning-free 2bit KV cache quantization algorithm named KIVI. With hardware-friendly implementation, KIVI can enable Llama, Falcon, and Mistral models to maintain almost the same quality while using $\mathbf{2.6\times}$ less peak memory (including model weight). This reduction in memory usage enables up to $\mathbf{4\times}$ larger batch size, bringing $\mathbf{2.35\times \sim 3.47\times}$ throughput on real LLM inference workload. The source code is available at https://github.com/jy-yuan/KIVI.

For agents

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

get_harvested_code_for_paper("2402.02750")
get_code_for_paper("2402.02750")
have("2402.02750")

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

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

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

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

Connect an agent — have() is free.