Papers › Scaling Stick-Breaking Attention: An Efficient Implementation and In-depth Study

Scaling Stick-Breaking Attention: An Efficient Implementation and In-depth Study

23 Oct 2024arXiv:2410.17980archive 2025-07-28

Shawn Tan, Songlin Yang, Aaron Courville, Rameswar Panda, Yikang Shen

The self-attention mechanism traditionally relies on the softmax operator, necessitating positional embeddings like RoPE, or position biases to account for token order. But current methods using still face length generalisation challenges. We investigate an alternative attention mechanism based on the stick-breaking process in larger scale settings. The method works as follows: For each token before the current, we determine a break point, which represents the proportion of the stick, the weight of the attention, to allocate to the current token. We repeat this on the remaining stick, until all tokens are allocated a weight, resulting in a sequence of attention weights. This process naturally incorporates recency bias, which has linguistic motivations for grammar parsing. We study the implications of replacing the conventional softmax-based attention mechanism with stick-breaking attention. We then discuss implementation of numerically stable stick-breaking attention and adapt Flash Attention to accommodate this mechanism. When used as a drop-in replacement for current softmax+RoPE attention systems, we find that stick-breaking attention performs competitively with current methods on length generalisation and downstream tasks. Stick-breaking also performs well at length generalisation, allowing a model trained with 2¹¹ context window to perform well at 2¹⁴ with perplexity improvements.

PaperPDFCodeCode 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="2410.17980")

Code

Syntology Ran 0 of 15 code samples harvested from 2 repositories linked to this paper; 15 have no recorded run.

By repository: official repository: 15 samples from 2 repositories, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ibm/dolomite-engine officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
shawntan/stickbreaking-attention officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. 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

15 samples harvested; 0 ran; 0 honoured the contract we drafted; 15 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.

15unverified

Licence: 0 of the 15 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 2 repositories linked to this paper, official or community; each sample names its own and says which. “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.

ceil_divide ibm/dolomite-engine/lm_engine/math.py official repository unverified Apache-2.0 (permissive) · 8593e6db982f0994 · report
check_power_of_2 ibm/dolomite-engine/lm_engine/math.py official repository unverified Apache-2.0 (permissive) · 1a14ef87df25882f · report
clip_gradients ibm/dolomite-engine/lm_engine/kernels/torch_utils.py official repository unverified Apache-2.0 (permissive) · be3f8284e0ad756c · report
cpp_jit ibm/dolomite-engine/lm_engine/kernels/jit.py official repository unverified Apache-2.0 (permissive) · 34aca61c3a883435 · report
ctx_needs_gradients ibm/dolomite-engine/lm_engine/kernels/custom_op.py official repository unverified Apache-2.0 (permissive) · 7d46751a4793398b · report
custom_op shawntan/stickbreaking-attention/stickbreaking_attention/utils.py official repository unverified Apache-2.0 (permissive) · 284647bfc008172c · report
get_counter_value ibm/dolomite-engine/lm_engine/kernels/counters.py official repository unverified Apache-2.0 (permissive) · c878e222f31d20d2 · report
get_powers_of_2 ibm/dolomite-engine/lm_engine/math.py official repository unverified Apache-2.0 (permissive) · b0541e2dcf262896 · report
is_aux_loss_zero ibm/dolomite-engine/lm_engine/training/loss.py official repository unverified Apache-2.0 (permissive) · 90f1af006a6709d6 · report
pad ibm/dolomite-engine/lm_engine/tokenizers/utils.py official repository unverified Apache-2.0 (permissive) · a604b508bd6fa282 · report
partialize_and_update_signature ibm/dolomite-engine/lm_engine/kernels/inductor.py official repository unverified Apache-2.0 (permissive) · a44644f7f170ef4a · report
sigmoid ibm/dolomite-engine/lm_engine/kernels/torch_utils.py official repository unverified Apache-2.0 (permissive) · dd3979e6d750a272 · report
stickbreaking shawntan/stickbreaking-attention/stickbreaking_attention/sb_ref.py official repository unverified Apache-2.0 (permissive) · 1019f820dfe99006 · report
tanh ibm/dolomite-engine/lm_engine/kernels/torch_utils.py official repository unverified Apache-2.0 (permissive) · 821f34b1af2cadb2 · report
xma_op ibm/dolomite-engine/lm_engine/kernels/custom_op.py official repository unverified Apache-2.0 (permissive) · c13c8953208d35dd · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionSoftmax

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