SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · openreview_XDb69lykA8

xKV: Cross-Layer KV-Cache Compression via Aligned Singular Vector Extraction

Mohamed Abdelfattah, Hung-Yueh Chiang, Huiqiang Jiang, Yucheng Li, Chi-Chih Chang, Kai-Chiang Wu, Wei-Cheng Lin, Chien-Yu Lin, Yash Akhauri, Xilai Dai, Luis Ceze

OpenReview · Open in the Atlas

Code that ran

8 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 1 failure of our instrument; 3 no recorded run), measured 2026-11-24; 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/openreview_XDb69lykA8.json · badge: /api/ran/openreview_XDb69lykA8.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
abdelfattah-lab/xKV canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
fake_minicache_merge Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV/customized_cache/fake_layer_merge_dynamic_cache.py
code served (permissive licence) · get_code("3154e4590daf3135")
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 3, 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 small tensors for X1 and X2
# Shape (L, d) where L=2 (batch size) and d=4 (dimension)
X1 = torch.randn(2, 4)
X2 = torch.randn(2, 4)

# Parameter t: interpolation parameter (default 0.5)
t = 0.5

# Parameter gamma: threshold parameter for divergence (default 0.05)
gamma = 0.05

ARGS = {
    'X1': X1,
    'X2': X2,
    't': t,
    'gamma': gamma,
}
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 3, 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
fake_svd Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV/customized_cache/fake_layer_merge_dynamic_cache.py
code served (permissive licence) · get_code("eef258baafa1402f")
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 4, dtype family float, shape (2, 3, 4, 5) 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)

# Create a small tensor with shape (bs=2, nh=3, sl=4, hd=5)
# bs: batch size, nh: num heads, sl: sequence length, hd: head dimension
tensor = torch.randn(2, 3, 4, 5)

# Set rank to be less than the minimum dimension
rank = 2

# Define a simple quantizer that takes a tensor and returns a quantized version
class SimpleQuantizer(nn.Module):
    def forward(self, x):
        # Simple quantizer that just rounds to nearest 0.1
        return torch.round(x * 10) / 10

quantizer = SimpleQuantizer()

# Build ARGS dict with all parameters
ARGS = {
    "tensor": tensor,
    "rank": rank,
    "apply_hadamard_transform": False,
    "quantizer": quantizer
}
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 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 5) 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
fake_svd Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV_SR/models/kv_cache_xkv.py
code served (permissive licence) · get_code("88866773a7e17f89")
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, 4, 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)

# Create a small 3D tensor (batch_size=2, height=4, width=3)
# This will work with torch.linalg.svd and the subsequent operations
tensor = torch.randn(2, 4, 3)

# Set rank to be smaller than the smallest dimension
rank = 2

ARGS = {
    "tensor": tensor,
    "rank": rank,
}
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, 4, 3) — shape (2, 4, 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
fast_svd Ran
ran; our contract draft was wrong, not the code
abdelfattah-lab/xKV/xKV_SR/models/kv_cache_xkv.py
code served (permissive licence) · get_code("51bd109470f0db84")
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 3D tensor (batch_size=2, rows=4, cols=3)
tensor = torch.randn(2, 4, 3)

# Set rank to be smaller than min(rows, cols)
rank = 2

ARGS = {
    "tensor": tensor,
    "rank": rank,
}
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
generate_consecutive_layer_groups Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV/configurations.py
code served (permissive licence) · get_code("1026d607b70aae7a")
How it ran

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

import torch
import numpy as np
from dataclasses import dataclass, field
from typing import List, Optional, Dict

torch.manual_seed(0)

# Define ARGS for generate_consecutive_layer_groups function
ARGS = {
    "start_layer": 0,
    "end_layer": 11,
    "group_size": 2,
    "stride": 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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_consecutive_layer_groups Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV_SR/models/merge_configs.py
code served (permissive licence) · get_code("f639c8f148537fa1")
How it ran

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

import torch
import numpy as np
from dataclasses import dataclass, field
from typing import List, Optional, Dict

torch.manual_seed(0)

ARGS = {
    "start_layer": 0,
    "end_layer": 11,
    "group_size": 3,
}
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
slerp_merge_rows_batch Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV/customized_cache/fake_layer_merge_dynamic_cache.py
code served (permissive licence) · get_code("e18919fc6dea57f5")
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 distinct dimensions
# X1 and X2 should be (L, d) shaped - using L=2 rows and d=4 dimensions
X1 = torch.randn(2, 4)
X2 = torch.randn(2, 4)

# Scalar parameter for interpolation weight
t = 0.5

# Scalar parameter for threshold computation
gamma = 0.05

ARGS = {
    'X1': X1,
    'X2': X2,
    't': t,
    'gamma': gamma,
}
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
svd Ran
ran on a synthesized input
abdelfattah-lab/xKV/xKV_SR/models/kv_cache_xkv.py
code served (permissive licence) · get_code("2925381d573d90d7")
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 3D tensor (batch_size=2, rows=4, cols=3)
tensor = torch.randn(2, 4, 3)

# Set rank to be less than min(rows, cols)
rank = 2

ARGS = {
    "tensor": tensor,
    "rank": rank,
}
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
generate_consecutive_palu_config Not yet run
unverified (harvested, no recorded run)
abdelfattah-lab/xKV/xKV_SR/models/merge_configs.py
code served (permissive licence) · get_code("43d93818f61c3155")
How it ran

no invocation recorded.

generate_consecutive_xKV_config Not yet run
unverified (harvested, no recorded run)
abdelfattah-lab/xKV/xKV/configurations.py
code served (permissive licence) · get_code("31c69f2bed56c3d2")
How it ran

no invocation recorded.

prepare_cache Not yet run
unverified (harvested, no recorded run)
abdelfattah-lab/xKV/xKV/patch.py
code served (permissive licence) · get_code("572e725e78406157")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 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
fast_svd 1 other paper
1 same year, order not determinable
2503.18893 (2025-03)
xKV: Cross-Layer KV-Cache Compression via Aligned Singular Vector Extraction

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-24.

Repositories linked to this paper

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

Abstract

Long-context Large Language Models (LLMs) enable powerful applications but incur high memory costs due to the key-value states (KV-Cache). Recent studies attempt to share KV-Cache across layers, but these approaches either require expensive pretraining or rely on per-token crosslayer cosine similarity that is often limited in practice. We show, via Centered Kernel Alignment (CKA), that the dominant singular vectors of KV-Cache are well aligned across layers. Motivated by this observation, we propose xKV, a post-training compression method that jointly factorizes grouped-layer KV-Cache into a shared low-rank subspace, substantially reducing KV-Cache memory. Across widely used LLMs, xKV achieves up to 8× KV-Cache compression while preserving accuracy on long-context tasks and in multi-turn settings. To further improve efficiency, we introduce Selective Reconstruction (SR) at decode time. Combined with SR, xKV achieves up to 4.23× end-to-end speedup over the full attention baseline, and surpasses notable baselines with 30% higher throughput under a similar accuracy level. Overall, xKV provides a plug-and-play approach to reduce both memory and latency for long-context LLM inference. Our code is publicly available at: https: //github.com/abdelfattah-lab/xKV.

For agents

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

get_harvested_code_for_paper("openreview_XDb69lykA8")
get_code_for_paper("openreview_XDb69lykA8")
have("openreview_XDb69lykA8")

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

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

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

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

Connect an agent — have() is free.