SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.09688 · 2024

Squeezed Attention: Accelerating Long Context Length LLM Inference

arXiv · PDF · Open in the Atlas

Code that ran

12 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; 1 honoured the contract we drafted, 0 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/2411.09688.json · badge: /api/ran/2411.09688.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
SqueezeAILab/SqueezedAttention canonical (classifier label)
classifier basis: census
12 ran · 3 no recorded run
FunctionStatusWhere it lives
build_chat Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SqueezeAILab/SqueezedAttention/squeezedattention/utils.py
pointer only (licence: NONE) · get_code("66d002e5d75a1496")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

count_score Ran
ran, honoured the contract we drafted
SqueezeAILab/SqueezedAttention/LongBench/metrics.py
pointer only (licence: NONE); 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: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

find_layers Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/utils/modelutils.py
pointer only (licence: NONE); the stored copy get_code serves, from squeezeailab/kvquant, is pointer only (licence: NONE) · get_code("a9e7f2cdf016b88b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

get_config_class_from_processor_class Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SqueezeAILab/SqueezedAttention/transformers/utils/create_dummy_models.py
pointer only (licence: NONE); the stored copy get_code serves, from takagi97/OXA-Fine-tuning, is pointer only (licence: NONE) · get_code("3d999b95009c7537")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

get_module_names Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/utils/model_parse.py
pointer only (licence: NONE) · get_code("b65e0b634a94c717")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

get_processor_types_from_config_class Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SqueezeAILab/SqueezedAttention/transformers/utils/create_dummy_models.py
pointer only (licence: NONE); the stored copy get_code serves, from takagi97/OXA-Fine-tuning, is pointer only (licence: NONE) · get_code("0c0b81b081919d8e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

normalize_answer Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/LongBench/metrics.py
pointer only (licence: NONE); 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: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

normalize_zh_answer Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/LongBench/metrics.py
pointer only (licence: NONE); 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: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

parse_args Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/LongBench/pred.py
pointer only (licence: NONE) · get_code("8c953c2e0af15854")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

parse_model Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/utils/model_parse.py
pointer only (licence: NONE) · get_code("dd982ece7960b018")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

run_global_threshold Ran
ran; our contract draft was wrong, not the code
SqueezeAILab/SqueezedAttention/squeezedattention/clustering.py
pointer only (licence: NONE) · get_code("a521d80a7ee5e568")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

truncate_fn Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SqueezeAILab/SqueezedAttention/squeezedattention/utils.py
pointer only (licence: NONE) · get_code("983ad6de59ae59a1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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.

get_architectures_from_config_class Not yet run
unverified (harvested, no recorded run)
SqueezeAILab/SqueezedAttention/transformers/utils/create_dummy_models.py
pointer only (licence: NONE); the stored copy get_code serves, from takagi97/OXA-Fine-tuning, is pointer only (licence: NONE) · get_code("b176efb26f72e507")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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. No invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
SqueezeAILab/SqueezedAttention/utils/model_parse.py
pointer only (licence: NONE) · get_code("b66c43d90a1a3a1b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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. No invocation recorded.

load_model_and_tokenizer Not yet run
unverified (harvested, no recorded run)
SqueezeAILab/SqueezedAttention/LongBench/pred.py
pointer only (licence: NONE) · get_code("71856fc92741e6f7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, SqueezeAILab/SqueezedAttention 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. 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, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 5 the same month, 7 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
normalize_answer 133 other papers
99 dated earlier, 1 the same month, 32 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
20 dated earlier, 6 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
find_layers 27 other papers
20 dated earlier, 1 the same month, 4 later, 1 same year, order not determinable, 1 undated
2203.13474 (2022-03)
CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
2023.emnlp-main.892 (2023 (year only))
Z-FOLD: A Frustratingly Easy Post-Training Quantization Scheme for LLMs
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
and 24 more not named here
get_config_class_from_processor_class 27 other papers
16 dated earlier, 3 the same month, 6 later, 2 same year, order not determinable
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2308.12219 (2023-08)
Diffusion Language Models Can Perform Many Tasks with Scaling and Instruction-Finetuning
2311.07468 (2023-11)
An Analysis and Mitigation of the Reversal Curse
and 24 more not named here
get_architectures_from_config_class 25 other papers
15 dated earlier, 3 the same month, 6 later, 1 same year, order not determinable
2308.12219 (2023-08)
Diffusion Language Models Can Perform Many Tasks with Scaling and Instruction-Finetuning
2311.07468 (2023-11)
An Analysis and Mitigation of the Reversal Curse
2312.15710 (2023-12)
Alleviating Hallucinations of Large Language Models through Induced Hallucinations
and 22 more not named here
get_processor_types_from_config_class 25 other papers
15 dated earlier, 3 the same month, 6 later, 1 same year, order not determinable
2308.12219 (2023-08)
Diffusion Language Models Can Perform Many Tasks with Scaling and Instruction-Finetuning
2311.07468 (2023-11)
An Analysis and Mitigation of the Reversal Curse
2312.15710 (2023-12)
Alleviating Hallucinations of Large Language Models through Induced Hallucinations
and 22 more not named here
count_score 24 other papers
17 dated earlier, 6 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
get_module_names 1 other paper
1 dated earlier
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
load_model 1 other paper
1 dated earlier
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
parse_model 1 other paper
1 dated earlier
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-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

Emerging Large Language Model (LLM) applications require long input context in order to perform complex tasks like document analysis and code generation. For these long context length applications, the length of the input prompt poses a significant challenge in terms of inference efficiency since the inference costs increase linearly with sequence length. However, for many of these applications, much of the context in the prompt is fixed across different user inputs, thereby providing the opportunity to perform offline optimizations in order to process user inputs quickly, as they are received. We propose Squeezed Attention to accelerate LLM applications where a large portion of the input context is fixed. We first leverage K-means clustering offline to group the keys for the fixed context based on semantic similarity and represent each cluster with a single centroid value. During inference, we compare query tokens from the user input with the centroids to predict which keys from the fixed context are semantically relevant, and then compute exact attention using only the important keys, thereby reducing bandwidth and computational costs. We also present a hierarchical version of our algorithm which can reduce the complexity of attention from linear to logarithmic with respect to the fixed context length. We evaluate our method on long-context benchmarks including LongBench, where it achieves a 3.1$\times$ reduction in KV budget with no noticeable accuracy loss and up to an 8$\times$ reduction with only a 0.5 point accuracy gap for the LLaMA-2-7B-32K, LWM-Text-Chat-1M, and Longchat-7B-v1.5-32K models. Futhermore, we implement kernels for centroid comparison and sparse FlashAttention with important keys, achieving more than 4$\times$ speedups during both the prefill and generation phases for long-context inference. Our code is available at https://github.com/SqueezeAILab/SqueezedAttention.

For agents

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

get_harvested_code_for_paper("2411.09688")
get_code_for_paper("2411.09688")
have("2411.09688")

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

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

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

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

Connect an agent — have() is free.