Papers › Sparser Block-Sparse Attention via Token Permutation

Sparser Block-Sparse Attention via Token Permutation

24 Oct 2025ICMLarXiv:2510.21270added by Syntology

Xinghao Wang, Pengyu Wang, Dong Zhang, Chenkun Tan, Shaojun Zhou, Zhaoxiang Liu, Shiguo Lian, Fangxu Liu, Kai Song, Xipeng Qiu

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

Scaling the context length of large language models (LLMs) offers significant benefits but is computationally expensive. This expense stems primarily from the self-attention mechanism, whose O(N²) complexity with respect to sequence length presents a major bottleneck for both memory and latency. Fortunately, the attention matrix is often sparse, particularly for long sequences, suggesting an opportunity for optimization. Block-sparse attention has emerged as a promising solution that partitions sequences into blocks and skips computation for a subset of these blocks. However, the effectiveness of this method is highly dependent on the underlying attention patterns, which can lead to sub-optimal block-level sparsity. For instance, important key tokens for queries within a single block may be scattered across numerous other blocks, leading to computational redundancy. In this work, we propose Permuted Block-Sparse Attention (\textbf{PBS-Attn}), a plug-and-play method that leverages the permutation properties of attention to increase block-level sparsity and enhance the computational efficiency of LLM prefilling. We conduct comprehensive experiments on challenging real-world long-context datasets, demonstrating that PBS-Attn consistently outperforms existing block-sparse attention methods in model accuracy and closely matches the full attention baseline. Powered by our custom permuted-FlashAttention kernels, PBS-Attn achieves an end-to-end speedup of up to 2.75× in long-context prefilling, confirming its practical viability. Code available at https://github.com/xinghaow99/pbs-attn

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2510.21270")

Code

Syntology Ran 2 of 10 code samples harvested from 1 repository linked to this paper; 8 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 1 ran · fixture could not drive it.

By repository: found in paper text by Syntology: 10 samples from 1 repository, 2 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

xinghaow99/pbs-attn found in paper text by Syntology report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

10 samples harvested; 2 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
1ran · fixture could not drive it
8unverified

Licence: 10 of the 10 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from xinghaow99/pbs-attn. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

repeat_kv xinghaow99/pbs-attn/pbs_attn/patch/huggingface.py found in paper text by Syntology ran · fixture could not drive it fingerprinted no licence file found · pointer only · 3c76e52815c5401d · report
rotate_half xinghaow99/pbs-attn/pbs_attn/patch/huggingface.py found in paper text by Syntology ran · our draft was wrong fingerprinted no licence file found · pointer only · e03d53ba9d4f9ae5 · report
apply_permutation xinghaow99/pbs-attn/pbs_attn/src/permute_states.py found in paper text by Syntology unverified no licence file found · pointer only · affc3b6cf23a3c4c · report
apply_rotary_pos_emb xinghaow99/pbs-attn/pbs_attn/patch/huggingface.py found in paper text by Syntology unverified no licence file found · pointer only · de11bf4368235366 · report
block_pooled_attn xinghaow99/pbs-attn/pbs_attn/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · 90ecc7bc70c64f70 · report
first_token_mask xinghaow99/pbs-attn/pbs_attn/src/pbs.py found in paper text by Syntology unverified no licence file found · pointer only · 988658f43a8e8d23 · report
last_block_attn_sorting xinghaow99/pbs-attn/pbs_attn/src/permute_states.py found in paper text by Syntology unverified no licence file found · pointer only · c9fed577c6134689 · report
select_blocks xinghaow99/pbs-attn/pbs_attn/src/utils.py found in paper text by Syntology unverified no licence file found · pointer only · c8de7172a1d0130e · report
sum_all_diagonal_matrix xinghaow99/pbs-attn/pbs_attn/baselines/Minference.py found in paper text by Syntology unverified no licence file found · pointer only · e75815e606c87def · report
torch_block_wise_attention xinghaow99/pbs-attn/pbs_attn/baselines/Flexprefill.py found in paper text by Syntology unverified no licence file found · pointer only · c0466ce153afc8d6 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2510.21270, was issued in October 2025, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections