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

Source: [Scaling Stick-Breaking Attention: An Efficient Implementation and In-depth Study](<https://www.sota2.com/research/paper/68fa78a71e209131cea79a60>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-28T13:57:16.666Z

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

Published: 2024-10-23T15:51:13.000Z

## Abstract

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^{11}$ context window to perform well at $2^{14}$ with perplexity improvements.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Long-context retrieval and tracking on RULER 128K](<https://www.sota2.com/research/sota/long-context-retrieval-and-tracking-on-ruler-128k.md>): Long-context retrieval and tracking; RULER 128k; S-N Score: 33.33.

- [Long-context retrieval and tracking on RULER 32K](<https://www.sota2.com/research/sota/long-context-retrieval-and-tracking-on-ruler-32k.md>): Long-context retrieval and tracking; RULER 32k; S-N Score: 73.88.

- [Long-context retrieval and tracking on RULER 4K](<https://www.sota2.com/research/sota/long-context-retrieval-and-tracking-on-ruler-4k.md>): Long-context retrieval and tracking; RULER 4k; S-N Score: 76.72.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2410.17980>)

[PDF](<https://arxiv.org/pdf/2410.17980.pdf>)
